Exemplo n.º 1
0
        /// <summary>
        /// 从IDataReader创建ExtSuitProductInfo
        /// </summary>
        public static ExtSuitProductInfo BuildExtSuitProductFromReader(IDataReader reader)
        {
            ExtSuitProductInfo extSuitProductInfo = new ExtSuitProductInfo();

            extSuitProductInfo.RecordId = TypeHelper.ObjectToInt(reader["recordid"]);
            extSuitProductInfo.PmId = TypeHelper.ObjectToInt(reader["pmid"]);
            extSuitProductInfo.Discount = TypeHelper.ObjectToInt(reader["discount"]);
            extSuitProductInfo.Number = TypeHelper.ObjectToInt(reader["number"]);
            extSuitProductInfo.Pid = TypeHelper.ObjectToInt(reader["pid"]);
            extSuitProductInfo.PSN = reader["psn"].ToString();
            extSuitProductInfo.CateId = TypeHelper.ObjectToInt(reader["cateid"]);
            extSuitProductInfo.BrandId = TypeHelper.ObjectToInt(reader["brandid"]);
            extSuitProductInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]);
            extSuitProductInfo.StoreCid = TypeHelper.ObjectToInt(reader["storecid"]);
            extSuitProductInfo.StoreSTid = TypeHelper.ObjectToInt(reader["storestid"]);
            extSuitProductInfo.SKUGid = TypeHelper.ObjectToInt(reader["skugid"]);
            extSuitProductInfo.Name = reader["name"].ToString();
            extSuitProductInfo.ShopPrice = TypeHelper.ObjectToDecimal(reader["shopprice"]);
            extSuitProductInfo.MarketPrice = TypeHelper.ObjectToDecimal(reader["marketprice"]);
            extSuitProductInfo.CostPrice = TypeHelper.ObjectToDecimal(reader["costprice"]);
            extSuitProductInfo.State = TypeHelper.ObjectToInt(reader["state"]);
            extSuitProductInfo.IsBest = TypeHelper.ObjectToInt(reader["isbest"]);
            extSuitProductInfo.IsHot = TypeHelper.ObjectToInt(reader["ishot"]);
            extSuitProductInfo.IsNew = TypeHelper.ObjectToInt(reader["isnew"]);
            extSuitProductInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]);
            extSuitProductInfo.Weight = TypeHelper.ObjectToInt(reader["weight"]);
            extSuitProductInfo.ShowImg = reader["showimg"].ToString();

            return extSuitProductInfo;
        }
Exemplo n.º 2
0
 /// <summary>
 /// 创建OrderProductInfo
 /// </summary>
 public static OrderProductInfo BuildOrderProduct(ExtSuitProductInfo extSuitProductInfo)
 {
     OrderProductInfo orderProductInfo = new OrderProductInfo();
     orderProductInfo.Pid = extSuitProductInfo.Pid;
     orderProductInfo.PSN = extSuitProductInfo.PSN;
     orderProductInfo.CateId = extSuitProductInfo.CateId;
     orderProductInfo.BrandId = extSuitProductInfo.BrandId;
     orderProductInfo.StoreId = extSuitProductInfo.StoreId;
     orderProductInfo.StoreCid = extSuitProductInfo.StoreCid;
     orderProductInfo.StoreSTid = extSuitProductInfo.StoreSTid;
     orderProductInfo.Name = extSuitProductInfo.Name;
     orderProductInfo.DiscountPrice = extSuitProductInfo.ShopPrice;
     orderProductInfo.ShopPrice = extSuitProductInfo.ShopPrice;
     orderProductInfo.MarketPrice = extSuitProductInfo.MarketPrice;
     orderProductInfo.CostPrice = extSuitProductInfo.CostPrice;
     orderProductInfo.Weight = extSuitProductInfo.Weight;
     orderProductInfo.ShowImg = extSuitProductInfo.ShowImg;
     return orderProductInfo;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 获得扩展套装商品列表
        /// </summary>
        /// <param name="pmId">促销活动id</param>
        /// <returns></returns>
        public static List<ExtSuitProductInfo> GetExtSuitProductList(int pmId)
        {
            List<ExtSuitProductInfo> extSuitProductList = null;

            if (_promotionnosql != null)
            {
                extSuitProductList = _promotionnosql.GetSuitProductList(pmId);
                if (extSuitProductList == null)
                {
                    extSuitProductList = new List<ExtSuitProductInfo>();
                    foreach (ExtSuitProductInfo item in AdminGetExtSuitProductList(pmId))
                    {
                        ExtSuitProductInfo extSuitProductInfo = new ExtSuitProductInfo();
                        extSuitProductInfo.RecordId = item.RecordId;
                        extSuitProductInfo.PmId = item.PmId;
                        extSuitProductInfo.Discount = item.Discount;
                        extSuitProductInfo.Number = item.Number;
                        extSuitProductInfo.Pid = item.Pid;
                        extSuitProductList.Add(extSuitProductInfo);
                    }
                    _promotionnosql.CreateSuitProductList(pmId, extSuitProductList);
                }

                List<string> pidList = new List<string>();
                foreach (ExtSuitProductInfo extSuitProductInfo in extSuitProductList)
                {
                    pidList.Add(extSuitProductInfo.Pid.ToString());
                }
                List<PartProductInfo> partProductList = _productnosql.GetPartProductList(pidList);

                List<ExtSuitProductInfo> filterExtSuitProductList = new List<ExtSuitProductInfo>();
                foreach (ExtSuitProductInfo extSuitProductInfo in extSuitProductList)
                {
                    PartProductInfo partProductInfo = partProductList.Find(x => x.Pid == extSuitProductInfo.Pid);
                    if (partProductInfo != null)
                    {
                        extSuitProductInfo.PSN = partProductInfo.PSN;
                        extSuitProductInfo.CateId = partProductInfo.CateId;
                        extSuitProductInfo.BrandId = partProductInfo.BrandId;
                        extSuitProductInfo.StoreId = partProductInfo.StoreId;
                        extSuitProductInfo.StoreCid = partProductInfo.StoreCid;
                        extSuitProductInfo.StoreSTid = partProductInfo.StoreSTid;
                        extSuitProductInfo.SKUGid = partProductInfo.SKUGid;
                        extSuitProductInfo.Name = partProductInfo.Name;
                        extSuitProductInfo.ShopPrice = partProductInfo.ShopPrice;
                        extSuitProductInfo.MarketPrice = partProductInfo.MarketPrice;
                        extSuitProductInfo.CostPrice = partProductInfo.CostPrice;
                        extSuitProductInfo.State = partProductInfo.State;
                        extSuitProductInfo.IsBest = partProductInfo.IsBest;
                        extSuitProductInfo.IsHot = partProductInfo.IsHot;
                        extSuitProductInfo.IsNew = partProductInfo.IsNew;
                        extSuitProductInfo.DisplayOrder = partProductInfo.DisplayOrder;
                        extSuitProductInfo.Weight = partProductInfo.Weight;
                        extSuitProductInfo.ShowImg = partProductInfo.ShowImg;
                        filterExtSuitProductList.Add(extSuitProductInfo);
                    }
                }

                extSuitProductList = filterExtSuitProductList;
            }
            else
            {
                extSuitProductList = new List<ExtSuitProductInfo>();
                IDataReader reader = BrnMall.Core.BMAData.RDBS.GetExtSuitProductList(pmId);
                while (reader.Read())
                {
                    ExtSuitProductInfo extSuitProductInfo = BuildExtSuitProductFromReader(reader);
                    extSuitProductList.Add(extSuitProductInfo);
                }
                reader.Close();
            }

            return extSuitProductList;
        }