Search Results

Search found 23 results on 1 pages for 'anry'.

Page 1/1 | 1 

  • Methods for deep cloning objects in C#

    - by Anry
    I have a class: public class Order : BaseEPharmObject { public Order() { } public virtual Guid Id { get; set; } public virtual DateTime Created { get; set; } public virtual DateTime? Closed { get; set; } public virtual OrderResult OrderResult { get; set; } public virtual decimal Balance { get; set; } public virtual Customer Customer { get; set; } public virtual Shift Shift { get; set; } public virtual Order LinkedOrder { get; set; } public virtual User CreatedBy { get; set; } public virtual decimal TotalPayable { get; set; } public virtual IList<Transaction> Transactions { get; set; } public virtual IList<Payment> Payments { get; set; } } I need to clone objects of class Order. How to implement a deep copy right in the base class?

    Read the article

  • How to clone objects in NHibernate?

    - by Anry
    How to implement cloning of objects (entities) in NHibernate? In the classes of entities has properties such public virtual IList<Club> Clubs { get; set; } All classes are inherited from BaseObject. I tried to implement using xml serialization, but the interfaces are not serialized. Thank you for your answers!

    Read the article

  • NHibernate: How to save list in the database?

    - by Anry
    I have a table Order, Transaction, Payment. Class Order has the properties: public virtual Guid Id { get; set; } public virtual DateTime Created { get; set; } ... I added properties: public virtual IList<Transaction> Transactions { get; set; } public virtual IList<Payment> Payments { get; set; } These properties contain a record of tables [Transaction] and [Payment]. How to keep these lists in the database?

    Read the article

  • WPF: Problem with SelectedItem for ComboBox

    - by Anry
    XAML: <ComboBox Height="27" Margin="124,0,30,116" Name="cbProductDefaultVatRate" VerticalAlignment="Bottom" ItemsSource="{Binding}"> <ComboBox.ItemTemplate> <DataTemplate> <Label Height="26" Content="{Binding Path=Value}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> Set Data for cbProductDefaultVatRate.Items (Type - VatRate): private void ShowAllVatRates() { cbProductDefaultVatRate.Items.Clear(); cbProductDefaultVatRate.ItemsSource = new VatRateRepository().GetAll(); } Similarly, I defined property: private Product SelectedProduct { get; set; } The Product contains VatRate: SelectedProduct.DefaultVatRate How to set SelectedItem equal SelectedProduct.DefaultVatRate? I tried: cbProductDefaultVatRate.SelectedItem = SelectedProduct.DefaultVatRate; But it does not work. Thank you for answers!

    Read the article

  • NHibernate: Mapping collections of value types

    - by Anry
    I have a table Order, Transaction, Payment. Class Order has the properties: public virtual Guid Id { get; set; } public virtual DateTime Created { get; set; } ... I added properties: public virtual IList<Transaction> Transactions { get; set; } public virtual IList<Payment> Payments { get; set; } These properties contain a record of tables [Transaction] and [Payment]. How to keep these lists in the database?

    Read the article

  • NHibernate: Mapping IList property

    - by Anry
    I have a table Order, Transaction, Payment. Class Order has the properties: public virtual Guid Id { get; set; } public virtual DateTime Created { get; set; } ... I added properties: public virtual IList<Transaction> Transactions { get; set; } public virtual IList<Payment> Payments { get; set; } These properties contain a record of tables [Transaction] and [Payment]. How to keep these lists in the database?

    Read the article

  • LIKE query for DateTime in NHibernate

    - by Anry
    For a column of type varchar I could write such a query: public IList<Order> GetByName(string orderName) { using (ISession session = NHibernateHelper.OpenSession()) { return session.CreateCriteria<Order>(). Add(Restrictions.Like("Name", string.Format("%{0}%", orderName))). List<Order>(); } } How do I write a similar LIKE-query for a column that has type datetime? public IList<Order> GetByDateTime(DateTime dateTime) { using (ISession session = NHibernateHelper.OpenSession()) { return //LIKE-query } } That is, if the method is passed the date and part-time (eg "25.03.2010 19"), then displays all orders are carried out in this period of time.

    Read the article

  • C#: DataTime Parsing

    - by Anry
    I have a string of the form "ORDER20100322194007", it "20100322194007" Date and time 2010-03-22 19:40:07.000. How to parse a string and get the contained object DateTime?

    Read the article

  • Django: Save data from form in DB

    - by Anry
    I have a model: class Cost(models.Model): project = models.ForeignKey(Project) cost = models.FloatField() date = models.DateField() For the model I created a class form: class CostForm(ModelForm): class Meta: model = Cost fields = ['date', 'cost'] view.py: def cost(request, offset): if request.method == 'POST': #HOW save data in DB? return HttpResponseRedirect('/') else: form = CostForm() In the template file determined: <form action="/cost/{{ project }}/" method="post" accept-charset="utf-8"> <label for="date">Date:</label><input type="text" name="date" value={{ current_date }} id="date" /> <label for="cost">Cost:</label><input type="text" name="cost" value="0" id="cost" /> <p><input type="submit" value="Add"></p> </form> How save data from form in DB? P.S. offset = project name Model: class Project(models.Model): title = models.CharField(max_length=150) url = models.URLField() manager = models.ForeignKey(User) timestamp = models.DateTimeField() I tried to write: def cost(request, offset): if request.method == 'POST': form = CostForm(request.POST) if form.is_valid(): instance = form.save(commit=False) instance.project = Project.objects.filter(title=offset) instance.date = request.date instance.cost = request.cost instance.save() return HttpResponseRedirect('/') else: form = CostForm() But it does not work :(

    Read the article

  • Django: Summing values

    - by Anry
    I have a two Model - Project and Cost. class Project(models.Model): title = models.CharField(max_length=150) url = models.URLField() manager = models.ForeignKey(User) class Cost(models.Model): project = models.ForeignKey(Project) cost = models.FloatField() date = models.DateField() I must return the sum of costs for each project. view.py: from mypm.costs.models import Project, Cost from django.shortcuts import render_to_response from django.db.models import Avg, Sum def index(request): #... return render_to_response('index.html',... How?

    Read the article

  • Dynamic filling WrapPanel buttons from DB, setting the event handlers

    - by Anry
    I have a table: I'm using NHibernate. The class of entity: public class PurchasedItem { public virtual int Id { get; set; } public virtual Product Product { get; set; } public virtual int SortSale { get; set; } } I want to get all the records table PurchasedItems (my method returns an IList ). Records are sorted in descending order (column SortSale). How to fill WrapPanel buttons from the list IList ? For each button assign the event handler. By pressing the button display a message with the name of the product.

    Read the article

  • How to quickly save more than a thousand entries in the database in NHibernate?

    - by Anry
    I create and retain objects of business class in the loop for (int i = num.StartNumber; i <= num.EndNumber; i++) { var voucher = new Domain.GiftVouchers { UniqueNumber = i.ToString(), Denomination = num.Denomination, ExpiryDateTime = DateTime.Now }; voucher.Save(); } The method of preservation NHibernate using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.SaveOrUpdate(giftVouchers); transaction.Commit(); } If you generate 1000 + entries, we have to wait long. How can I increase the speed of this operation?

    Read the article

  • NHibernate, VS 2010

    - by ??????
    ????????????, ANRY! ?????? ??????? ??? ??????????? ???????? ?? ????????????, ?????????? ? NHibernate. ??? ?? ???????? ???? ?????? "Hello NHibernate!". ???????????? ??????????? ????? ??????? ????????: ?? ????, ???? ?????, ??????, ?????. ?????????????? ?????? 4 ??????? ? MSSQL 2010: ?????(id_??????, ????????, ????), ??????(id_???????, ???, ???????), ?????(id_??????, id_???????, ?????????) ? ?????? ??????(id_?????? ??????, id_??????, id_??????, ??????????). ??????????????, ?????? 4 ??????: ?????, ??????, ?????, ?????? ??????. ?????? ??? ?????: ????? ?? ????????? 4 mapping-?????, ??? ?? ????? ???????????? ?????? ? ????? ???? Debug ???????? ????????? ??????: "Could not compile the mapping document: Sklad.products.hbm.xml". ?????? "????????" ?????????, ??? ??????. ? ??? ????? ???? ???????? ? ??? ?? ????? ??????? ? ?????????, ??????. P.S. ???? ?? ??????, ?????? ???????? ?? ?????: [email protected] Google translation (I cleaned this up a but, don't don't speak russian, someone else please improve if it's wrong) Hello, ANRY! Most recently, during the passage of the practice of the university, faced with NHibernate. I read your article "Hello NHibernate!". Took to implement something like a store: that is, a product, the customer order. Accordingly created 4 tables in MSSQL 2010: Goods (id_tovara, name, price) Client (id_klienta, name, surname) Order (id_zakaza, id_klienta, cost) Order Line (id_stroki order id_zakaza, id_tovara, quantity) Accordingly, created 4 classes: Product, Customer, Order, Order Line. my question is this: whether you want to create 4 mapping-file, or you can make only one? And when there is a Debug gives the following error: "Could not compile the mapping document: Sklad.products.hbm.xml. And "Build" is normal, no errors. In what may be the problem and how it can solve? Regards, Andrew. PS if not difficult, you can reply to e-mail: [email protected]

    Read the article

1