Exemplo n.º 1
0
        /// <summary>
        /// 兑换的生意专家和实物商品的比例
        /// </summary>
        /// <param name="stDate"></param>
        /// <param name="edDate"></param>
        /// <returns></returns>
        public List <IntPie> GetGoodsType(DateTime stDate, DateTime edDate)
        {
            List <IntPie> dic = new List <IntPie>();

            IntPie entity    = new IntPie("实物产品", 0);
            IntPie notEntity = new IntPie("生意专家产品", 0);



            IntegralStore.StoreProject storeModel = new IntegralStore.StoreProject();
            List <string> entityProduct           = new List <string>();

            for (int i = 1; i < 36; i++)
            {
                if (storeModel.GetModel(i) != null)
                {
                    if (storeModel.GetModel(i).isEntity == 1)
                    {
                        entityProduct.Add(storeModel.GetModel(i).ProjectName);
                    }
                }
            }

            List <IntPie> rawData = GetExRatio(stDate, edDate);

            if (rawData != null)
            {
                foreach (IntPie item in rawData)
                {
                    if (entityProduct.Contains(item.Name))
                    {
                        entity.Value += item.Value;
                    }
                    else
                    {
                        notEntity.Value += item.Value;
                    }
                }

                dic.Add(entity);
                dic.Add(notEntity);

                return(dic);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 生成新的积分商城统计信息
        /// </summary>
        /// <param name="dayDate"></param>
        /// <returns></returns>
        public IntegralExchangeModel GenerateNewDailyModel(DateTime dayDate)
        {
            StringBuilder strSql = new StringBuilder();

            IntegralExchangeModel exchangeModel = new IntegralExchangeModel();

            exchangeModel.DayTime = dayDate;

            IntegralStore.StoreProject storeModel = new IntegralStore.StoreProject();
            //Sys_DailyIntegralExchange updateModel = new Sys_DailyIntegralExchange();
            int productCount = 0;

            for (int i = 1; i < 36; i++)
            {
                strSql.Clear();
                Sys_DailyIntegralExchange updateModel = new Sys_DailyIntegralExchange();

                if (storeModel.GetModel(i) != null)
                {
                    updateModel.DayDate     = dayDate;
                    updateModel.ProductName = storeModel.GetModel(i).ProjectName;
                    strSql.Append(
                        "select count(*) from i200.dbo.T_ExchangeLog where DateDiff(day,eInsertTime,@dayDate)=0 and eProjectName=@productName;");

                    productCount = DapperHelper.ExecuteScalar <int>(strSql.ToString(), new
                    {
                        dayDate     = dayDate,
                        productName = updateModel.ProductName
                    });

                    updateModel.ExchangeNum = productCount;
                    updateModel.VisitNum    = 0;
                    updateModel.Ratio       = 0;
                    updateModel.ProductId   = i;

                    exchangeModel.DataList.Add(updateModel);
                }
            }

            return(exchangeModel);
        }