/// <summary> /// 保存数据 /// </summary> /// <param name="product">生产商对象</param> /// <param name="workId">机构ID</param> /// <returns>返回结果对象</returns> public DGBillResult SaveProduct(DG_ProductDic product, int workId) { DGBillResult result = new DGBillResult(); List <Tuple <string, string, SqlOperator> > lst = new List <Tuple <string, string, SqlOperator> >(); lst.Add(Tuple.Create("ProductName", product.ProductName, SqlOperator.Equal)); lst.Add(Tuple.Create("delflag", "0", SqlOperator.Equal)); lst.Add(Tuple.Create("WorkId", workId.ToString(), SqlOperator.Equal)); IEnumerable <DG_ProductDic> objs = NewObject <IDGDao>().GetEntityType <DG_ProductDic>(lst, null); var p = objs.FirstOrDefault(i => i.ProductID == product.ProductID); if (p != null) { product.save(); result.Result = 0; return(result); } if (objs != null && objs.Any()) { result.Result = 1; result.ErrMsg = "已经存在同名的生产厂厂家名称"; return(result); } else { result.Result = 0; product.save(); return(result); } }
/// <summary> /// 更新生产商数据 /// </summary> /// <param name="productDic">生产商对象</param> public void UpdateProduct(DG_ProductDic productDic) { productDic.DelFlag = 1; productDic.save(); }