Ejemplo n.º 1
0
 public void GetProductAllDataById(int generalId)
 {
     EasyOne.Model.Contents.CommonModelInfo commonModelInfoById = ContentManage.GetCommonModelInfoById(generalId);
     if (!commonModelInfoById.IsNull)
     {
         this.m_CommonModelInfo = commonModelInfoById;
         this.m_ProductInfoData = GetProductById(generalId, commonModelInfoById.ItemId, commonModelInfoById.TableName);
     }
 }
Ejemplo n.º 2
0
        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));
        }