public void Delete(Cate_Value item) { FDIDB.Cate_Value.Remove(item); }
public ActionResult Save(string key, string codec, int agencyid, int cateid, int unit, int areaid) { if (key == Keyapi) { var objorder = _dlDa.GetObjOrder(areaid); var date = DateTime.Now.TotalSeconds(); var obja = Cates.FirstOrDefault(m => m.Barcode == codec); if (obja != null) { var list = (from productValue in obja.ListProductValueItems let listimport = productValue.ListImportProductItems.Where(m => m.IsIn && m.Value > 0).Select(importproduct => new DN_ImportProduct { GID = Guid.NewGuid(), Date = importproduct.Date, Value = importproduct.Value / 1000, Price = importproduct.Price, PriceNew = importproduct.PriceNew, DateEnd = importproduct.DateEnd, Quantity = 1, QuantityOut = 0, IsDelete = false, BarCode = importproduct.BarCode, AgencyId = objorder != null ? objorder.AgencyID : agencyid, //ProductValueID = 0 }).ToList() select new Product_Value { DateCreated = date, DateImport = date, Barcode = productValue.Barcode, PriceNew = productValue.ListImportProductItems.Where(m => m.IsIn && m.Value > 0).Sum(l => l.PriceNew), Value = productValue.ListImportProductItems.Where(m => m.IsIn && m.Value > 0).Sum(l => l.Value) / 1000, PriceCost = productValue.Price, Quantity = 1, QuantityOut = 0, IsDelete = false, UnitID = 1, AgencyId = objorder != null ? objorder.AgencyID : agencyid, ProductID = productValue.ID, DN_ImportProduct = listimport }).ToList(); var obj = new Cate_Value { CateID = cateid, UnitID = unit, IsDelete = false, Barcode = obja.Barcode, Quantity = 1, QuantityOut = 0, AgencyId = agencyid, DateCreated = date, PriceNew = obja.ListProductValueItems.Sum(m => m.ListImportProductItems.Where(n => n.IsIn).Sum(l => l.PriceNew)), DateImport = date, Value = obja.ListProductValueItems.Sum(m => m.ListImportProductItems.Where(n => n.IsIn).Sum(l => l.Value)) / 1000, Product_Value = list, }; if (objorder != null) { obj.RequestWareID = objorder.GID; } _dlDa.Add(obj); _dlDa.Save(); Cates.Remove(obja); } return(Json(1, JsonRequestBehavior.AllowGet)); } return(Json(0, JsonRequestBehavior.AllowGet)); }
public void Add(Cate_Value item) { FDIDB.Cate_Value.Add(item); }