public void SubmitForm(ProductEntity userEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { userEntity.Modify(keyValue); } else { userEntity.Create(); } service.SubmitForm(userEntity, keyValue); }
public void SubmitForm(ProductEntity productEntity, string keyValue) { if (string.IsNullOrEmpty(keyValue)) { productEntity.Create(); _service.Insert(productEntity); } else { productEntity.Modify(keyValue); _service.Update(productEntity); } }
//主子表保存 public void SubmitForm(ProductEntity productEntity, string keyValue, List <ProductSubEntity> listProductSub) { if (!string.IsNullOrEmpty(keyValue)) { productEntity.Modify(keyValue); } else { productEntity.Create(); } List <ProductSubEntity> listProductSubUpdate = new List <ProductSubEntity>(); List <FileEntity> listFile = new List <FileEntity>(); foreach (var itemId in listProductSub) { ProductSubEntity productSubEntity = new ProductSubEntity(); productSubEntity.F_ParentId = productEntity.F_Id; productSubEntity.Attribute = itemId.Attribute; productSubEntity.PictureGuId = itemId.PictureGuId; productSubEntity.SKU = itemId.SKU; productSubEntity.Supplier = itemId.Supplier; productSubEntity.PurchaseAddress = itemId.PurchaseAddress; productSubEntity.HWeight = itemId.HWeight; productSubEntity.GWeight = itemId.GWeight; productSubEntity.SWeight = itemId.SWeight; productSubEntity.Long = itemId.Long; productSubEntity.Wide = itemId.Wide; productSubEntity.High = itemId.High; productSubEntity.PurchaseCost = itemId.PurchaseCost; productSubEntity.TransportCost = itemId.TransportCost; productSubEntity.OtherCost = itemId.OtherCost; productSubEntity.F_Description = itemId.F_Description; productSubEntity.Create(); var guid = productSubEntity.F_Id; string[] files = itemId.PictureGuId.Split(','); foreach (string f in files) { FileEntity file = new FileEntity(); file.F_ParentId = guid; file.F_File = f; file.Create(); listFile.Add(file); } listProductSubUpdate.Add(productSubEntity); } service.SubmitForm(productEntity, listProductSubUpdate, keyValue); }
public string SubmitForm(ProductEntity productEntity, string keyValue) { string f_Id; if (!string.IsNullOrEmpty(keyValue)) { productEntity.Modify(keyValue); service.Update(productEntity); f_Id = keyValue; new LogApp().WriteDbLog("修改产品分类:" + productEntity.ProductName, DbLogType.Update); } else { f_Id = productEntity.Create(); service.Insert(productEntity); new LogApp().WriteDbLog("新增产品分类:" + productEntity.ProductName, DbLogType.Create); } return(f_Id); }
public string SubmitForm(ProductEntity productEntity, string id) { string _id; if (!string.IsNullOrEmpty(id)) { productEntity.Modify(id); service.Update(productEntity); _id = id; new LogApp().WriteDbLog("修改产品分类:" + productEntity.ProductName, DbLogType.Update); } else { _id = productEntity.Create(); service.Insert(productEntity); new LogApp().WriteDbLog("新增产品分类:" + productEntity.ProductName, DbLogType.Create); } return(_id); }