Esempio n. 1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="product">供应商实体</param>
        /// <param name="workId">机构id</param>
        /// <returns>true保存成功</returns>
        public bool SaveSupply(MW_SupportDic product, int workId)
        {
            try
            {
                Dictionary <string, string> dictionary = new Dictionary <string, string>();
                dictionary.Add("SupportName", product.SupportName);
                dictionary.Add("WorkId", workId.ToString());
                DataTable dt = GetSupplys(dictionary);

                //新增有重名数据
                if (product.SupplierID == 0 && dt.Rows.Count > 0)
                {
                    return(false);
                }
                else if (product.SupplierID != 0 && dt.Rows.Count > 0)
                {
                    if (dt.Select("SupplierID=" + product.SupplierID).Length == 1 && dt.Rows.Count > 1)
                    {
                        return(false);
                    }

                    if (dt.Select("SupplierID=" + product.SupplierID).Length == 0 && dt.Rows.Count > 0)
                    {
                        return(false);
                    }
                }

                this.BindDb(product);
                SetWorkId(workId);
                product.save();
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 更新供应商数据
 /// </summary>
 /// <param name="productDic">供应商实体</param>
 public void UpdateSupply(MW_SupportDic productDic)
 {
     productDic.DelFlag = 1;
     productDic.save();
 }