public override void GetItemInfo() { if ((this.m_haveWholesalePurview && this.m_ProductInfo.EnableWholesale) && (this.m_Quantity >= this.m_ProductInfo.PriceInfo.NumberWholesale1)) { base.SaleType = 4; } else { base.SaleType = 1; } base.Price = ProductPrice.GetTruePrice(this.m_ProductInfo, this.m_Quantity, this.m_UserInfo, this.m_Property, this.m_haveWholesalePurview); base.Price = AbstractItemInfo.TaxRateCompute(this.m_NeedInvoice, this.m_ProductInfo, base.Price); base.ProductName = this.m_ProductInfo.ProductName; base.Unit = this.m_ProductInfo.Unit; base.Amount = this.m_Quantity; base.PriceMarket = this.m_ProductInfo.PriceMarket; base.ServiceTerm = this.m_ProductInfo.ServiceTerm; base.ServiceTermUnit = this.m_ProductInfo.ServiceTermUnit; base.Remark = ""; base.BeginDate = DateTime.Today; base.PresentExp = this.m_ProductInfo.PresentExp; base.PresentMoney = this.m_ProductInfo.PresentMoney; base.PresentPoint = this.m_ProductInfo.PresentPoint; base.ProductId = this.m_ProductInfo.ProductId; base.TableName = this.m_ProductInfo.TableName; base.ProductKind = this.m_ProductInfo.ProductKind; base.TotalWeight = this.m_ProductInfo.Weight * base.Amount; base.SubTotal = base.Price * this.m_Quantity; base.Property = this.m_Property; base.ProductCharacter = this.m_ProductInfo.ProductCharacter; base.Weight = this.m_ProductInfo.Weight; }
public static bool Update(int generalId, ProductInfo productInfo, IList <ProductDataInfo> dataInfoList, IList <ProductPriceInfo> priceInfoList) { EasyOne.Model.Contents.CommonModelInfo commonModelInfoById = ContentManage.GetCommonModelInfoById(generalId); if (commonModelInfoById.IsNull) { return(false); } productInfo.ProductId = commonModelInfoById.ItemId; string tableName = commonModelInfoById.TableName; if (commonModelInfoById.LinkType == 1) { return(dalContentManage.UpdateCommonModel(generalId, productInfo.Fields)); } int num = 0; int num2 = 0; foreach (ProductDataInfo info2 in dataInfoList) { num += info2.Stocks; num2 += info2.AlarmNum; } if (num > 0) { productInfo.Stocks = num; } if (num2 > 0) { productInfo.AlarmNum = num2; } if (num2 > num) { num2 = num; } if (!dalContentManage.UpdateCommonModel(generalId, productInfo.Fields) || !ProductCommon.Update(productInfo, tableName)) { return(false); } dal.Update(productInfo, tableName); if (!string.IsNullOrEmpty(productInfo.Properties) && !ProductData.Update(productInfo.ProductId, tableName, dataInfoList)) { return(false); } return((priceInfoList == null) || ProductPrice.Update(productInfo.ProductId, tableName, priceInfoList)); }
public static bool Add(int modelId, ProductInfo productInfo, IList <ProductDataInfo> productDataInfoList, IList <ProductPriceInfo> priceInfoList) { ModelInfo modelInfoById = ModelManager.GetModelInfoById(modelId); if (modelInfoById.IsNull) { return(false); } string tableName = modelInfoById.TableName; int newProductId = GetNewProductId(); productInfo.ProductId = newProductId; bool flag = true; int num2 = 0; int alarmNum = 0; foreach (ProductDataInfo info2 in productDataInfoList) { num2 += info2.Stocks; alarmNum = info2.AlarmNum; } productInfo.Stocks = num2; productInfo.AlarmNum = alarmNum; flag = Add(modelId, tableName, productInfo); StockInfo stockInfo = new StockInfo(); stockInfo.StockId = StockManage.GetMaxId() + 1; stockInfo.StockNum = StockItem.GetInStockNum(); DataRow[] rowArray = productInfo.Fields.Select("FieldName='Inputer'"); if (rowArray.Length > 0) { stockInfo.Inputer = rowArray[0]["FieldValue"].ToString(); } stockInfo.InputTime = DateTime.Now; stockInfo.StockType = StockType.InStock; stockInfo.Remark = "商品库存初始"; StockManage.Add(stockInfo); if (flag) { IList <StockItemInfo> infoList = new List <StockItemInfo>(); if (!string.IsNullOrEmpty(productInfo.Properties)) { flag = ProductData.Add(newProductId, tableName, productDataInfoList); foreach (ProductDataInfo info4 in productDataInfoList) { StockItemInfo item = new StockItemInfo(); item.ItemId = StockItem.GetMaxId() + 1; item.Amount = info4.Stocks; item.Price = info4.PriceInfo.Price; item.ProductId = newProductId; item.TableName = tableName; item.Property = info4.PropertyValue; item.StockId = stockInfo.StockId; item.ProductNum = productInfo.ProductNum; item.Unit = productInfo.Unit; item.ProductName = productInfo.ProductName; infoList.Add(item); } } else { StockItemInfo info6 = new StockItemInfo(); info6.Amount = productInfo.Stocks; info6.Price = productInfo.PriceInfo.Price; info6.ProductId = newProductId; info6.TableName = tableName; info6.Property = string.Empty; info6.ProductNum = productInfo.ProductNum; info6.Unit = productInfo.Unit; info6.ProductName = productInfo.ProductName; infoList.Add(info6); } StockItem.Add(infoList, stockInfo.StockId); if (((productInfo.PriceInfo.PriceMember == -1M) || (productInfo.PriceInfo.PriceAgent == -1M)) && (priceInfoList != null)) { flag = ProductPrice.Add(newProductId, tableName, priceInfoList); } } return(flag); }