public ErrorInfo Edit(int id, CustProduct custProduct) { if (id != custProduct.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); CustProduct prd = db.CustProducts.FirstOrDefault(p => p.Id == id && !p.IsDeleted); if (prd == null) { return(ErrorInfo.Err_Resource_NotExist); } else { prd.CustCode = custProduct.CustCode; prd.Original = custProduct.Original; prd.CusItemCode = custProduct.CusItemCode; prd.CusVersion = custProduct.CusVersion; prd.CusModelNo = custProduct.CusModelNo; prd.CusDescription = custProduct.CusDescription; prd.IsDeleted = custProduct.IsDeleted; prd.PartNo = custProduct.PartNo; db.Entry(prd).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } else { return(ErrorInfo.Err_Internal_Error); } } }
public ErrorInfo Edit(int id, Package package) { if (id != package.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); Package truck = db.Packages.FirstOrDefault(p => p.Id == id && !p.IsDeleted); if (truck != null) { truck.GWeightReal = package.GWeightReal; truck.Status = package.Status; truck.IsDeleted = package.IsDeleted; truck.Boxname = package.Boxname; truck.SealedTime = package.SealedTime; truck.PackNo = package.PackNo; truck.Packer = package.Packer; truck.PackTime = package.PackTime; truck.PartNo = package.PartNo; truck.LotNo = package.LotNo; db.Entry(truck).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public ErrorInfo Edit(int id, TruckDefine truckDefine) { if (id != truckDefine.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); TruckDefine truck = db.TruckDefines.FirstOrDefault(p => p.Id == id); if (truck != null) { truck.Name = truckDefine.Name; truck.Length_mm = truckDefine.Length_mm; truck.Width_mm = truckDefine.Width_mm; truck.Height_mm = truckDefine.Height_mm; truck.MaxLoad_T = truckDefine.MaxLoad_T; truck.CarriagePlans = truckDefine.CarriagePlans; db.Entry(truck).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public ErrorInfo Edit(int id, PalletDefine palletDefine) { if (id != palletDefine.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); PalletDefine pallet = db.PalletDefines.FirstOrDefault(p => p.Id == id && !p.IsDeleted); if (pallet != null) { pallet.Material = palletDefine.Material; pallet.Length_mm = palletDefine.Length_mm; pallet.Width_mm = palletDefine.Width_mm; pallet.Height_mm = palletDefine.Height_mm; pallet.NetWeight_kg = palletDefine.NetWeight_kg; pallet.GrossWeight_kg = palletDefine.GrossWeight_kg; pallet.Note = palletDefine.Note; pallet.IsDeleted = palletDefine.IsDeleted; db.Entry(pallet).State = System.Data.Entity.EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } else { return(ErrorInfo.Err_Internal_Error); } } else { return(ErrorInfo.Err_Resource_NotExist); } }
public ErrorInfo Delete(int id) { ShippmentEntities db = new ShippmentEntities(); PhotoDefine photo = db.PhotoDefines.FirstOrDefault(p => p.Id == id); if (photo != null) { db.Entry(photo).State = EntityState.Deleted; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public static ErrorInfo Delete(int id) { ShippmentEntities db = new ShippmentEntities(); HwProductPlan plan = db.HwProductPlans.FirstOrDefault(p => p.Id == id); if (plan != null) { db.Entry(plan).State = EntityState.Deleted; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public bool DeletePhoto(int id) { ShippmentEntities db = new ShippmentEntities(); BoardingPhoto photo = db.BoardingPhotoes.FirstOrDefault(p => p.Id == id); if (photo != null) { db.Entry(photo).State = EntityState.Deleted; return(db.SaveChanges() > 0); } else { return(false); } }
public ErrorInfo Delete(int id) { ShippmentEntities db = new ShippmentEntities(); CarriagePlan carriage = db.CarriagePlans.FirstOrDefault(p => p.Id == id); if (carriage != null) { db.Entry(carriage).State = System.Data.Entity.EntityState.Deleted; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public bool EditBoardingPhoto(int id, BoardingPhoto obj) { if (id != obj.Id) { return(false); } ShippmentEntities db = new ShippmentEntities(); BoardingPhoto photo = db.BoardingPhotoes.FirstOrDefault(p => p.Id == id); if (photo != null) { photo.FullPath = obj.FullPath; photo.RegTime = obj.RegTime; //photo.PhotoDefine = obj.PhotoDefine;//常规修改不该修改导航属性吧? //photo.Carriage = obj.Carriage;//常规修改不该修改导航属性吧? db.Entry(photo).State = EntityState.Modified; return(db.SaveChanges() > 0); } return(false); }
public static ErrorInfo Edit(int id, HwProductPlan prodPlan) { if (id != prodPlan.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); HwProductPlan plan = db.HwProductPlans.FirstOrDefault(p => p.Id == id); if (plan != null) { plan.Qty = prodPlan.Qty; plan.HwShipOrderId = prodPlan.HwShipOrderId; plan.CustProductId = prodPlan.CustProductId; db.Entry(plan).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public ErrorInfo Edit(int id, PhotoDefine photoDefine) { if (id != photoDefine.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); PhotoDefine photo = db.PhotoDefines.FirstOrDefault(p => p.Id == id); if (photo != null) { photo.BoardingPhotoes = photoDefine.BoardingPhotoes; photo.Height = photoDefine.Height; photo.Name = photoDefine.Name; photo.Width = photoDefine.Width; db.Entry(photo).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }
public ErrorInfo Delete(int id) { ShippmentEntities db = new ShippmentEntities(); PackageDefine pack = db.PackageDefines.FirstOrDefault(p => p.Id == id); if (pack != null) { pack.IsDeleted = true; db.Entry(pack).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } else { return(ErrorInfo.Err_Internal_Error); } } else { return(ErrorInfo.Err_Resource_NotExist); } }
public ErrorInfo Edit(int id, PackageDefine packageDefine) { if (id != packageDefine.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); PackageDefine pack = db.PackageDefines.FirstOrDefault(p => p.Id == id && !p.IsDeleted); if (pack != null) { pack.Material = packageDefine.Material; pack.Length_mm = packageDefine.Length_mm; pack.Width_mm = packageDefine.Width_mm; pack.Height_mm = packageDefine.Height_mm; pack.NetWeight_kg = packageDefine.NetWeight_kg; pack.GrossWeight_kg = packageDefine.GrossWeight_kg; pack.Note = packageDefine.Note; pack.IsDeleted = packageDefine.IsDeleted; pack.PartNo = packageDefine.PartNo; pack.Unit = packageDefine.Unit; pack.Qty = packageDefine.Qty; db.Entry(pack).State = EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } else { return(ErrorInfo.Err_Internal_Error); } } else { return(ErrorInfo.Err_Resource_NotExist); } }
public ErrorInfo Edit(int id, CarriagePlan carriagePlan) { if (id != carriagePlan.Id) { return(ErrorInfo.Err_Bad_Request_Information); } ShippmentEntities db = new ShippmentEntities(); CarriagePlan carriage = db.CarriagePlans.FirstOrDefault(p => p.Id == id); if (carriage != null) { //carriage.HwShipOrder = carriagePlan.HwShipOrder;//常规修改不该修改导航属性吧? //carriage.HwShipOrderId = carriagePlan.HwShipOrderId;//常规修改不该修改导航属性吧? carriage.TruckDefine = carriagePlan.TruckDefine; db.Entry(carriage).State = System.Data.Entity.EntityState.Modified; if (db.SaveChanges() > 0) { return(ErrorInfo.Succeed); } } return(ErrorInfo.Err_Internal_Error); }