public bool Save(ProductSize productSize, out string strResult) { strResult = string.Empty; bool result = false; var pro = ProductSizeRepository.GetQueryable().FirstOrDefault(s => s.ID == productSize.ID); if (pro != null) { try { pro.ID = productSize.ID; pro.ProductCode = productSize.ProductCode; pro.SizeNo = productSize.SizeNo; pro.AreaNo = productSize.AreaNo; ProductSizeRepository.SaveChanges(); result = true; } catch (Exception ex) { strResult = "原因:" + ex.Message; } } else { strResult = "原因:未找到当前需要修改的数据!"; } return(result); }
public bool Add(ProductSize productSize, out string strResult) { strResult = string.Empty; bool result = false; var pro = new ProductSize(); if (pro != null) { try { pro.ID = productSize.ID; pro.ProductCode = productSize.ProductCode; pro.SizeNo = productSize.SizeNo; pro.AreaNo = productSize.AreaNo; ProductSizeRepository.Add(pro); ProductSizeRepository.SaveChanges(); result = true; } catch (Exception ex) { strResult = "原因:" + ex.Message; } } else { strResult = "原因:找不到当前登陆用户!请重新登陆!"; } return(result); }
public bool Delete(int productSizeId, out string strResult) { strResult = string.Empty; bool result = false; var si = ProductSizeRepository.GetQueryable().FirstOrDefault(s => s.ID == productSizeId); if (si != null) { try { ProductSizeRepository.Delete(si); ProductSizeRepository.SaveChanges(); result = true; } catch (Exception) { strResult = "原因:已在使用"; } } else { strResult = "原因:未找到当前需要删除的数据!"; } return(result); }
public bool Save(ProductSize productSize) { var pro = ProductSizeRepository.GetQueryable().FirstOrDefault(s => s.ID == productSize.ID); pro.ID = productSize.ID; pro.ProductCode = productSize.ProductCode; pro.ProductNo = productSize.ProductNo; pro.SizeNo = productSize.SizeNo; pro.AreaNo = productSize.AreaNo; ProductSizeRepository.SaveChanges(); return(true); }
public bool Add(ProductSize productSize) { var pro = new ProductSize(); pro.ID = productSize.ID; pro.ProductCode = productSize.ProductCode; pro.ProductNo = productSize.ProductNo; pro.SizeNo = productSize.SizeNo; pro.AreaNo = productSize.AreaNo; ProductSizeRepository.Add(pro); ProductSizeRepository.SaveChanges(); return(true); }
public bool Delete(int productSizeId) { var si = ProductSizeRepository.GetQueryable().FirstOrDefault(s => s.ID == productSizeId); if (si != null) { ProductSizeRepository.Delete(si); ProductSizeRepository.SaveChanges(); } else { return(false); } return(true); }