public (bool, Guid) AddProduct(Product product) { using (ProductsDAL productsDAL = new ProductsDAL()) { return(productsDAL.AddProduct(product)); } }
/// <summary> /// 添加产品 /// </summary> /// <param name="productCode">产品编码</param> /// <param name="productName">产品名称</param> /// <param name="generalName">常用名</param> /// <param name="iscombineproduct">是否组合产品</param> /// <param name="brandid">品牌ID</param> /// <param name="bigunitid">大单位</param> /// <param name="smallunitid">小单位</param> /// <param name="bigSmallMultiple">大小单位比例</param> /// <param name="categoryid">分类ID</param> /// <param name="status">状态</param> /// <param name="attrlist">属性列表</param> /// <param name="valuelist">值列表</param> /// <param name="attrvaluelist">属性值键值对</param> /// <param name="commonprice">原价</param> /// <param name="price">优惠价</param> /// <param name="weight">重量</param> /// <param name="isnew">是否新品</param> /// <param name="isRecommend">是否推荐</param> /// <param name="effectiveDays">有效期天数</param> /// <param name="discountValue">折扣</param> /// <param name="productImg">产品图片</param> /// <param name="description">描述</param> /// <param name="operateid">操作人</param> /// <param name="clientid">客户端ID</param> /// <returns></returns> public string AddProduct(string productCode, string productName, string generalName, bool iscombineproduct, string brandid, string bigunitid, string smallunitid, int bigSmallMultiple, string categoryid, int status, string attrlist, string valuelist, string attrvaluelist, decimal commonprice, decimal price, decimal weight, bool isnew, bool isRecommend, int effectiveDays, decimal discountValue, string productImg, string shapeCode, string description, string operateid, string clientid) { lock (SingleLock) { if (!string.IsNullOrEmpty(productImg)) { if (productImg.IndexOf("?") > 0) { productImg = productImg.Substring(0, productImg.IndexOf("?")); } FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath(productImg)); productImg = FILEPATH + file.Name; if (file.Exists) { file.MoveTo(HttpContext.Current.Server.MapPath(productImg)); } } else { productImg = FILEPATH + DateTime.Now.ToString("yyyyMMddHHmmssms") + new Random().Next(1000, 9999).ToString() + ".png"; } var dal = new ProductsDAL(); return(dal.AddProduct(productCode, productName, generalName, iscombineproduct, brandid, bigunitid, smallunitid, bigSmallMultiple, categoryid, status, attrlist, valuelist, attrvaluelist, commonprice, price, weight, isnew, isRecommend, effectiveDays, discountValue, productImg, shapeCode, description, operateid, clientid)); } }
public string AddProduct(string productCode, string productName, string generalName, bool iscombineproduct, string brandid, string bigunitid, string smallunitid, int bigSmallMultiple, string categoryid, int status, string attrlist, string valuelist, string attrvaluelist, decimal commonprice, decimal price, decimal weight, bool isnew, bool isRecommend, int isallow, int isautosend, int effectiveDays, decimal discountValue, string productImg, string shapeCode, string description, List <ProductDetail> details, string operateid, string agentid, string clientid) { lock (SingleLock) { if (!string.IsNullOrEmpty(productImg)) { if (productImg.IndexOf("?") > 0) { productImg = productImg.Substring(0, productImg.IndexOf("?")); } FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath(productImg)); productImg = FILEPATH + file.Name; if (file.Exists) { file.MoveTo(HttpContext.Current.Server.MapPath(productImg)); } } var dal = new ProductsDAL(); string pid = dal.AddProduct(productCode, productName, generalName, iscombineproduct, brandid, bigunitid, smallunitid, bigSmallMultiple, categoryid, status, attrlist, valuelist, attrvaluelist, commonprice, price, weight, isnew, isRecommend, isallow, isautosend, effectiveDays, discountValue, productImg, shapeCode, description, operateid, clientid); //产品添加成功添加子产品 if (!string.IsNullOrEmpty(pid)) { //日志 LogBusiness.AddActionLog(CloudSalesEnum.EnumSystemType.Client, CloudSalesEnum.EnumLogObjectType.Product, EnumLogType.Create, "", operateid, agentid, clientid); foreach (var model in details) { model.ImgS = ""; dal.AddProductDetails(pid, model.DetailsCode, model.ShapeCode, model.SaleAttr, model.AttrValue, model.SaleAttrValue, model.Price, model.Weight, model.BigPrice, model.ImgS, model.Description, operateid, clientid); } } return(pid); } }
public string AddProduct(string productCode, string productName, string generalName, string prodiverid, string unitid, string categoryid, int status, int ispublic, string attrlist, string valuelist, string attrvaluelist, decimal commonprice, decimal price, decimal weight, int isallow, decimal discountValue, string productImg, string shapeCode, string description, List <ProductDetail> details, string operateid, string clientid, ref int result) { lock (SingleLock) { var dal = new ProductsDAL(); string pid = dal.AddProduct(productCode, productName, generalName, prodiverid, unitid, categoryid, status, ispublic, attrlist, valuelist, attrvaluelist, commonprice, price, weight, isallow, discountValue, productImg, shapeCode, description, operateid, clientid, ref result); //产品添加成功添加子产品 if (!string.IsNullOrEmpty(pid)) { //日志 LogBusiness.AddActionLog(IntFactoryEnum.EnumSystemType.Client, IntFactoryEnum.EnumLogObjectType.Product, EnumLogType.Create, "", operateid, clientid); foreach (var model in details) { dal.AddProductDetails(pid, model.DetailsCode, model.ShapeCode, model.SaleAttr, model.AttrValue, model.SaleAttrValue, model.Price, model.Weight, model.ImgS, model.Description, model.Remark, operateid, clientid); } } return(pid); } }