/// <summary> /// 处理商品规格 /// </summary> /// <param name="product"></param> protected void HanderProductStandard(ProductInfo product) { string productIDList = string.Empty; if (product.StandardType == (int)ProductStandardType.Group) { productIDList = "," + RequestHelper.GetForm <string>("Product") + ","; productIDList = productIDList.Replace(",0,", "," + product.Id.ToString() + ","); productIDList = productIDList.Substring(1, productIDList.Length - 2); } ProductBLL.UpdateProductStandardType(productIDList, product.StandardType, product.Id); if (product.Id > 0) { ProductTypeStandardRecordBLL.DeleteByProductID(product.Id.ToString()); } if (RequestHelper.GetForm <string>("isOpenStandard") == "1") { string standardIDList = RequestHelper.GetForm <string>("StandardIDList"); if (standardIDList != string.Empty) { string[] productIDArray = productIDList.Split(','); string[] valueArr = RequestHelper.GetForm <string>("sValueList").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] marketPriceArr = RequestHelper.GetForm <string>("sMarketPrice").Split(','); string[] salePriceArr = RequestHelper.GetForm <string>("sSalePrice").Split(','); string[] storageArr = RequestHelper.GetForm <string>("sStorage").Split(','); string[] productNumberArr = RequestHelper.GetForm <string>("sProductNumber").Split(','); for (int i = 0; i < valueArr.Length; i++) { ProductTypeStandardRecordInfo standardRecord = new ProductTypeStandardRecordInfo(); if (product.StandardType == (int)ProductStandardType.Group) { standardRecord.GroupTag = productIDList; standardRecord.ProductId = Convert.ToInt32(productIDArray[i]); standardRecord.SalePrice = 0; standardRecord.SalePrice = 0; standardRecord.Storage = 0; standardRecord.ProductCode = string.Empty; } else { standardRecord.ProductId = product.Id; standardRecord.MarketPrice = Convert.ToDecimal(marketPriceArr[i]); standardRecord.SalePrice = Convert.ToDecimal(salePriceArr[i]); standardRecord.Storage = Convert.ToInt32(storageArr[i]); standardRecord.ProductCode = productNumberArr[i]; } standardRecord.StandardIdList = standardIDList.Substring(0, standardIDList.Length - 1); standardRecord.ValueList = valueArr[i].Replace("|", ";"); ProductTypeStandardRecordBLL.Add(standardRecord); } } } }