/// <summary>
        /// 获取产品信息
        /// </summary>
        public QueryProductsModel QueryProduct(int oid)
        {
            QueryProductsModel result = null;

            try
            {
                result = handler.QueryProduct(oid);
                if (result != null)
                {
                    var data = dbScopeManagerBI.Execute(conn => ProductLibraryConfigDAL.QueryProductSalesInfoByPID(conn, result.PID));
                    if (data != null)
                    {
                        result.cy_list_price = data.OfficialWebsitePrice;
                        result.cy_cost       = data.Cost;
                        result.Maoli         = data.OfficialWebsitePrice - data.Cost;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Log(Level.Error, ex.ToString());
                return(null);
            }
            return(result);
        }
Esempio n. 2
0
        public ProductSalesPredic QueryProductSalesInfoByPID(string pid)
        {
            Func <SqlConnection, ProductSalesPredic> action = (connection)
                                                              => ProductLibraryConfigDAL.QueryProductSalesInfoByPID(connection, pid);

            return(dbManager.Execute(action));
        }
 public Dictionary <string, ProductSalesPredic> RefreshProductSalespredictBIData()
 {
     try
     {
         var list = dbScopeManagerBI.Execute(
             conn => ProductLibraryConfigDAL.QueryProductSalesInfo(conn));
         var data      = list.GroupBy(x => x.PID).ToDictionary(k => k.Key, v => v.FirstOrDefault());
         int pageSize  = 1000;
         int pageTotal = (data.Count - 1) / pageSize + 1;
         //每次存进去1000条
         for (var pageIndex = 1; pageIndex <= pageTotal; pageIndex++)
         {
             var result = data.Skip((pageIndex - 1) * pageSize).Take(pageSize)
                          .ToDictionary(x => x.Key, x => (object)x.Value);
             using (var client = CacheHelper.CreateHashClient("ProductSalespredictBIData", TimeSpan.FromDays(1)))
             {
                 client.Set(result);
             }
         }
         return(data);
     }
     catch (Exception ex)
     {
         logger.Log(Level.Error, ex.ToString());
     }
     return(new Dictionary <string, ProductSalesPredic>());
 }
Esempio n. 4
0
        public bool UpdateProductCouponConfig(int oid, List <int> couponPkIds)
        {
            Func <SqlConnection, bool> action = (connection) =>
                                                ProductLibraryConfigDAL.UpdateProductCouponConfig(connection, oid, couponPkIds);

            return(dbManager.Execute(action));
        }
Esempio n. 5
0
        /// <summary>
        /// 根据oids获取产品优惠券配置
        /// oids ,号隔开
        /// </summary>
        public IEnumerable <ProductLibraryConfigModel> GetProductCouponConfigByOids(List <int> oids)
        {
            Func <SqlConnection, IEnumerable <ProductLibraryConfigModel> > action =
                (connection) => ProductLibraryConfigDAL.GetProductCouponConfigByOids(connection, oids);

            return(dbManager.Execute(action));
        }
Esempio n. 6
0
        public IEnumerable <QueryProductsModel> QueryProducts(List <int> oids)
        {
            Func <SqlConnection, IEnumerable <QueryProductsModel> > action = (connection) =>
                                                                             ProductLibraryConfigDAL.QueryProducts(connection, oids);

            return(dbManager.Execute(action));
        }
        /// <summary>
        /// 根据查询条件获取产品总行数
        /// </summary>
        /// <param name="sqlcon"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public int QueryProductsForProductLibraryCount(SeachProducts model)
        {
            Func <SqlConnection, int> action = (connection)
                                               => ProductLibraryConfigDAL.QueryProductsForProductLibraryCount(connection, model);

            return(dbManager.Execute(action));
        }
        /// <summary>
        /// 根据查询条件获取产品库优惠券数据列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public IEnumerable <QueryProductsModel> QueryProductsForProductLibrary(SeachProducts model)
        {
            Func <SqlConnection, IEnumerable <QueryProductsModel> > action = (connection)
                                                                             => ProductLibraryConfigDAL.QueryProductsForProductLibrary(connection, model);

            return(dbManager.Execute(action));
        }
 /// <summary>
 /// 获取 品牌,标签,尺寸
 /// </summary>
 public System.Data.DataSet GetFilterCondition(string category)
 {
     try
     {
         return(ProductLibraryConfigDAL.GetFilterCondition(category));
     }
     catch (Exception ex)
     {
         logger.Log(Level.Error, ex.ToString());
         return(null);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public IEnumerable <ProductLibraryConfigModel> GetList(string strWhere)
        {
            Func <SqlConnection, IEnumerable <ProductLibraryConfigModel> > action = (connection) => ProductLibraryConfigDAL.GetList(connection, strWhere);

            return(dbManager.Execute(action));
        }
Esempio n. 11
0
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool BatchDelete(string Idlist)
        {
            Func <SqlConnection, bool> action = (connection) => ProductLibraryConfigDAL.BatchDelete(connection, Idlist);

            return(dbManager.Execute(action));
        }
Esempio n. 12
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ProductLibraryConfigModel model)
        {
            Func <SqlConnection, bool> action = (connection) => ProductLibraryConfigDAL.Update(connection, model);

            return(dbManager.Execute(action));
        }
Esempio n. 13
0
        /// <summary>
        /// 批量修改或添加产品
        /// </summary>
        public MsgResultModel BatchDeleteCoupon(string oids, string coupon)
        {
            Func <SqlConnection, MsgResultModel> action = (connection) => ProductLibraryConfigDAL.BatchDeleteCoupon(connection, oids, coupon);

            return(dbManager.Execute(action));
        }
Esempio n. 14
0
        public List <string> GetPattern()
        {
            Func <SqlConnection, List <string> > action = (connection) => ProductLibraryConfigDAL.GetPattern(connection);

            return(dbManager.Execute(action));
        }
Esempio n. 15
0
        /// <summary>
        /// 获取产品信息
        /// </summary>
        public QueryProductsModel QueryProduct(int oid)
        {
            Func <SqlConnection, QueryProductsModel> action = (connection) => ProductLibraryConfigDAL.QueryProduct(connection, oid);

            return(dbManager.Execute(action));
        }