Ejemplo n.º 1
0
 public void SaveMaterialSupplier(MaterialSupplier materialSupplier)
 {
     using (var dbContext = new BasisDataDbContext())
     {
         MaterialSupplier supplier = GetMaterialSupplier(materialSupplier.MaterialID, materialSupplier.SupplierID);
         if (supplier != null)
         {
             materialSupplier.ID = supplier.ID;
             dbContext.Update<MaterialSupplier>(materialSupplier);
         }
         else
         {
             dbContext.Insert<MaterialSupplier>(materialSupplier);
         }
     }
 }
Ejemplo n.º 2
0
        public string AddMaterial(int sId, int mId, string price, string remark)
        {
            try
            {
                double p = 0;
                var model = new MaterialSupplier();


                //this.TryUpdateModel<MaterialSupplier>(model);
                try
                {
                    p = double.Parse(price);
                    model.Price = p;
                }
                catch
                {
                }
                model.MaterialID = mId;
                model.SupplierID = sId;
                model.Remark = remark;
                model.MaterialName = this.BasisDataService.GetMaterial(mId).Name;
                model.SupplierName = this.BasisDataService.GetSupplier(sId).Name;
                this.BasisDataService.SaveMaterialSupplier(model);
                this.RefreshParent();
                return "true";
            }
            catch
            {
                return "false";
            }
        }