Beispiel #1
0
            public static void EditFromObject(INVOICES_PURCHASES p)
            {
                if (p.VALIDATION == 1)
                {
                    DialogError.Error(); return;
                }

                if (p.ID > 0) // edit
                {
                    try
                    {
                        var r = Get(p.ID);
                        r.DATE                 = p.DATE;
                        r.DESCRIPTION          = p.DESCRIPTION;
                        r.ID_WHOLESALERS       = p.ID_WHOLESALERS;
                        r.ID_USERS             = p.ID_USERS;
                        r.MONEY_PAID           = p.MONEY_PAID;
                        r.MONEY_STAMP          = p.MONEY_STAMP;
                        r.MONEY_TAX            = p.MONEY_TAX;
                        r.MONEY_TOTAL          = p.MONEY_TOTAL;
                        r.MONEY_UNPAID         = p.MONEY_UNPAID;
                        r.MONEY_WITHOUT_ADDEDD = p.MONEY_WITHOUT_ADDEDD;
                        r.VALIDATION           = p.VALIDATION;
                        _db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        F_File.LogError(e);
                    }
                }
                else         // add
                {
                    try
                    {
                        p.ID = NewId();
                        _db.INVOICES_PURCHASES.Add(p);
                        _db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        F_File.LogError(e);
                    }
                }
            }
Beispiel #2
0
 public static INVOICES_PURCHASES AddInvoice(int id_user, int id_Wholesaler)
 {
     try
     {
         var mInvoices = new INVOICES_PURCHASES
         {
             ID                   = NewId(),
             ID_USERS             = id_user,
             ID_WHOLESALERS       = id_Wholesaler,
             DATE                 = DateTime.Now,
             DESCRIPTION          = "",
             VALIDATION           = 0,
             MONEY_TAX            = 0,
             MONEY_STAMP          = 0,
             MONEY_WITHOUT_ADDEDD = 0,
             MONEY_TOTAL          = 0,
             MONEY_PAID           = 0,
             MONEY_UNPAID         = 0,
         };
         Add(mInvoices);
         return(mInvoices);
     }
     catch { return(null); }
 }
Beispiel #3
0
 public static void Add(INVOICES_PURCHASES p)
 {
     _db.INVOICES_PURCHASES.Add(p);
     _db.SaveChanges();
 }