Пример #1
0
        public static void SaveVendor(int woid, int id = 0)
        {
            using (var context = new DatabaseContext())
            {
                var e = context.tblVendorCosts.SingleOrDefault(o => o.tbljb_schedules_ID == woid);
                if (e != null)
                {
                    e.tblVendors_ID = id;
                }

                else
                {
                    e = new tblVendorCost();
                    e.tbljb_schedules_ID = woid;
                    e.tblVendors_ID      = id;
                    context.tblVendorCosts.Add(e);
                }

                context.SaveChanges();
            }
        }
Пример #2
0
        public static void SavePO(string poid, int woid)
        {
            using (var context = new DatabaseContext())
            {
                var e = context.tblVendorCosts.SingleOrDefault(o => o.tbljb_schedules_ID == woid);
                if (e != null)
                {
                    e.PurchaseOrderID = poid == "0" ? null: poid;
                }

                else
                {
                    e = new tblVendorCost();
                    e.tbljb_schedules_ID = woid;
                    e.PurchaseOrderID    = poid == "0" ? null : poid;
                    context.tblVendorCosts.Add(e);
                }

                context.SaveChanges();
            }
        }
Пример #3
0
        public static void SaveNotToExceed(decimal?NotToexceed, int woid)
        {
            using (var context = new DatabaseContext())
            {
                var e = context.tblVendorCosts.SingleOrDefault(o => o.tbljb_schedules_ID == woid);
                if (e != null)
                {
                    e.NotToExceed = (NotToexceed == 0) ? null : NotToexceed;
                }

                else
                {
                    e = new tblVendorCost();
                    e.tbljb_schedules_ID = woid;
                    e.NotToExceed        = (NotToexceed == 0) ? null : NotToexceed;
                    context.tblVendorCosts.Add(e);
                }

                context.SaveChanges();
            }
        }