예제 #1
0
        public string GetRetailVipInfos(string pRequest)//	获取本月新增会员数量、累计会员数量、本月交易量接口(取该会员的订单数)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetRetailVipInfosRP> >();

            if (string.IsNullOrEmpty(rp.Parameters.RetailTraderID))
            {
                throw new APIException("缺少参数【RetailTraderID】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }



            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");
            var bll = new RetailTraderBLL(loggingSessionInfo);
            var rd  = new GetRetailVipInfosRD();
            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            int year  = DateTime.Now.Year;
            int month = DateTime.Now.Month;
            int day   = DateTime.Now.Day;
            //今日新增会员数量
            var ds = bll.GetRetailVipInfos(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, year, month, day);   //获取

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds.Tables[0];
                rd.DayVipCount = tempDt.Rows.Count;
            }
            //本月新增会员数量
            var ds2 = bll.GetRetailVipInfos(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, year, month, -1);   //获取

            if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds2.Tables[0];
                rd.MonthVipCount = tempDt.Rows.Count;
            }
            //累计会员数量
            var ds3 = bll.GetRetailVipInfos(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1);   //获取

            if (ds3 != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds3.Tables[0];
                rd.TotalVipCount = tempDt.Rows.Count;
            }
            return(rsp.ToJSON());
        }
예제 #2
0
        public string RetailTraderMain(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetRetailVipInfosRP> >();

            if (string.IsNullOrEmpty(rp.Parameters.RetailTraderID))
            {
                throw new APIException("缺少参数【RetailTraderID】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");
            var bll           = new RetailTraderBLL(loggingSessionInfo);
            var rd            = new RetailTraderMainRD();
            var rsp           = new SuccessResponse <IAPIResponseData>(rd);
            var CouponTypeBll = new CouponTypeBLL(loggingSessionInfo);
            //  BringVipCount//我为兰博士带多少会员
            //  RewardAmount//奖励多少钱
            //累计会员数量
            var ds3 = bll.GetRetailVipInfos(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1);   //获取

            if (ds3 != null && ds3.Tables.Count > 0 && ds3.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds3.Tables[0];
                rd.BringVipCount = tempDt.Rows.Count;
            }
            //累积奖励
            decimal TotalRewards = bll.RetailRewardByAmountSource(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1, "17")
                                   + bll.RetailRewardByAmountSource(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1, "14")
                                   + bll.RetailRewardByAmountSource(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, -1, -1, -1, "15");    //获取

            rd.RewardAmount = TotalRewards;

            int?pageIndex = 1;
            int?pageSize  = 10000;
            //未核销优惠券列表
            int NoWriteOffCouponCount = 0;
            var ds4 = bll.GetRetailCoupon(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, 0, pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType);   //获取

            if (ds4 != null && ds4.Tables.Count > 0 && ds4.Tables[0].Rows.Count > 0)
            {
                //var tempDt = ds4.Tables[0];
                NoWriteOffCouponCount = Convert.ToInt32(ds4.Tables[0].Rows[0]["TotalCount"].ToString());//tempDt.Rows.Count;
                //  rd.WriteOffCouponList = DataTableToObject.ConvertToList<RetailCouponInfo>(ds4.Tables[1]);
            }

            var ds5 = bll.GetRetailCoupon(rp.Parameters.RetailTraderID, loggingSessionInfo.ClientID, 1, pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType);   //获取

            if (ds5 != null && ds5.Tables.Count > 0 && ds5.Tables[0].Rows.Count > 0)
            {
                //var tempDt = ds5.Tables[0];
                rd.UsedCoupon = Convert.ToInt32(ds5.Tables[0].Rows[0]["TotalCount"].ToString());
                //  rd.WriteOffCouponList = DataTableToObject.ConvertToList<RetailCouponInfo>(ds3.Tables[1]);
            }


            //    rd.AllCouponCouponCount = rd.WriteOffCouponCount + rd.NoWriteOffCouponCount;


            rd.SendCouponCount = rd.UsedCoupon + NoWriteOffCouponCount;//	兰博士为我发券数量

            #region 获取适用所有门店的券
            var CouponTypeList = CouponTypeBll.QueryByEntity(new CouponTypeEntity()
            {
                SuitableForStore = 3, CustomerId = loggingSessionInfo.ClientID
            }, null).ToList();
            if (CouponTypeList.Count > 0)
            {
                foreach (var item in CouponTypeList)
                {
                    int Count = CouponTypeBll.GetCouponCount(item.CouponTypeID.ToString());
                    rd.SendCouponCount += Count;
                }
            }
            #endregion


            return(rsp.ToJSON());
        }