Пример #1
0
        public string GetFavorite(string pRequest)
        {
            var rd     = new APIResponse <GetFavoriteRD>();
            var rdData = new GetFavoriteRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <GetFavoriteRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                MLOnlineCourseBLL courseBll = new MLOnlineCourseBLL(loggingSessionInfo);
                DataTable         dTbl      = courseBll.GetFavoriteCourse(rp.UserID, rp.Parameters.PageIndex, rp.Parameters.PageSize);// courseBll.GetOnlineCourse(courseType, rp.Parameters.SortKey, rp.Parameters.SortOrientation, rp.Parameters.PageIndex, rp.Parameters.PageSize);
                if (dTbl != null)
                {
                    rdData.FavoriteList = DataTableToObject.ConvertToList <OnlineCourse>(dTbl);
                }
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
Пример #2
0
        public string SearchCourse(string pRequest)
        {
            var rd     = new APIResponse <SearchCourseRD>();
            var rdData = new SearchCourseRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <SearchCourseRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                MLOnlineCourseBLL courseBll = new MLOnlineCourseBLL(loggingSessionInfo);
                DataTable         dTbl      = courseBll.SearchOnlineCourse(rp.Parameters.Keyword, 0, 3000);
                if (dTbl != null)
                {
                    rdData.CourseList = DataTableToObject.ConvertToList <OnlineCourse>(dTbl);
                }
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
Пример #3
0
        private string GetMessageVipInfo()
        {
            GetMessageVipInfoRespData respData = new GetMessageVipInfoRespData();

            try
            {
                string requestData = Request["ReqContent"];
                if (!string.IsNullOrEmpty(requestData))
                {
                    Loggers.DEFAULT.Debug(new DebugLogInfo
                    {
                        Message = "获取已发送客服信息的会员:" + requestData
                    });
                    var reqObj             = requestData.DeserializeJSONTo <RecevieMessageNewReqData>();
                    var loggingSessionInfo = Default.GetBSLoggingSession(reqObj.common.customerId, "1");
                    CSConversationBLL bll  = new CSConversationBLL(loggingSessionInfo);
                    DataSet           ds   = bll.GetMessageVipInfo(reqObj.common.userId
                                                                   , reqObj.common.customerId
                                                                   );
                    List <CSConversationEntity> ls = new List <CSConversationEntity>();
                    if (ds != null && ds.Tables != null && ds.Tables.Count != 0)
                    {
                        ls = DataTableToObject.ConvertToList <CSConversationEntity>(ds.Tables[0]);
                    }
                    respData.content = new GetMessageVipInfoRespContentData();
                    respData.content.conversations = ls;
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "操作失败:" + ex.Message;
                respData.exception   = ex.Message;
            }
            return(respData.ToJSON());
        }
Пример #4
0
        public string GetSurveyTestList(string pRequest)
        {
            var rd     = new APIResponse <GetSurveyTestListRD>();
            var rdData = new GetSurveyTestListRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <GetSurveyTestListRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                QuestionnaireBLL quesBll = new QuestionnaireBLL(loggingSessionInfo);
                DataTable        dTbl    = quesBll.GetQuestionnaire(rp.Parameters.Type.ToString(), rp.Parameters.PageIndex, rp.Parameters.PageSize);
                if (dTbl != null)
                {
                    rdData.SurveyTestList = DataTableToObject.ConvertToList <SurveyTestItem>(dTbl);
                }
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
Пример #5
0
        public string GetUserDict(string pRequest)
        {
            var rd     = new APIResponse <GetUserDictRD>();
            var rdData = new GetUserDictRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <GetUserDictRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = new LoggingSessionManager().CurrentSession;

            try
            {
                T_UserBLL userBll = new T_UserBLL(loggingSessionInfo);
                DataTable dTable  = userBll.GetStaffDict(rp.Parameters.UserID, rp.Parameters.UserName.Trim());
                if (dTable != null)
                {
                    rdData.UserList = DataTableToObject.ConvertToList <UserDict>(dTable);
                }
                rd.Data       = rdData;
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            return(rd.ToJSON());
        }
        public string GetOnlineCourseCommentList(string pRequest)
        {
            var rd     = new APIResponse <GetOnlineCourseCommentListRD>();
            var rdData = new GetOnlineCourseCommentListRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <GetOnlineCourseCommentListRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                ItemCommentBLL commentBll = new ItemCommentBLL(loggingSessionInfo);
                DataTable      dTbl       = commentBll.GetCourseComment(rp.Parameters.OnlineCourseID, rp.Parameters.PageIndex, rp.Parameters.PageSize);
                if (dTbl != null)
                {
                    rdData.CommentList = DataTableToObject.ConvertToList <CommentItem>(dTbl);
                }
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
Пример #7
0
        protected override GetOverViewRD ProcessRequest(DTO.Base.APIRequest <EmptyRequestParameter> pRequest)

        {
            var rd = new GetOverViewRD();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            //超级分销体系配置表 为判断是否存在分销体系使用
            var T_SuperRetailTraderConfigbll = new T_SuperRetailTraderConfigBLL(loggingSessionInfo);
            var R_SRT_Homebll = new R_SRT_HomeBLL(loggingSessionInfo);
            //获取分销体系信息
            var T_SuperRetailTraderConfigInfo = T_SuperRetailTraderConfigbll.QueryByEntity(new T_SuperRetailTraderConfigEntity()
            {
                IsDelete = 0, CustomerId = loggingSessionInfo.CurrentUser.customer_id
            }, null).FirstOrDefault();

            if (T_SuperRetailTraderConfigInfo != null)
            {
                rd.IsDataNull = 1;
            }
            else
            {
                rd.IsDataNull = 0; return(rd);
            }
            //获取七天最新店员、会员相关数据
            var SevenDaysInfo = R_SRT_Homebll.GetSevenDaySalesAndPersonCount();

            if (SevenDaysInfo != null && SevenDaysInfo.Tables[0].Rows.Count > 0)
            {
                rd.DaySevenRTSalesList = DataTableToObject.ConvertToList <Day7RTSalesInfo>(SevenDaysInfo.Tables[0]);
                rd.DaySevenRTCountList = DataTableToObject.ConvertToList <Day7RTCountInfo>(SevenDaysInfo.Tables[0]);
            }
            //按统计日获取最新一条概览信息
            var R_SRT_HomeInfo = R_SRT_Homebll.QueryByEntity(new R_SRT_HomeEntity()
            {
                CustomerId = loggingSessionInfo.CurrentUser.customer_id
            }, new OrderBy[] { new OrderBy()
                               {
                                   FieldName = "CreateTime", Direction = OrderByDirections.Desc
                               } }).FirstOrDefault();

            if (R_SRT_HomeInfo != null)
            {
                //总销量、近七天新增销售额
                var RTTotalSalesInfo = new RTSalesInfo();
                RTTotalSalesInfo.RTTotalSalesAmount   = R_SRT_HomeInfo.RTTotalSalesAmount;
                RTTotalSalesInfo.RTDay7AddSalesAmount = R_SRT_HomeInfo.RTDay7SalesAmount;
                rd.RTTotalSales = RTTotalSalesInfo;
                //分销商总数、近七天新增分销商总数
                var RTTotalCountInfo = new RTCountInfo();
                RTTotalCountInfo.RTTotalCount   = R_SRT_HomeInfo.RTTotalCount;
                RTTotalCountInfo.Day7AddRTCount = R_SRT_HomeInfo.Day7AddRTCount;
                rd.RTTotalCount = RTTotalCountInfo;
                //近7日分销商订单信息
                var DaySevenRTOrderInfo = new DaysRTOrderInfo();
                DaySevenRTOrderInfo.DaysRTOrderCount     = R_SRT_HomeInfo.Day7RTOrderCount;
                DaySevenRTOrderInfo.DaysRTOrderCountRate = R_SRT_HomeInfo.Day7RTOrderCountW2W;
                DaySevenRTOrderInfo.DaysTRTAvgAmount     = R_SRT_HomeInfo.Day7RTAC;
                DaySevenRTOrderInfo.DaysTRTAvgAmountRate = R_SRT_HomeInfo.Day7RTACW2W;
                rd.DaySevenRTOrder = DaySevenRTOrderInfo;
                //近30日分销商订单信息
                var DayThirtyRTOrderInfo = new DaysRTOrderInfo();
                DayThirtyRTOrderInfo.DaysRTOrderCount     = R_SRT_HomeInfo.Day30RTOrderCount;
                DayThirtyRTOrderInfo.DaysRTOrderCountRate = R_SRT_HomeInfo.Day30RTOrderCountM2M;
                DayThirtyRTOrderInfo.DaysTRTAvgAmount     = R_SRT_HomeInfo.Day30RTAC;
                DayThirtyRTOrderInfo.DaysTRTAvgAmountRate = R_SRT_HomeInfo.Day30RTACM2M;
                rd.DayThirtyRTOrder = DayThirtyRTOrderInfo;
                //近7日活跃分销商
                var DaySevenActivityRTInfo = new DaysActivityRTInfo();
                DaySevenActivityRTInfo.DaysActiveRTCount    = R_SRT_HomeInfo.Day7ActiveRTCount;
                DaySevenActivityRTInfo.DaysRTOrderCountRate = R_SRT_HomeInfo.Day7ActiveRTCountW2W;
                rd.DaySevenActivityRT = DaySevenActivityRTInfo;
                //近30日活跃分销商信息
                var DayThirtyActivityRTInfo = new DaysActivityRTInfo();
                DayThirtyActivityRTInfo.DaysActiveRTCount    = R_SRT_HomeInfo.Day30ActiveRTCount;
                DayThirtyActivityRTInfo.DaysRTOrderCountRate = R_SRT_HomeInfo.Day30ActiveRTCountM2M;
                rd.DayThirtyActivityRT = DayThirtyActivityRTInfo;
                //近7日分享数据信息
                var DaySevenRTShareInfo = new DaysRTShareInfo();
                DaySevenRTShareInfo.DaysRTShareCount     = R_SRT_HomeInfo.Day7RTShareCount;
                DaySevenRTShareInfo.DaysRTShareCountRate = R_SRT_HomeInfo.Day7RTShareCountW2W;
                DaySevenRTShareInfo.DaysAddRTCount       = R_SRT_HomeInfo.Day7AddRTCount;
                DaySevenRTShareInfo.DaysAddRTCountRate   = R_SRT_HomeInfo.Day7AddRTCountW2W;
                rd.DaySevenRTShare = DaySevenRTShareInfo;
                //近30日分享数据信息
                var DayThirtyRTShareInfo = new DaysRTShareInfo();
                DayThirtyRTShareInfo.DaysRTShareCount     = R_SRT_HomeInfo.Day30RTShareCount;
                DayThirtyRTShareInfo.DaysRTShareCountRate = R_SRT_HomeInfo.Day30RTShareCountM2M;
                DayThirtyRTShareInfo.DaysAddRTCount       = R_SRT_HomeInfo.Day30AddRTCount;
                DayThirtyRTShareInfo.DaysAddRTCountRate   = R_SRT_HomeInfo.Day30AddRTCountM2M;
                rd.DayThirtyRTShare = DayThirtyRTShareInfo;
                rd.IsRTSalesOrder   = 1;
            }
            else
            {
                rd.IsRTSalesOrder = 0;
            }
            return(rd);
        }
Пример #8
0
        protected override GetEventPrizesRD ProcessRequest(DTO.Base.APIRequest <GetEventPrizesRP> pRequest)
        {
            GetEventPrizesRD rd = new GetEventPrizesRD();

            string vipID = pRequest.UserID;

            //string vipID = "f3d925e364e34bf69dfda34fcedc58f8";
            string vipName           = string.Empty;
            string reCommandId       = pRequest.Parameters.RecommandId;
            string eventId           = pRequest.Parameters.EventId;
            float  longitude         = pRequest.Parameters.Longitude;
            float  latitude          = pRequest.Parameters.Latitude;
            string customerId        = this.CurrentUserInfo.ClientID;
            int    pointsLotteryFlag = pRequest.Parameters.PointsLotteryFlag;

            if (string.IsNullOrEmpty(customerId))
            {
                customerId = "f6a7da3d28f74f2abedfc3ea0cf65c01";
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

            #region 是否在活动现场
            //respData.content.isSite = "1";
            rd.content = new EventPrizesInfo {
                IsSite = 1
            };

            #endregion

            #region 判断活动是否需要注册

            var leventsBll = new LEventsBLL(this.CurrentUserInfo);

            var enableFlag = leventsBll.GetEnableFlagByEventId(eventId);

            var vipService = new VipBLL(loggingSessionInfo);
            rd.SignFlag = 1;
            //如果需要注册,则判断该会员有没有注册,没有返回
            if (enableFlag.Substring(0, 1) == "1")
            {
                var vipEntity = vipService.GetByID(vipID);
                if (vipEntity == null)
                {
                    rd.SignFlag = 0;
                    return(rd);
                }
                else
                {
                    rd.SignFlag = 1;
                    vipID       = vipEntity.VIPID;
                    vipName     = vipEntity.VipName;
                }
            }



            #endregion

            #region 获取VIPID

            #endregion



            #region

            Loggers.Debug(new DebugLogInfo()
            {
                Message = "vipName = " + vipName
                          + ",vipID =" + vipID
                          + ",eventId=" + eventId
                          + ",longitude" + longitude
                          + ",latitude" + latitude
                          + ",customerId" + customerId
                          + ",reCommandId" + reCommandId
            });
            LPrizePoolsBLL poolsServer = new LPrizePoolsBLL(loggingSessionInfo);
            var            ds          = poolsServer.GetEventWinningInfo(vipName, vipID, eventId, longitude, latitude, customerId, reCommandId, pointsLotteryFlag);

            int    isLottery  = Convert.ToInt32(ds.Tables[0].Rows[0]["IsLottery"]);
            int    winnerFlag = Convert.ToInt32(ds.Tables[0].Rows[0]["WinnerFlag"]);//是否中奖
            string prizeName  = ds.Tables[0].Rows[0]["prizeName"].ToString();
            string prizesId   = ds.Tables[0].Rows[0]["prizesId"].ToString();


            rd.content.IsLottery      = isLottery;
            rd.content.IsWinning      = winnerFlag;
            rd.content.WinningDesc    = prizeName;
            rd.content.Remark         = ds.Tables[0].Rows[0]["Remark"].ToString();
            rd.content.WinningExplan  = ds.Tables[0].Rows[0]["PrizeDesc"].ToString();
            rd.content.EventRound     = ds.Tables[0].Rows[0]["EventRoundId"].ToString();
            rd.content.Status         = Convert.ToInt32(ds.Tables[0].Rows[0]["step"].ToString());
            rd.content.PrizesTypeName = ds.Tables[0].Rows[0]["prizeTypeName"].ToString();
            rd.content.PrizesName     = ds.Tables[0].Rows[0]["prizesName"].ToString();
            rd.content.EventPoints    = Convert.ToInt32(ds.Tables[0].Rows[0]["EventPoints"].ToString());

            #region update by wzq 2014/07/01 积分兑换标识(活动,个人)
            rd.content.PersonPointsLotteryFlag = Convert.ToInt32(ds.Tables[0].Rows[0]["PersonPointsLotteryFlag"].ToString());
            rd.content.EventPointsLotteryFlag  = Convert.ToInt32(ds.Tables[0].Rows[0]["EventPointsLotteryFlag"].ToString());
            #endregion

            #endregion


            #region 推荐人
            //活动是否分享


            var isShare = leventsBll.GetIsShareByEventId(eventId);

            rd.IsShare = isShare;
            Loggers.Debug(new DebugLogInfo()
            {
                Message = "isShare = " + isShare
            });

            CouponBLL couponService = new CouponBLL(loggingSessionInfo);

            //Updated by Willie Yan on 2014-05-30   必须是新推荐的会员
            if (isShare == 1 && !couponService.IfRecordedRecommendTrace(vipID, reCommandId))
            {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = "reCommandId = " + reCommandId + ", VipID = " + vipID
                });
                if (reCommandId != "" && !string.IsNullOrEmpty(reCommandId))
                {
                    if (reCommandId != vipID)
                    {
                        var vipEntity = vipService.GetByID(vipID);
                        vipEntity.HigherVipID = reCommandId;
                        vipService.Update(vipEntity);

                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "Update HigherVipID = " + reCommandId + "for vipid=" + vipID
                        });

                        //查看推荐人成功推荐人数,满足条件给奖励

                        //TODO:added by zhangwei20141009,保存上下线记录
                        couponService.UpdateVipRecommandTrace(vipID, reCommandId);
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "UpdateVipRecommandTrace vipid=" + vipID + ",reCommandId= " + reCommandId
                        });

                        couponService.RecommenderPrize(reCommandId, eventId);
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = "RecommenderPrize reCommandId= " + reCommandId
                        });
                    }
                }
            }

            //推荐人是否为空

            //推荐人跟vipId是否相同
            #endregion

            #region 奖品集合

            LPrizesBLL prizesService = new LPrizesBLL(loggingSessionInfo);

            var orderby = new List <OrderBy> {
                new OrderBy()
                {
                    FieldName = "DisplayIndex", Direction = OrderByDirections.Asc
                }
            };


            var prizesList = prizesService.QueryByEntity(new LPrizesEntity()
            {
                EventId = eventId
            }, orderby.ToArray());

            rd.content.PrizesList = new List <PrizesEntity>();
            if (prizesList != null && prizesList.Length > 0)
            {
                foreach (var item in prizesList)
                {
                    var entity = new PrizesEntity()
                    {
                        PrizesID     = item.PrizesID,
                        PrizeName    = item.PrizeName,
                        PrizeDesc    = item.PrizeDesc,
                        DisplayIndex = item.DisplayIndex.ToString(),
                        CountTotal   = item.CountTotal.ToString(),
                        ImageUrl     = item.ImageUrl,
                        Sponsor      = item.ContentText
                    };

                    if (prizesId == item.PrizesID)
                    {
                        rd.content.PrizeIndex = item.DisplayIndex;
                    }
                    rd.content.PrizesList.Add(entity);
                }
            }

            #endregion


            #region 中奖集合
            var winDs = poolsServer.GetPersonWinnerList(vipID, eventId);
            rd.content.WinnerList = new List <WinnerList>();
            if (winDs != null && winDs.Tables.Count > 0 && winDs.Tables[0].Rows.Count > 0)
            {
                rd.content.WinnerList = DataTableToObject.ConvertToList <WinnerList>(winDs.Tables[0]);
            }

            #endregion


            #region  新增字段



            var leventsInfoDs = leventsBll.GetLeventsInfoDataSet(eventId);

            if (leventsInfoDs.Tables[0].Rows.Count > 0)
            {
                rd.BootUrl        = leventsInfoDs.Tables[0].Rows[0]["BootUrl"].ToString();
                rd.OverRemark     = leventsInfoDs.Tables[0].Rows[0]["OverRemark"].ToString();
                rd.PosterImageUrl = leventsInfoDs.Tables[0].Rows[0]["PosterImageUrl"].ToString();
                rd.ShareRemark    = leventsInfoDs.Tables[0].Rows[0]["ShareRemark"].ToString();
                rd.ShareLogoUrl   = leventsInfoDs.Tables[0].Rows[0]["ShareLogoUrl"].ToString();
            }

            #endregion

            #region 添加引导页URL

            //var bootDs = leventsBll.GetBootUrlByEventId(eventId);

            //if (bootDs.Tables[0].Rows.Count > 0)
            //{
            //    rd.ShareRemark = bootDs.Tables[0].Rows[0]["ShareRemark"].ToString();
            //    rd.OverRemark = bootDs.Tables[0].Rows[0]["OverRemark"].ToString();
            //    rd.PosterImageUrl = bootDs.Tables[0].Rows[0]["PosterImageUrl"].ToString();
            //    rd.BootUrl = bootDs.Tables[0].Rows[0]["BootUrl"].ToString();
            //}

            #endregion
            return(rd);
        }
        public string GetOnlineCourseDetail(string pRequest)
        {
            var rd     = new APIResponse <GetOnlineCourseDetailRD>();
            var rdData = new GetOnlineCourseDetailRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <GetOnlineCourseDetailRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                MLOnlineCourseBLL courseBll = new MLOnlineCourseBLL(loggingSessionInfo);

                //课程信息
                DataTable    dTbl   = courseBll.SearchOnlineCourseDetail(rp.Parameters.OnlineCourseID);
                OnlineCourse entity = null;
                if (dTbl != null && dTbl.Rows.Count > 0)
                {
                    entity = DataTableToObject.ConvertToObject <OnlineCourse>(dTbl.Rows[0]);
                }

                //课程附件列表
                List <CourseWare> list     = new List <CourseWare>();
                MLCourseWareBLL   wareBll  = new MLCourseWareBLL(loggingSessionInfo);
                DataTable         dTblWare = wareBll.GetCourseWare(rp.Parameters.OnlineCourseID);
                if (dTblWare != null && dTblWare.Rows.Count > 0)
                {
                    list = DataTableToObject.ConvertToList <CourseWare>(dTblWare);
                }

                //构建CourseDetail对象
                CourseDetail detail = new CourseDetail
                {
                    OnlineCourse   = entity,
                    CourseWareList = list
                };
                rdData.CourseDetail = detail;

                //添加访问次数
                try
                {
                    MLOnlineCourseEntity courseEntity = courseBll.GetByID(rp.Parameters.OnlineCourseID);
                    if (courseEntity != null)
                    {
                        courseEntity.AccessCount++;
                        courseBll.Update(courseEntity);
                    }
                }
                catch (Exception ex)
                { }
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
Пример #10
0
        protected override SetContactEventRD ProcessRequest(DTO.Base.APIRequest <SetContactEventRP> pRequest)
        {
            var rd = new SetContactEventRD();

            var    para = pRequest.Parameters;
            var    loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var    bllContactEvent    = new ContactEventBLL(loggingSessionInfo);
            var    bllEvent           = new LEventsBLL(loggingSessionInfo);
            var    bllPrizes          = new LPrizesBLL(loggingSessionInfo);
            string strErrMsg          = string.Empty;

            try
            {
                string[] CouponTypeIdList = para.CouponTypeID;

                if (para.ContactEventId != null && para.ContactEventId != "")
                {
                    var contactEvent = bllContactEvent.GetByID(para.ContactEventId);
                    //if (contactEvent.Status == 2 || contactEvent.Status==3)//状态为运行时只可追加数量
                    if (para.Method == "Append")
                    {
                        contactEvent.PrizeCount = (contactEvent.PrizeCount == null ? 0 : contactEvent.PrizeCount) + para.PrizeCount;
                        LPrizesBLL bllPrize    = new LPrizesBLL(loggingSessionInfo);
                        var        entityPrize = bllPrize.QueryByEntity(new LPrizesEntity()
                        {
                            EventId = para.ContactEventId, IsDelete = 0
                        }, null).FirstOrDefault();
                        var CouponTypeTemp = bllContactEvent.QueryByEntity(new ContactEventEntity()
                        {
                            ContactEventId = new Guid(para.ContactEventId), IsDelete = 0
                        }, null).SingleOrDefault().CouponTypeID;
                        if (CouponTypeTemp != null)
                        {
                            CouponTypeIdList = CouponTypeTemp.Split(',');
                            if (CouponTypeIdList != null && CouponTypeIdList.Count() > 0)
                            {
                                var bllCoupon = new CouponBLL(loggingSessionInfo);

                                foreach (var cou in CouponTypeIdList)
                                {
                                    //优惠券未被使用了的数量
                                    int     intHaveCout = (int)entityPrize.CountTotal;
                                    DataSet ds          = bllCoupon.GetCouponCountByCouponTypeID(cou);
                                    if (ds != null & ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                    {
                                        int intUnUsedCouponCount = Convert.ToInt32(ds.Tables[0].Rows[0]["RemainCount"].ToString());
                                        if ((para.PrizeCount + intHaveCout) > intUnUsedCouponCount)
                                        {
                                            strErrMsg += ds.Tables[0].Rows[0]["CouponTypeName"].ToString() + "奖品总数量超过未使用优惠券数量,未使用量:" + intUnUsedCouponCount.ToString() + "<br/>";
                                        }
                                    }
                                }
                                if (!string.IsNullOrEmpty(strErrMsg) && strErrMsg.Length > 0)
                                {
                                    throw new APIException(strErrMsg)
                                          {
                                              ErrorCode = 342
                                          };
                                }
                            }
                        }

                        entityPrize.CountTotal   = para.PrizeCount;
                        entityPrize.LastUpdateBy = loggingSessionInfo.UserID;
                        bllPrize.AppendPrize(entityPrize);

                        //入奖品池队列
                        LPrizePoolsBLL bllPools = new LPrizePoolsBLL(loggingSessionInfo);
                        DataSet        dsPools  = bllPools.GetPrizePoolsByEvent(loggingSessionInfo.ClientID, para.ContactEventId);
                        if (dsPools != null && dsPools.Tables.Count > 0 && dsPools.Tables[0].Rows.Count > 0)
                        {
                            var poolsList = DataTableToObject.ConvertToList <CC_PrizePool>(dsPools.Tables[0]);
                            if (poolsList != null && poolsList.Count > 0)
                            {
                                var          redisPrizePoolsBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.PrizePools.RedisPrizePoolsBLL();
                                CC_PrizePool prizePool          = new CC_PrizePool();
                                prizePool.CustomerId = loggingSessionInfo.ClientID;
                                prizePool.EventId    = para.ContactEventId;

                                redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
                                redisPrizePoolsBLL.SetPrizePoolsToRedis(poolsList);
                            }
                        }
                    }
                    else
                    {
                        if (para.PrizeType == "Point")
                        {
                            contactEvent.Integral = para.Integral;
                        }
                        if (para.PrizeType == "Coupon")
                        {
                            contactEvent.CouponTypeID = string.Join(",", para.CouponTypeID);
                            var bllCoupon = new CouponBLL(loggingSessionInfo);
                            if (CouponTypeIdList != null && CouponTypeIdList.Count() > 0)
                            {
                                foreach (var cou in CouponTypeIdList)
                                {
                                    //优惠券未被使用了的数量
                                    DataSet ds = bllCoupon.GetCouponCountByCouponTypeID(cou);
                                    if (ds != null & ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                    {
                                        int intUnUsedCouponCount = Convert.ToInt32(ds.Tables[0].Rows[0]["RemainCount"].ToString());
                                        if (para.PrizeCount > intUnUsedCouponCount)
                                        {
                                            strErrMsg += ds.Tables[0].Rows[0]["CouponTypeName"].ToString() + "奖品总数量超过未使用优惠券数量,未使用量:" + intUnUsedCouponCount.ToString() + "<br/>";
                                        }
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(strErrMsg) && strErrMsg.Length > 0)
                            {
                                throw new APIException(strErrMsg)
                                      {
                                          ErrorCode = 342
                                      };
                            }
                        }
                        if (para.PrizeType == "Chance")
                        {
                            contactEvent.EventId     = para.EventId;
                            contactEvent.ChanceCount = para.ChanceCount;
                        }

                        contactEvent.PrizeCount       = para.PrizeCount;
                        contactEvent.ContactTypeCode  = para.ContactTypeCode;
                        contactEvent.ContactEventName = para.ContactEventName;
                        contactEvent.BeginDate        = para.BeginDate;
                        contactEvent.EndDate          = para.EndDate;
                        contactEvent.PrizeType        = para.PrizeType;
                        contactEvent.CustomerID       = CurrentUserInfo.ClientID;
                        contactEvent.RewardNumber     = para.RewardNumber;
                        contactEvent.ShareEventId     = para.ShareEventId;
                        contactEvent.UnLimited        = para.UnLimited;
                        contactEvent.IsCTW            = 0;

                        if (para.ContactTypeCode == "Share" && para.ShareEventId != null && para.ShareEventId != "")
                        {
                            bllEvent.UpdateEventIsShare(para.ShareEventId);
                        }
                        //开始日期是当天的 状态直接变为运行中
                        if (DateTime.Compare(Convert.ToDateTime(para.BeginDate), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) <= 0 && DateTime.Compare(Convert.ToDateTime(para.EndDate), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) >= 0)
                        {
                            contactEvent.Status = 2;
                        }
                    }


                    bllContactEvent.Update(contactEvent);
                    rd.ContactEventId = para.ContactEventId.ToString();
                    rd.ErrMsg         = "操作成功";
                    rd.Success        = true;
                }
                else
                {
                    ContactEventEntity entityContactEvent = new ContactEventEntity();


                    //RewardType:Point,Coupon,Chance
                    if (para.PrizeType == "Point")
                    {
                        entityContactEvent.Integral = para.Integral;
                    }
                    if (para.PrizeType == "Coupon")
                    {
                        entityContactEvent.CouponTypeID = string.Join(",", para.CouponTypeID);;

                        var bllCoupon = new CouponBLL(loggingSessionInfo);
                        if (CouponTypeIdList != null && CouponTypeIdList.Count() > 0)
                        {
                            foreach (var cou in CouponTypeIdList)
                            {
                                //优惠券未被使用了的数量

                                DataSet ds = bllCoupon.GetCouponCountByCouponTypeID(cou);
                                if (ds != null & ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                {
                                    int intUnUsedCouponCount = Convert.ToInt32(ds.Tables[0].Rows[0]["RemainCount"].ToString());
                                    if (para.PrizeCount > intUnUsedCouponCount)
                                    {
                                        strErrMsg += ds.Tables[0].Rows[0]["CouponTypeName"].ToString() + "奖品总数量超过未使用优惠券数量,未使用量:" + intUnUsedCouponCount.ToString() + "<br/>";
                                    }
                                }
                            }
                        }
                        if (!string.IsNullOrEmpty(strErrMsg) && strErrMsg.Length > 0)
                        {
                            throw new APIException(strErrMsg)
                                  {
                                      ErrorCode = 342
                                  };
                        }
                    }
                    if (para.PrizeType == "Chance")
                    {
                        entityContactEvent.EventId     = para.EventId;
                        entityContactEvent.ChanceCount = para.ChanceCount;
                    }

                    if (bllContactEvent.ExistsContact(para.ContactTypeCode, string.IsNullOrEmpty(para.ShareEventId) == true ? "" : para.ShareEventId) > 0)
                    {
                        if (para.ContactTypeCode == "Share" && para.ShareEventId != null && para.ShareEventId.Length > 0)
                        {
                            rd.ErrMsg = "该分享活动已存在";
                        }
                        else
                        {
                            rd.ErrMsg = "该触点活动类型已存在";
                        }
                        rd.Success = false;
                        return(rd);
                    }

                    if (para.ShareEventId != null && para.ShareEventId.Length > 0)
                    {
                        //判断触点中的分享设置的开始时间和结束时间是否在被分享的活动时间范围内
                        var entityEvent = bllEvent.GetByID(para.ShareEventId);
                        if (DateTime.Compare(Convert.ToDateTime(para.BeginDate), Convert.ToDateTime(entityEvent.BeginTime)) < 0 || DateTime.Compare(Convert.ToDateTime(para.EndDate), Convert.ToDateTime(entityEvent.EndTime)) > 0)
                        {
                            rd.Success = false;

                            rd.ErrMsg = "活动的时间不在被分享的活动时间范围内";
                            return(rd);
                        }
                        entityContactEvent.ShareEventId = para.ShareEventId;
                        entityEvent.IsShare             = 1;
                        bllEvent.Update(entityEvent, false);
                    }


                    entityContactEvent.PrizeCount       = para.PrizeCount;
                    entityContactEvent.ContactTypeCode  = para.ContactTypeCode;
                    entityContactEvent.ContactEventName = para.ContactEventName;
                    entityContactEvent.BeginDate        = para.BeginDate;
                    entityContactEvent.EndDate          = para.EndDate;
                    entityContactEvent.PrizeType        = para.PrizeType;
                    entityContactEvent.CustomerID       = CurrentUserInfo.ClientID;
                    entityContactEvent.RewardNumber     = para.RewardNumber;
                    entityContactEvent.UnLimited        = para.UnLimited;
                    entityContactEvent.IsCTW            = 0;
                    //开始日期是当天的 状态直接变为运行中
                    if (DateTime.Compare(Convert.ToDateTime(para.BeginDate), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) <= 0 && DateTime.Compare(Convert.ToDateTime(para.EndDate), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) >= 0)
                    {
                        entityContactEvent.Status = 2;
                    }
                    else
                    {
                        entityContactEvent.Status = 1;
                    }
                    bllContactEvent.Create(entityContactEvent);

                    ///保存奖品 生成奖品池
                    var entityPrize = new LPrizesEntity();
                    entityPrize.EventId      = entityContactEvent.ContactEventId.ToString();
                    entityPrize.PrizeName    = para.ContactEventName;
                    entityPrize.PrizeTypeId  = para.PrizeType;
                    entityPrize.Point        = para.Integral;
                    entityPrize.CouponTypeID = string.Join(",", para.CouponTypeID);;
                    entityPrize.CountTotal   = para.PrizeCount;
                    entityPrize.CreateBy     = loggingSessionInfo.UserID;

                    bllContactEvent.DeleteContactPrize(entityContactEvent.ContactEventId.ToString());
                    bllContactEvent.AddContactEventPrize(entityPrize);

                    //入奖品池队列
                    LPrizePoolsBLL bllPools = new LPrizePoolsBLL(loggingSessionInfo);
                    DataSet        dsPools  = bllPools.GetPrizePoolsByEvent(loggingSessionInfo.ClientID, entityContactEvent.ContactEventId.ToString());
                    if (dsPools != null && dsPools.Tables.Count > 0 && dsPools.Tables[0].Rows.Count > 0)
                    {
                        var poolsList = DataTableToObject.ConvertToList <CC_PrizePool>(dsPools.Tables[0]);
                        if (poolsList != null && poolsList.Count > 0)
                        {
                            var          redisPrizePoolsBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.PrizePools.RedisPrizePoolsBLL();
                            CC_PrizePool prizePool          = new CC_PrizePool();
                            prizePool.CustomerId = loggingSessionInfo.ClientID;
                            prizePool.EventId    = entityContactEvent.ContactEventId.ToString();

                            redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
                            redisPrizePoolsBLL.SetPrizePoolsToRedis(poolsList);
                        }
                    }

                    rd.ContactEventId = entityContactEvent.ContactEventId.ToString();
                    rd.ErrMsg         = "操作成功";
                    rd.Success        = true;
                }
            }
            catch (APIException apiEx)
            {
                rd.Success = false;
                rd.ErrMsg  = apiEx.Message;
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }

            return(rd);
        }
Пример #11
0
        protected override SetRechargeOrderRD ProcessRequest(APIRequest <SetRechargeOrderRP> pRequest)
        {
            SetRechargeOrderRP rp = pRequest.Parameters;
            SetRechargeOrderRD rd = new SetRechargeOrderRD();

            var            rechargeOrderBll     = new RechargeOrderBLL(CurrentUserInfo);
            TUnitExpandBLL serviceUnitExpandBll = new TUnitExpandBLL(CurrentUserInfo);

            var vipBll = new VipBLL(CurrentUserInfo);
            var vipCardVipMappingBll  = new VipCardVipMappingBLL(CurrentUserInfo);
            var vipCardBll            = new VipCardBLL(CurrentUserInfo);
            var sysVipCardTypeBll     = new SysVipCardTypeBLL(CurrentUserInfo);
            var vipCardUpgradeRuleBll = new VipCardUpgradeRuleBLL(CurrentUserInfo);

            //获取会员信息
            VipEntity vipInfo;
            string    userId = "";

            //微信
            if (pRequest.ChannelId == "2")
            {
                vipInfo = vipBll.GetByID(pRequest.UserID);
                UnitService unitServer = new UnitService(CurrentUserInfo);
                rp.UnitId = unitServer.GetUnitByUnitTypeForWX("OnlineShopping", null).Id; //获取在线商城的门店标识
            }
            //掌柜App
            else
            {
                vipInfo = vipBll.GetByID(rp.VipId);
                userId  = pRequest.UserID;
            }

            string  OrderDesc     = "ReRecharge"; //"升级","充值"
            int?    VipCardTypeId = null;         //会员卡类型
            decimal returnAmount  = 0;            //赠送金额

            //会员卡类型条件
            List <IWhereCondition> complexConditionOne = new List <IWhereCondition> {
            };
            //获取会员与会员卡关系表
            var vipCardVipMappingEntity = vipCardVipMappingBll.QueryByEntity(new VipCardVipMappingEntity()
            {
                CustomerID = CurrentUserInfo.ClientID, VIPID = vipInfo.VIPID
            }, null).FirstOrDefault();

            //该会员有会员卡
            if (vipCardVipMappingEntity != null)
            {
                //获取该会员会员卡信息
                var vipCardEntity = vipCardBll.QueryByEntity(new VipCardEntity()
                {
                    CustomerID = CurrentUserInfo.ClientID, VipCardID = vipCardVipMappingEntity.VipCardID
                }, null).FirstOrDefault();

                //获取该会员卡类型
                var sysVipCardTypeEntity = sysVipCardTypeBll.GetByID(vipCardEntity.VipCardTypeID);
                VipCardTypeId = vipCardEntity.VipCardTypeID;

                //获取会员卡的会员活动
                var rechargeStrategyBLL = new RechargeStrategyBLL(CurrentUserInfo);
                var RechargeActivityDS  = rechargeStrategyBLL.GetRechargeActivityList(CurrentUserInfo.ClientID, VipCardTypeId.ToString(), 3);
                var RechargeStrategy    = new RechargeStrategyInfo();

                if (RechargeActivityDS != null && RechargeActivityDS.Tables[0].Rows.Count > 0)
                {
                    var RechargeStrategyList = DataTableToObject.ConvertToList <RechargeStrategyInfo>(RechargeActivityDS.Tables[0]);
                    //获取与充值金额最接近的活动
                    RechargeStrategy = RechargeStrategyList.Where(n => n.RechargeAmount <= rp.ActuallyPaid).OrderByDescending(n => n.RechargeAmount).FirstOrDefault();
                    if (RechargeStrategy != null)
                    {
                        //梯度
                        if (RechargeStrategy.RuleType == "Step")
                        {
                            //赠送金额 = 会员活动梯度设置赠送金额
                            returnAmount = RechargeStrategy.GiftAmount;
                        }
                        //叠加
                        if (RechargeStrategy.RuleType == "Superposition")
                        {
                            //赠送金额与满赠条件金额比例
                            decimal discount = RechargeStrategy.GiftAmount / RechargeStrategy.RechargeAmount;
                            //赠送金额 = 充值金额 * (设置赠送金额 / 设置满赠条件金额)
                            returnAmount = rp.ActuallyPaid * RechargeStrategy.GiftAmount / RechargeStrategy.RechargeAmount;
                        }
                    }
                }

                //获取等级高的会员卡类型条件
                complexConditionOne.Add(new MoreThanCondition()
                {
                    FieldName = "VipCardLevel", Value = sysVipCardTypeEntity.VipCardLevel, IncludeEquals = false
                });
                complexConditionOne.Add(new EqualsCondition()
                {
                    FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
                });
            }
            //该会员没有会员卡
            else
            {
                //获取所有的会员卡类型条件
                complexConditionOne.Add(new EqualsCondition()
                {
                    FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
                });
            }

            var sysVipCardTypeList = sysVipCardTypeBll.Query(complexConditionOne.ToArray(), null).ToList();

            if (sysVipCardTypeList == null)
            {
                throw new APIException("没有建立会员体系")
                      {
                          ErrorCode = 200
                      };
            }

            //获取会员卡类型升级规则
            List <IWhereCondition> complexConditionTwo = new List <IWhereCondition> {
            };

            complexConditionTwo.Add(new EqualsCondition()
            {
                FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
            });
            complexConditionTwo.Add(new EqualsCondition()
            {
                FieldName = "IsRecharge", Value = 1
            });
            var vipCardUpgradeRuleList = vipCardUpgradeRuleBll.Query(complexConditionTwo.ToArray(), null);

            //将升级卡规则和可升级的会员卡匹配
            var vipCardTypeDetailList = vipCardUpgradeRuleList.Join(sysVipCardTypeList, n => n.VipCardTypeID, m => m.VipCardTypeID, (n, m) => new { n, m }).OrderByDescending(t => t.m.VipCardLevel).ToList();

            //判断是否满充值条件
            bool isUpgrade = false;


            for (int i = 0; i < vipCardTypeDetailList.Count; i++)
            {
                //实付金额 >= 可升级金额
                if (vipCardTypeDetailList[i].n.OnceRechargeAmount <= rp.ActuallyPaid)
                {
                    isUpgrade     = true;
                    VipCardTypeId = vipCardTypeDetailList[i].n.VipCardTypeID ?? 0;
                    break;
                }
            }
            if (isUpgrade)
            {
                OrderDesc = "Upgrade";  //升级
            }


            //充值订单
            var rechargeOrderEntity = new RechargeOrderEntity()
            {
                OrderID       = Guid.NewGuid(),
                OrderNo       = serviceUnitExpandBll.GetUnitOrderNo(),
                OrderDesc     = OrderDesc,
                VipID         = vipInfo.VIPID,
                VipCardNo     = vipInfo.VipCode,
                UnitId        = rp.UnitId,
                UserId        = userId,
                TotalAmount   = rp.ActuallyPaid,
                ActuallyPaid  = rp.ActuallyPaid,
                PosSourceName = rp.PosSourceName,
                ReturnAmount  = returnAmount,
                PayerID       = vipInfo.VIPID,
                Status        = 0,
                CustomerID    = CurrentUserInfo.ClientID,
                VipCardTypeId = VipCardTypeId
            };

            rechargeOrderBll.Create(rechargeOrderEntity);
            rd.orderId = rechargeOrderEntity.OrderID.ToString();

            //支付完成
            if (rp.PayStatus == 1)
            {
                //获取门店信息
                t_unitBLL    unitBLL  = new t_unitBLL(CurrentUserInfo);
                t_unitEntity unitInfo = null;
                if (!string.IsNullOrEmpty(rechargeOrderEntity.UnitId))
                {
                    unitInfo = unitBLL.GetByID(rechargeOrderEntity.UnitId);
                }
                //充值
                rechargeOrderBll.Recharge(rechargeOrderEntity, vipInfo, unitInfo, "");
            }

            return(rd);
        }
Пример #12
0
        public string UpdateMHCategoryAreaByGroupId()
        {
            var responseData = new ResponseData();

            //请求参数
            var groupIDFrom = FormatParamValue(Request("groupIDFrom"));
            var groupIDTo   = Utils.GetIntVal(FormatParamValue(Request("groupIDTo")));
            var itemService = new ItemService(this.CurrentUserInfo);

            if (Convert.ToInt32(groupIDFrom) == Convert.ToInt32(groupIDTo))
            {
                responseData.success = false;
                responseData.msg     = "位置相同,不能移动";
                return(responseData.ToJSON());
            }
            else
            {
                //update MHItemArea groupid
                itemService.UpdateMHCategoryAreaByGroupId(this.CurrentUserInfo.ClientID, Convert.ToInt32(groupIDFrom), Convert.ToInt32(groupIDTo));
                //get MHItemArea info

                var content = new GetMHCategoryAreaInfoRespContentData {
                    categoryList = new List <CategoryEntity>()
                };
                try
                {
                    var homeBll  = new MobileHomeBLL(this.CurrentUserInfo);
                    var homeList = homeBll.QueryByEntity(new MobileHomeEntity {
                        CustomerId = this.CurrentUserInfo.ClientID
                    }, null);
                    if (homeList != null && homeList.Length > 0)
                    {
                        var homeEntity = homeList.FirstOrDefault();
                        var adAreaBll  = new MHAdAreaBLL(this.CurrentUserInfo);
                        var dsGroup    = adAreaBll.GetCategoryGroupId(homeEntity.HomeId.ToString());

                        if (dsGroup != null && dsGroup.Tables.Count > 0 && dsGroup.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow dr in dsGroup.Tables[0].Rows)
                            {
                                var category = new CategoryEntity
                                {
                                    groupId  = dr[0].ToString(),
                                    itemList = new List <ItemEntity>()
                                };

                                var dsItem = adAreaBll.GetItemList(category.groupId, homeEntity.HomeId.ToString());
                                if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0)
                                {
                                    category.itemList = DataTableToObject.ConvertToList <ItemEntity>(dsItem.Tables[0]);
                                }
                                content.categoryList.Add(category);
                            }
                        }
                    }



                    responseData.success = true;
                    responseData.data    = content;
                    return(responseData.ToJSON());
                }
                catch (Exception ex)
                {
                    responseData.success = false;
                    responseData.msg     = ex.ToString();
                    return(responseData.ToJSON());
                }
            }
        }
Пример #13
0
        /// <summary>
        /// 获取客户端首页所有配置信息
        /// </summary>
        public string GetHomePageConfigInfo()
        {
            var responseData = new ResponseData();

            try
            {
                var homeBll  = new MobileHomeBLL(this.CurrentUserInfo);
                var homeList = homeBll.QueryByEntity(new MobileHomeEntity {
                    CustomerId = this.CurrentUserInfo.ClientID
                }, null);

                if (homeList != null && homeList.Length > 0)
                {
                    var homeEntity = homeList.FirstOrDefault();

                    var adAreaBll = new MHAdAreaBLL(this.CurrentUserInfo);
                    var content   = new GetHomePageConfigInfoRespContentData
                    {
                        adList       = new List <AdEntity>(),
                        eventList    = new List <EventAreaEntity>(),
                        categoryList = new List <CategoryEntity>()
                    };  //客户端首页所有配置信息

                    #region 广告集合 A 图片广告 B活动集合 C 商品分类和商品

                    var dsAd = adAreaBll.GetAdList(homeEntity.HomeId.ToString());
                    if (dsAd != null && dsAd.Tables.Count > 0 && dsAd.Tables[0].Rows.Count > 0)
                    {
                        content.adList = DataTableToObject.ConvertToList <AdEntity>(dsAd.Tables[0]);
                    }

                    #endregion

                    #region 活动集合

                    var dsEvent = adAreaBll.GetEventInfo(homeEntity.HomeId.ToString());
                    if (dsEvent != null && dsEvent.Tables.Count > 0 && dsEvent.Tables[0].Rows.Count > 0)
                    {
                        content.eventList = DataTableToObject.ConvertToList <EventAreaEntity>(dsEvent.Tables[0]);
                    }

                    #endregion

                    #region 分类集合

                    //获取分组ID
                    var dsGroup = adAreaBll.GetCategoryGroupId(homeEntity.HomeId.ToString());
                    if (dsGroup != null && dsGroup.Tables.Count > 0 && dsGroup.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in dsGroup.Tables[0].Rows)
                        {
                            var category = new CategoryEntity
                            {
                                groupId  = dr[0].ToString(),
                                itemList = new List <ItemEntity>()
                            };

                            var dsItem = adAreaBll.GetItemList(category.groupId, homeEntity.HomeId.ToString());
                            if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0)
                            {
                                DataSet modelDs = adAreaBll.GetModelTypeIdByGroupId(category.groupId);
                                if (modelDs.Tables[0].Rows.Count > 0)
                                {
                                    category.modelTypeId   = Convert.ToInt32(modelDs.Tables[0].Rows[0]["modelTypeId"]);
                                    category.modelTypeName = Convert.ToString(modelDs.Tables[0].Rows[0]["modelTypeName"]);
                                }

                                category.itemList = DataTableToObject.ConvertToList <ItemEntity>(dsItem.Tables[0]);
                            }

                            content.categoryList.Add(category);
                        }
                    }

                    #endregion

                    responseData.success = true;
                    responseData.data    = content;
                    return(responseData.ToJSON());
                }
                else
                {
                    //添加移动终端首页主表MobileHome
                    homeBll.Create(new MobileHomeEntity
                    {
                        HomeId     = Guid.NewGuid(),
                        Title      = "客户端首页",
                        CustomerId = this.CurrentUserInfo.ClientID
                    });

                    responseData.success = true;
                    responseData.msg     = string.Empty;
                    return(responseData.ToJSON());
                }
            }
            catch (Exception ex)
            {
                responseData.success = false;
                responseData.msg     = ex.ToString();
                return(responseData.ToJSON());
            }
        }
Пример #14
0
        protected override CTWEventShareLogRD ProcessRequest(DTO.Base.APIRequest <CTWEventShareLogRP> pRequest)
        {
            var rd   = new CTWEventShareLogRD();//返回值
            var para = pRequest.Parameters;

            if (!string.IsNullOrEmpty(para.CTWEventId) && !string.IsNullOrEmpty(para.Sender) && !string.IsNullOrEmpty(para.OpenId))
            {
                var bllLeventShareLog    = new T_LEventsSharePersonLogBLL(this.CurrentUserInfo);
                var entityLeventShareLog = new T_LEventsSharePersonLogEntity();

                entityLeventShareLog.ShareVipID    = para.Sender;
                entityLeventShareLog.ShareOpenID   = para.OpenId;
                entityLeventShareLog.BeShareOpenID = para.BeSharedOpenId;
                entityLeventShareLog.BeShareVipID  = para.BEsharedUserId;
                entityLeventShareLog.BusTypeCode   = "CTW";
                entityLeventShareLog.ObjectId      = para.CTWEventId;
                entityLeventShareLog.ShareURL      = para.ShareURL;
                entityLeventShareLog.ShareVipType  = 3;
                bllLeventShareLog.Create(entityLeventShareLog);
                //是否分享给自己
                if (para.Sender == para.BEsharedUserId)
                {
                    return(rd);
                }
                //触点奖励
                ContactEventBLL bllContactEvent = new ContactEventBLL(this.CurrentUserInfo);
                var             entityContact   = bllContactEvent.QueryByEntity(new ContactEventEntity()
                {
                    EventId = para.CTWEventId, IsDelete = 0, IsCTW = 1, ContactTypeCode = "Share"
                }, null).SingleOrDefault();
                if (entityContact != null)
                {
                    LPrizesBLL      bllPrize       = new LPrizesBLL(this.CurrentUserInfo);
                    LPrizeWinnerBLL bllPrizeWinner = new LPrizeWinnerBLL(this.CurrentUserInfo);
                    LLotteryLogBLL  bllLottery     = new LLotteryLogBLL(this.CurrentUserInfo);
                    ///判断是否已经获得奖励
                    int intLogCount = bllLottery.GetEventLotteryLogByEventId(entityContact.ContactEventId.ToString(), para.Sender);
                    if (intLogCount > 0)
                    {
                        return(rd);
                    }

                    var prize = DataTableToObject.ConvertToList <LPrizesEntity>(bllPrize.GetCouponTypeIDByEventId(entityContact.ContactEventId.ToString()).Tables[0]).FirstOrDefault();
                    if (prize != null)
                    {
                        CouponBLL bllCoupon = new CouponBLL(this.CurrentUserInfo);

                        if (prize.PrizeTypeId == "Coupon")
                        {
                            bllCoupon.CouponBindVip(para.Sender, prize.CouponTypeID, entityContact.ContactEventId.ToString(), "Share");

                            DataSet ds = bllPrize.GetAllCouponTypeByPrize(prize.PrizesID);
                            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                var redisVipMappingCouponBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.Coupon.RedisVipMappingCouponBLL();

                                foreach (DataRow dr in ds.Tables[0].Rows)
                                {
                                    redisVipMappingCouponBLL.SetVipMappingCoupon(new CC_Coupon()
                                    {
                                        CustomerId   = this.CurrentUserInfo.ClientID,
                                        CouponTypeId = dr["CouponTypeID"].ToString()
                                    }, entityContact.ContactEventId.ToString(), para.Sender, "Share");
                                }
                            }
                        }
                        if (prize.PrizeTypeId == "Point")
                        {
                            #region 调用积分统一接口
                            var            salesReturnBLL = new T_SalesReturnBLL(this.CurrentUserInfo);
                            VipIntegralBLL bllVipIntegral = new VipIntegralBLL(this.CurrentUserInfo);
                            var            vipBLL         = new VipBLL(this.CurrentUserInfo);

                            var vipInfo        = vipBLL.GetByID(para.Sender);
                            var IntegralDetail = new VipIntegralDetailEntity()
                            {
                                Integral         = prize.Point,
                                IntegralSourceID = "28",
                                ObjectId         = entityContact.ContactEventId.ToString()
                            };
                            //变动前积分
                            string OldIntegral = (vipInfo.Integration ?? 0).ToString();
                            //变动积分
                            string ChangeIntegral      = (IntegralDetail.Integral ?? 0).ToString();
                            var    vipIntegralDetailId = bllVipIntegral.AddIntegral(ref vipInfo, null, IntegralDetail, null, this.CurrentUserInfo);
                            //发送微信积分变动通知模板消息
                            if (!string.IsNullOrWhiteSpace(vipIntegralDetailId))
                            {
                                var CommonBLL = new CommonBLL();
                                CommonBLL.PointsChangeMessage(OldIntegral, vipInfo, ChangeIntegral, vipInfo.WeiXinUserId, this.CurrentUserInfo);
                            }

                            #endregion
                        }

                        #region 奖励日志
                        LPrizeWinnerEntity entityPrizeWinner = new LPrizeWinnerEntity()
                        {
                            PrizeWinnerID = Guid.NewGuid().ToString(),
                            VipID         = para.Sender,
                            PrizeID       = prize.PrizesID,
                            PrizeName     = prize.PrizeName,
                            PrizePoolID   = "",
                            CreateBy      = this.CurrentUserInfo.UserID,
                            CreateTime    = DateTime.Now,
                            IsDelete      = 0
                        };

                        bllPrizeWinner.Create(entityPrizeWinner);


                        LLotteryLogEntity lotteryEntity = new LLotteryLogEntity()
                        {
                            LogId        = Guid.NewGuid().ToString(),
                            VipId        = para.Sender,
                            EventId      = entityContact.ContactEventId.ToString(),
                            LotteryCount = 1,
                            IsDelete     = 0
                        };
                        bllLottery.Create(lotteryEntity);
                        #endregion
                    }
                }
            }
            return(rd);
        }
Пример #15
0
        protected override GetMemberInfoRD ProcessRequest(DTO.Base.APIRequest <GetMemberInfoRP> pRequest)
        {
            GetMemberInfoRD rd = new GetMemberInfoRD();

            rd.MemberInfo = new MemberInfo();
            var vipLoginBLL = new VipBLL(base.CurrentUserInfo);

            //如果有一个查询标识非空,就用查询标识查,发现没有会员就报错
            if (!string.IsNullOrEmpty(pRequest.Parameters.SearchFlag))
            {
                List <IWhereCondition> complexCondition = new List <IWhereCondition> {
                };
                complexCondition.Add(new EqualsCondition()
                {
                    FieldName = "ClientID", Value = CurrentUserInfo.ClientID
                });
                var cond1 = new LikeCondition()
                {
                    FieldName = "VipName", Value = "%" + pRequest.Parameters.SearchFlag + "%"
                };
                var cond2 = new LikeCondition()
                {
                    FieldName = "VipRealName", Value = "%" + pRequest.Parameters.SearchFlag + "%"
                };
                var com1 = new ComplexCondition()
                {
                    Left = cond1, Right = cond2, Operator = LogicalOperators.Or
                };

                var cond3 = new EqualsCondition()
                {
                    FieldName = "Phone", Value = pRequest.Parameters.SearchFlag
                };
                var com2 = new ComplexCondition()
                {
                    Left = com1, Right = cond3, Operator = LogicalOperators.Or
                };
                complexCondition.Add(com2);
                complexCondition.Add(new DirectCondition("(WeiXinUserId!='' Or WeiXinUserId IS NOT NULL)"));
                var tempVipList = vipLoginBLL.Query(complexCondition.ToArray(), null);
                if (tempVipList != null && tempVipList.Length != 0)
                {
                    pRequest.UserID = pRequest.Parameters.MemberID = tempVipList[0].VIPID;
                }
            }

            string m_MemberID = "";

            if (!string.IsNullOrWhiteSpace(pRequest.Parameters.OwnerVipID))
            {
                m_MemberID = string.IsNullOrWhiteSpace(pRequest.Parameters.OwnerVipID) ? pRequest.UserID : pRequest.Parameters.OwnerVipID;
            }
            else
            {
                m_MemberID = string.IsNullOrWhiteSpace(pRequest.Parameters.MemberID) ? pRequest.UserID : pRequest.Parameters.MemberID;
            }

            string UserID       = m_MemberID;
            var    VipLoginInfo = vipLoginBLL.GetByID(UserID);

            if (VipLoginInfo == null)
            {
                throw new APIException("用户不存在")
                      {
                          ErrorCode = 330
                      }
            }
            ;
            #region 20140909 kun.zou 发现状态为0,改为1
            if (VipLoginInfo.Status.HasValue && VipLoginInfo.Status == 0)
            {
                VipLoginInfo.Status = 1;
                vipLoginBLL.Update(VipLoginInfo, false);
                var log = new VipLogEntity()
                {
                    Action       = "更新",
                    ActionRemark = "vip状态为0的改为1.",
                    CreateBy     = UserID,
                    CreateTime   = DateTime.Now,
                    VipID        = VipLoginInfo.VIPID,
                    LogID        = Guid.NewGuid().ToString("N")
                };
                var logBll = new VipLogBLL(base.CurrentUserInfo);
                logBll.Create(log);
            }
            #endregion
            int couponCount = vipLoginBLL.GetVipCoupon(UserID);

            rd.MemberInfo.Mobile      = VipLoginInfo.Phone;      //手机号码
            rd.MemberInfo.Name        = VipLoginInfo.UserName;   //姓名
            rd.MemberInfo.VipID       = VipLoginInfo.VIPID;      //组标识
            rd.MemberInfo.VipName     = VipLoginInfo.VipName;    //会员名
            rd.MemberInfo.ImageUrl    = VipLoginInfo.HeadImgUrl; //会员头像  add by Henry 2014-12-5
            rd.MemberInfo.VipRealName = VipLoginInfo.VipRealName;
            rd.MemberInfo.VipNo       = VipLoginInfo.VipCode;
            rd.MemberInfo.IsDealer    = VipLoginInfo.Col48 != null?int.Parse(VipLoginInfo.Col48) : 0;

            //超级分销体系配置表 为判断是否存在分销体系使用
            var T_SuperRetailTraderConfigbll = new T_SuperRetailTraderConfigBLL(CurrentUserInfo);
            //获取分销体系信息
            var T_SuperRetailTraderConfigInfo = T_SuperRetailTraderConfigbll.QueryByEntity(new T_SuperRetailTraderConfigEntity()
            {
                IsDelete = 0, CustomerId = CurrentUserInfo.CurrentUser.customer_id
            }, null).FirstOrDefault();
            if (T_SuperRetailTraderConfigInfo != null)
            {
                rd.MemberInfo.CanBeSuperRetailTrader = 1;
            }
            else
            {
                rd.MemberInfo.CanBeSuperRetailTrader = 0;
            }
            rd.MemberInfo.SuperRetailTraderID = VipLoginInfo.Col26;
            //rd.MemberInfo.Integration = VipLoginInfo.Integration ?? 0;//会员积分

            #region 会员有效积分
            var vipIntegralBLL  = new VipIntegralBLL(CurrentUserInfo);
            var vipIntegralInfo = vipIntegralBLL.QueryByEntity(new VipIntegralEntity()
            {
                VipID = UserID, VipCardCode = VipLoginInfo.VipCode
            }, null).FirstOrDefault();
            if (vipIntegralInfo != null)
            {
                rd.MemberInfo.Integration = vipIntegralInfo.ValidIntegral != null ? vipIntegralInfo.ValidIntegral.Value : 0;
            }
            #endregion

            //会员等级
            //rd.MemberInfo.VipLevelName = string.IsNullOrEmpty(vipLoginBLL.GetVipLeave(UserID)) ? null : vipLoginBLL.GetVipLeave(UserID);
            #region 会员卡名称
            var                vipCardVipMappingBLL = new VipCardVipMappingBLL(CurrentUserInfo);
            var                vipCardBLL           = new VipCardBLL(CurrentUserInfo);
            var                vipCardTypeBLL       = new SysVipCardTypeBLL(CurrentUserInfo);
            var                vipCardRuleBLL       = new VipCardRuleBLL(CurrentUserInfo);
            var                vipT_InoutBLL        = new T_InoutBLL(CurrentUserInfo);
            VipAmountBLL       vipAmountBLL         = new VipAmountBLL(CurrentUserInfo);
            ShoppingCartBLL    service     = new ShoppingCartBLL(CurrentUserInfo);
            ShoppingCartEntity queryEntity = new ShoppingCartEntity();
            queryEntity.VipId = UserID;
            int totalQty = service.GetListQty(queryEntity);
            rd.MemberInfo.ShopCartCount = totalQty;
            //定义当前自定义等级
            int?CurVipLevel        = 0;
            var vipCardMappingInfo = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
            {
                VIPID = UserID, CustomerID = CurrentUserInfo.ClientID
            },
                                                                        new OrderBy[] { new OrderBy()
                                                                                        {
                                                                                            FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                        } }).FirstOrDefault();
            if (vipCardMappingInfo != null)
            {
                var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                {
                    VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                }, null).FirstOrDefault();
                if (vipCardInfo != null)
                {
                    var vipCardTypeInfo = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                    {
                        VipCardTypeID = vipCardInfo.VipCardTypeID
                    }, null).FirstOrDefault();
                    if (vipCardTypeInfo != null)
                    {
                        rd.MemberInfo.VipLevelName     = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                        rd.MemberInfo.CardTypeImageUrl = vipCardTypeInfo.PicUrl != null ? vipCardTypeInfo.PicUrl : "";
                        rd.MemberInfo.CardTypePrice    = vipCardTypeInfo.Prices != null ? vipCardTypeInfo.Prices.Value : 0;
                        rd.MemberInfo.IsExtraMoney     = vipCardTypeInfo.IsExtraMoney != null ? vipCardTypeInfo.IsExtraMoney : 0;
                        CurVipLevel             = vipCardTypeInfo.VipCardLevel;
                        rd.MemberInfo.IsPrepaid = vipCardTypeInfo.Isprepaid;
                        if (CurVipLevel > 1)
                        {
                            var VipCardTypeSysInfo = vipCardTypeBLL.GetBindVipCardTypeInfo(CurrentUserInfo.ClientID, VipLoginInfo.Phone, pRequest.UserID, CurVipLevel);
                            if (VipCardTypeSysInfo == null || VipCardTypeSysInfo.Tables[0].Rows.Count == 0)
                            {
                                rd.MemberInfo.IsNeedCard = 2;
                            }
                        }
                        else
                        {
                            rd.MemberInfo.IsNeedCard = 1;
                        }
                        //因为卡等级不能重复,知道当前等级后查找相应的下一级是否是自动升级(消费升级)
                        var NextVipCardTypeInfo = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                        {
                            VipCardLevel = CurVipLevel + 1, CustomerID = CurrentUserInfo.ClientID
                        }, null).FirstOrDefault();
                        if (NextVipCardTypeInfo != null)
                        {
                            //获取当前会员的消费金额信息
                            decimal CurVipConsumptionAmount = 0;
                            decimal VipConsumptionInfo      = vipT_InoutBLL.GetVipSumAmount(UserID);
                            if (VipConsumptionInfo > 0)
                            {
                                CurVipConsumptionAmount = Convert.ToDecimal(Convert.ToDecimal(VipConsumptionInfo).ToString("0.00"));
                            }
                            //知道下一等级后要判断,升级条件是否是消费升级
                            //定义累积消费金额
                            decimal AccumulatedAmount      = 0;
                            var     vipCardTypeUpGradeInfo = vipCardTypeBLL.GetVipCardTypeUpGradeInfo(CurrentUserInfo.ClientID, CurVipLevel);
                            if (vipCardTypeUpGradeInfo != null && vipCardTypeUpGradeInfo.Tables[0].Rows.Count > 0)
                            {
                                //判断拉取的所有卡等级里的最近的一级满足条件即可返回提示所需的值
                                int flag = 0;
                                foreach (DataRow dr in vipCardTypeUpGradeInfo.Tables[0].Rows)
                                {
                                    AccumulatedAmount = Convert.ToDecimal(Convert.ToDecimal(dr["BuyAmount"].ToString()).ToString("0.00"));
                                    //获取消费升级还需多少钱
                                    if (AccumulatedAmount > CurVipConsumptionAmount && flag == 0)
                                    {
                                        flag = 1;
                                        rd.MemberInfo.UpGradeNeedMoney = AccumulatedAmount - CurVipConsumptionAmount;
                                        if (rd.MemberInfo.UpGradeNeedMoney > 0)
                                        {
                                            rd.MemberInfo.UpgradePrompt = "还需要消费" + rd.MemberInfo.UpGradeNeedMoney + "元可以升级啦,快点通知会员!";
                                        }
                                    }
                                }
                            }
                        }

                        var VipCardRuleInfo = vipCardRuleBLL.QueryByEntity(new VipCardRuleEntity()
                        {
                            CustomerID = CurrentUserInfo.ClientID, VipCardTypeID = vipCardTypeInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (VipCardRuleInfo != null)
                        {
                            rd.MemberInfo.CardDiscount = Convert.ToDecimal(Convert.ToDecimal((VipCardRuleInfo.CardDiscount / 10)).ToString("0.00"));
                        }
                    }
                }
            }
            else
            {
                //表示需要领卡,并展示等级为1的默认卡
                rd.MemberInfo.IsNeedCard = 0;
                var VipCardTypeData = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                {
                    VipCardLevel = 1, CustomerID = CurrentUserInfo.ClientID
                }, null).FirstOrDefault();
                if (VipCardTypeData != null)
                {
                    rd.MemberInfo.CardTypeImageUrl = VipCardTypeData.PicUrl != null ? VipCardTypeData.PicUrl : "";
                }
            }
            //获取红利/// decimal[0]=总收入(红利) decimal[2]=支出余额 decimal[1]=总提现金额
            decimal[] array = vipAmountBLL.GetVipSumAmountByCondition(UserID, CurrentUserInfo.ClientID, true);
            if (array[0] != null)
            {
                rd.MemberInfo.ProfitAmount = array[0];
            }
            //是否有付费的会员卡
            List <IWhereCondition> freeCardCon = new List <IWhereCondition> {
            };
            freeCardCon.Add(new EqualsCondition()
            {
                FieldName = "CustomerID", Value = CurrentUserInfo.ClientID
            });
            freeCardCon.Add(new DirectCondition("Prices>0"));
            var freeCardTypeInfo = vipCardTypeBLL.Query(freeCardCon.ToArray(), null).FirstOrDefault();
            if (freeCardTypeInfo != null)
            {
                rd.MemberInfo.IsCostCardType = 1;
            }
            else
            {
                rd.MemberInfo.IsCostCardType = 0;
            }

            #endregion

            rd.MemberInfo.Status       = VipLoginInfo.Status.HasValue ? VipLoginInfo.Status.Value : 1;
            rd.MemberInfo.CouponsCount = couponCount;
            rd.MemberInfo.IsActivate   = (VipLoginInfo.IsActivate.HasValue && VipLoginInfo.IsActivate.Value == 1 ? true : false);
            var customerBasicSettingBll = new CustomerBasicSettingBLL(CurrentUserInfo);
            rd.MemberInfo.MemberBenefits = customerBasicSettingBll.GetMemberBenefits(pRequest.CustomerID);



            //获取标签信息
            TagsBLL TagsBLL = new TagsBLL(base.CurrentUserInfo);


            var dsIdentity = TagsBLL.GetVipTagsList("", UserID);//“车主标签”  传7
            if (dsIdentity != null && dsIdentity.Tables.Count > 0 && dsIdentity.Tables[0].Rows.Count > 0)
            {
                rd.IdentityTagsList = DataTableToObject.ConvertToList <TagsInfo>(dsIdentity.Tables[0]).ToArray(); //“年龄段”  传8
            }


            #region 获取注册表单的列明和值

            var vipEntity = vipLoginBLL.QueryByEntity(new VipEntity()
            {
                VIPID = UserID
            }, null);

            if (vipEntity == null || vipEntity.Length == 0)
            {
                return(rd);
            }
            else
            {
                var ds = vipLoginBLL.GetVipColumnInfo(CurrentUserInfo.ClientID, "online005");

                var vipDs = vipLoginBLL.GetVipInfo(UserID);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    var temp = ds.Tables[0].AsEnumerable().Select(t => new MemberControlInfo()
                    {
                        ColumnName  = t["ColumnName"].ToString(),
                        ControlType = Convert.ToInt32(t["ControlType"]),
                        ColumnValue = vipDs.Tables[0].Rows[0][t["ColumnName"].ToString()].ToString(),
                        ColumnDesc  = t["columnDesc"].ToString()
                    });

                    rd.MemberControlList = temp.ToArray();
                }
            }

            //var vipamountBll = new VipAmountBLL(this.CurrentUserInfo);

            //var vipAmountEntity = vipamountBll.GetByID(UserID);


            var unitBll = new UnitBLL(this.CurrentUserInfo);
            //Hashtable htPara = new Hashtable();
            //htPara["MemberID"] = UserID;
            //htPara["CustomerID"] = CurrentUserInfo.ClientID;
            //htPara["PageIndex"] = 1;
            //htPara["PageSize"] = 10;
            //DataSet dsMyAccount = unitBll.GetMyAccount(htPara);

            //if (dsMyAccount.Tables[0].Rows.Count > 0)
            //{
            //    //rd.AccountList = DataTableToObject.ConvertToList<AccountInfo>(dsMyAccount.Tables[0]);
            //    //rd.MemberInfo.Balance = Convert.ToDecimal(dsMyAccount.Tables[0].Rows[0]["Total"].ToString());
            //    //rd.TotalPageCount = int.Parse(dsMyAccount.Tables[0].Rows[0]["PageCount"].ToString());

            //}
            //else
            //    rd.MemberInfo.Balance = 0;

            //返现 add by Henry 2015-4-15
            var vipAmountBll = new VipAmountBLL(CurrentUserInfo);
            //var vipAmountInfo = vipAmountBll.GetByID(UserID);
            var vipAmountInfo = vipAmountBll.QueryByEntity(new VipAmountEntity()
            {
                VipId = UserID, VipCardCode = VipLoginInfo.VipCode
            }, null).FirstOrDefault();
            decimal returnAmount = 0;
            decimal amount       = 0;
            if (vipAmountInfo != null)
            {
                returnAmount = vipAmountInfo.ValidReturnAmount == null ? 0 : vipAmountInfo.ValidReturnAmount.Value;
                amount       = vipAmountInfo.EndAmount == null ? 0 : vipAmountInfo.EndAmount.Value;
            }
            rd.MemberInfo.ReturnAmount = returnAmount; //返现
            rd.MemberInfo.Balance      = amount;       //余额
            #endregion


            //获取订单的日期和订单的里的商品名称、商品单价、商品数量
            //先获取订单列表,再获取订单详细信息
            int?         pageSize     = 3; //rp.Parameters.PageSize;,只取三条记录
            int?         pageIndex    = 1; //rp.Parameters.PageIndex;
            string       OrderBy      = "";
            string       OrderType    = "";
            T_InoutBLL   T_InoutBLL   = new T_InoutBLL(CurrentUserInfo);
            InoutService InoutService = new InoutService(CurrentUserInfo);
            //只取状态为700的
            //根据订单列表取订单详情
            DataSet dsOrder = T_InoutBLL.GetOrdersByVipID(rd.MemberInfo.VipID, pageIndex ?? 1, pageSize ?? 15, OrderBy, OrderType);//获取会员信息
            if (dsOrder != null && dsOrder.Tables.Count != 0 && dsOrder.Tables[0].Rows.Count != 0)
            {
                List <JIT.CPOS.DTO.Module.VIP.Login.Response.OrderInfo> orderList = DataTableToObject.ConvertToList <JIT.CPOS.DTO.Module.VIP.Login.Response.OrderInfo>(dsOrder.Tables[1]);
                foreach (JIT.CPOS.DTO.Module.VIP.Login.Response.OrderInfo oi in orderList)
                {
                    IList <InoutDetailInfo> detailList = InoutService.GetInoutDetailInfoByOrderId(oi.order_id);
                    oi.DetailList = detailList;
                }
                rd.OrderList = orderList;
            }

            MessageInfo message = new MessageInfo();


            InnerGroupNewsBLL InnerGroupNewsService = new InnerGroupNewsBLL(CurrentUserInfo);
            SetoffToolsBLL    setofftoolsService    = new SetoffToolsBLL(CurrentUserInfo);

            //1=微信用户 2=APP员工
            int UnReadInnerMessageCount = InnerGroupNewsService.GetVipInnerGroupNewsUnReadCount(CurrentUserInfo.UserID, pRequest.CustomerID, 1, null, Convert.ToDateTime(VipLoginInfo.CreateTime));
            var setofftoolsMessageCount = setofftoolsService.GetUnReadSetoffToolsCount(CurrentUserInfo.UserID, pRequest.CustomerID, 1, 1);
            message.InnerGroupNewsCount = UnReadInnerMessageCount;
            message.SetoffToolsCount    = setofftoolsMessageCount;
            var VipUpNewsInfo = InnerGroupNewsService.GetVipInnerNewsInfo(CurrentUserInfo.ClientID, 2, 1, 3, 0);
            if (VipUpNewsInfo != null && VipUpNewsInfo.Tables[0].Rows.Count > 0)
            {
                message.UpGradeSucess = VipUpNewsInfo.Tables[0].Rows[0]["Text"] != null ? VipUpNewsInfo.Tables[0].Rows[0]["Text"].ToString() : "";
                //获取通知信息 并更新已读状态 数据如果不是一条进行更新所有数据
                var newsUserMappingBLL = new NewsUserMappingBLL(CurrentUserInfo);
                if (VipUpNewsInfo.Tables[0].Rows.Count > 1)//数据如果不是一条进行更新所有数据
                {
                    foreach (DataRow VipNewsdr in VipUpNewsInfo.Tables[0].Rows)
                    {
                        var vipNewsInfo = newsUserMappingBLL.QueryByEntity(new NewsUserMappingEntity()
                        {
                            CustomerId = CurrentUserInfo.ClientID, MappingID = VipNewsdr["MappingID"].ToString()
                        }, null).FirstOrDefault();
                        if (vipNewsInfo != null)
                        {
                            vipNewsInfo.HasRead = 1;
                            newsUserMappingBLL.Update(vipNewsInfo);
                        }
                    }
                }
                else
                {
                    var vipNewsInfo = newsUserMappingBLL.QueryByEntity(new NewsUserMappingEntity()
                    {
                        CustomerId = CurrentUserInfo.ClientID, MappingID = VipUpNewsInfo.Tables[0].Rows[0]["MappingID"].ToString()
                    }, null).FirstOrDefault();
                    if (vipNewsInfo != null)
                    {
                        vipNewsInfo.HasRead = 1;
                        newsUserMappingBLL.Update(vipNewsInfo);
                    }
                }
            }
            else
            {
                message.UpGradeSucess = "";
            }
            rd.MessageInfo = message;
            return(rd);
        }
    }
        protected override GetPanicbuyingKJItemDetailRD ProcessRequest(APIRequest <GetPanicBuyingKJItemDetailRP> pRequest)
        {
            GetPanicBuyingKJItemDetailRP rp = pRequest.Parameters;
            GetPanicbuyingKJItemDetailRD rd = new GetPanicbuyingKJItemDetailRD();

            OnlineShoppingItemBLL itemService    = new OnlineShoppingItemBLL(CurrentUserInfo);
            ItemService           itemServiceBll = new ItemService(CurrentUserInfo);
            var customerBasicSettingBll          = new CustomerBasicSettingBLL(CurrentUserInfo);
            var panicbuyingEventBll = new PanicbuyingEventBLL(CurrentUserInfo);
            var panicbuyingKJEventItemMappingBll = new PanicbuyingKJEventItemMappingBLL(CurrentUserInfo);
            var panicbuyingKJEventSkuMappingBll  = new PanicbuyingKJEventSkuMappingBLL(CurrentUserInfo);
            var panicbuyingKJEventJoinBll        = new PanicbuyingKJEventJoinBLL(CurrentUserInfo);
            var panicbuyingKJEventJoinDetailBll  = new PanicbuyingKJEventJoinDetailBLL(CurrentUserInfo);
            var vipBll = new VipBLL(CurrentUserInfo);

            var vipEntity = vipBll.GetByID(pRequest.UserID);

            if (vipEntity != null)
            {
                rd.HeadImageUrl = vipEntity.HeadImgUrl;
            }

            #region 判断是否已经参与
            rd.isPromoted = 0;
            if (!string.IsNullOrEmpty(rp.KJEventJoinId))
            {
                var panicbuyingKJEventJoinEntity = panicbuyingKJEventJoinBll.GetByID(rp.KJEventJoinId);
                if (panicbuyingKJEventJoinEntity == null)
                {
                    rd.isPromoted = 0;
                }
                else
                {
                    rd.isPromoted = 1;

                    var VipData = vipBll.GetByID(panicbuyingKJEventJoinEntity.VipId);
                    rd.HeadImageUrl = VipData.HeadImgUrl;
                }
            }
            #endregion

            //为复用原来接口所设置参数
            DateTime dtBeginTime = Convert.ToDateTime("9999/01/01");
            DateTime dtEndTime   = Convert.ToDateTime("9999/01/01");


            #region  价活动商品基本信息
            KJEventItemDetailInfo eventItemInfo = panicbuyingEventBll.GetKJEventWithItemDetail(rp.EventId, rp.ItemId);
            if (eventItemInfo != null)
            {
                rd.ItemId             = eventItemInfo.ItemId;
                rd.ItemName           = eventItemInfo.ItemName;
                rd.MinPrice           = eventItemInfo.MinPrice;
                rd.MinBasePrice       = eventItemInfo.MinBasePrice;
                rd.SinglePurchaseQty  = eventItemInfo.SinglePurchaseQty;
                rd.PromotePersonCount = eventItemInfo.PromotePersonCount;
                rd.CurrentQty         = eventItemInfo.CurrentQty;
                rd.SoldQty            = eventItemInfo.SoldQty;
                rd.EventEndTime       = eventItemInfo.EventEndTime.ToString("yyyy-MM-dd HH:mm:ss");
                rd.Seconds            = Convert.ToInt64(eventItemInfo.EventEndTime.Subtract(DateTime.Now).TotalSeconds < 0 ? 0 : eventItemInfo.EventEndTime.Subtract(DateTime.Now).TotalSeconds);
                rd.PropName1          = eventItemInfo.Prop1Name;
                rd.PropName2          = eventItemInfo.Prop2Name;
                rd.ItemIntroduce      = eventItemInfo.ItemIntroduce;

                #endregion

                #region
                if (eventItemInfo.EventEndTime < DateTime.Now)
                {
                    rd.isEventEnd = 0;
                }
                else if (eventItemInfo.EventBeginTime > DateTime.Now)
                {//活动未开始
                    rd.isEventEnd = 2;
                    rd.Seconds    = Convert.ToInt64(eventItemInfo.EventBeginTime.Subtract(DateTime.Now).TotalSeconds < 0 ? 0 : eventItemInfo.EventBeginTime.Subtract(DateTime.Now).TotalSeconds);
                }
                else
                {
                    rd.isEventEnd = 1;
                }
                #endregion

                #region 商品图片
                var dsImages = itemService.GetItemImageList(rp.ItemId);
                if (dsImages != null && dsImages.Tables.Count > 0 && dsImages.Tables[0].Rows.Count > 0)
                {
                    rd.ImageList = DataTableToObject.ConvertToList <ImageInfo>(dsImages.Tables[0]);
                }
                #endregion

                #region 商品详情页
                if (rp.type == 1)
                {
                    #region 关于商品所有Sku信息
                    var dsSkus = itemServiceBll.GetItemSkuList(rp.ItemId, pRequest.UserID, pRequest.CustomerID, dtBeginTime, dtEndTime);
                    var panicbuyingKJEventSkuMappingList = panicbuyingKJEventSkuMappingBll.QueryByEntity(new PanicbuyingKJEventSkuMappingEntity()
                    {
                        EventItemMappingID = eventItemInfo.EventItemMappingID
                    }, null).ToList();
                    if (dsSkus != null && dsSkus.Tables.Count > 0 && dsSkus.Tables[0].Rows.Count > 0)
                    {
                        rd.SkuInfoList = DataTableToObject.ConvertToList <ItemSkuInfo>(dsSkus.Tables[0]);
                    }
                    rd.SkuInfoList = rd.SkuInfoList.Join(panicbuyingKJEventSkuMappingList, n => n.skuId, m => m.SkuID, (n, m) => new ItemSkuInfo()
                    {
                        skuId      = n.skuId,
                        skuProp1   = n.skuProp1,
                        skuProp2   = n.skuProp2,
                        BasePrice  = m.BasePrice.ToString(),
                        price      = m.Price.ToString(),
                        SalesCount = m.SoldQty.ToString(),
                        Stock      = (m.Qty - m.SoldQty).ToString(),
                    }).Distinct().ToList();
                    #endregion

                    #region 商品属性
                    var dsProp1 = panicbuyingKJEventItemMappingBll.GetKJItemProp1List(rp.ItemId, rp.EventId);
                    if (dsProp1 != null && dsProp1.Tables.Count > 0 && dsProp1.Tables[0].Rows.Count > 0)
                    {
                        rd.Prop1List = DataTableToObject.ConvertToList <SkuProp1>(dsProp1.Tables[0]);
                    }
                    #endregion
                    rd.status = 1;
                }
                #endregion

                #region 帮砍页面
                if (rp.type == 2 && rd.isPromoted == 1)
                {
                    if (!string.IsNullOrEmpty(rp.SkuId))
                    {
                        KJItemSkuInfo kJItemSkuInfo = panicbuyingKJEventSkuMappingBll.GetKJItemSkuInfo(rp.EventId, rp.SkuId, rp.KJEventJoinId);
                        rd.SkuInfoList = new List <ItemSkuInfo>();

                        ItemSkuInfo itemSkuInfo = new ItemSkuInfo();
                        itemSkuInfo.skuId    = kJItemSkuInfo.skuId;
                        itemSkuInfo.skuProp1 = kJItemSkuInfo.skuProp1;
                        itemSkuInfo.skuProp2 = kJItemSkuInfo.skuProp2;
                        itemSkuInfo.price    = kJItemSkuInfo.price.ToString();
                        itemSkuInfo.Stock    = kJItemSkuInfo.Stock;
                        rd.SkuInfoList.Add(itemSkuInfo);

                        rd.BargainedPrice    = kJItemSkuInfo.price - kJItemSkuInfo.SalesPrice;
                        rd.MinPrice          = kJItemSkuInfo.price;
                        rd.MinBasePrice      = kJItemSkuInfo.BasePrice;
                        rd.EventSKUMappingId = kJItemSkuInfo.EventSKUMappingId;

                        double EventTime = Convert.ToInt64(eventItemInfo.EventEndTime.Subtract(DateTime.Now).TotalSeconds < 0 ? 0 : eventItemInfo.EventEndTime.Subtract(DateTime.Now).TotalSeconds);
                        double tempTime  = (kJItemSkuInfo.CreateTime.AddHours(Convert.ToDouble(eventItemInfo.BargaingingInterval)) - DateTime.Now).TotalSeconds;
                        if (EventTime > tempTime)
                        {
                            rd.Seconds = Convert.ToInt64(tempTime < 0 ? 0 : tempTime);
                        }
                        else
                        {
                            rd.Seconds = Convert.ToInt64(EventTime < 0 ? 0 : EventTime);
                        }


                        decimal tempPrice = rd.MinPrice - rd.MinBasePrice;
                        if (tempPrice != 0)
                        {
                            rd.BargainedRate = Math.Round(rd.BargainedPrice / (tempPrice), 2);
                        }
                        else
                        {
                            rd.BargainedRate = 0;
                        }

                        if (!string.IsNullOrEmpty(rp.KJEventJoinId))
                        {
                            var panicbuyingKJEventJoinDetailEntity = panicbuyingKJEventJoinDetailBll.QueryByEntity(new PanicbuyingKJEventJoinDetailEntity()
                            {
                                KJEventJoinId = new Guid(rp.KJEventJoinId), VipId = pRequest.UserID
                            }, null).FirstOrDefault();
                            if (panicbuyingKJEventJoinDetailEntity == null)
                            {
                                rd.status = 2;
                            }
                            else
                            {
                                rd.status = 3;
                            }
                        }
                        else
                        {
                            rd.status = 2;
                        }
                    }
                }
                #endregion

                rd.DeliveryDesc      = customerBasicSettingBll.GetSettingValueByCode("DeliveryStrategy");
                rd.CustomerShortName = customerBasicSettingBll.GetSettingValueByCode("CustomerShortName");
                rd.WebLogo           = customerBasicSettingBll.GetSettingValueByCode("WebLogo");
                rd.QRCodeURL         = customerBasicSettingBll.GetSettingValueByCode("GuideQRCode");
            }
            else
            {
                throw new APIException("此活动已不存在")
                      {
                          ErrorCode = 100
                      };
            }
            return(rd);
        }
Пример #17
0
        protected override GetRechargeActivityListRD ProcessRequest(DTO.Base.APIRequest <GetRechargeActivityListRP> pRequest)
        {
            var rd   = new GetRechargeActivityListRD();
            var para = pRequest.Parameters;
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            var vipBLL               = new VipBLL(loggingSessionInfo);
            var vipIntegralBLL       = new VipIntegralBLL(loggingSessionInfo);
            var sysVipCardTypeBLL    = new SysVipCardTypeBLL(loggingSessionInfo);
            var vipCardVipMappingBLL = new VipCardVipMappingBLL(loggingSessionInfo);
            var vipCardBLL           = new VipCardBLL(loggingSessionInfo);
            var vipCardRuleBLL       = new VipCardRuleBLL(loggingSessionInfo);
            var vipAmountBLL         = new VipAmountBLL(loggingSessionInfo);
            //获取当前会员卡等级
            VipEntity VipInfo         = null;
            int?      CurVipCardLevel = 0;

            VipInfo = vipBLL.GetByID(para.VipID);
            if (VipInfo != null)
            {
                rd.HeadImgUrl = VipInfo.HeadImgUrl == null ? "" : VipInfo.HeadImgUrl;
                rd.VipName    = VipInfo.VipName != null ? VipInfo.VipName : VipInfo.VipRealName != null ? VipInfo.VipRealName : "";
                //获取当前会员积分信息
                //var vipIntegralInfo = vipIntegralBLL.QueryByEntity(new VipIntegralEntity() { VipID = para.VipID, VipCardCode = VipInfo.VipCode }, null).FirstOrDefault();
                //if (vipIntegralInfo != null)
                //{
                //    rd.Integration = vipIntegralInfo.ValidIntegral != null ? vipIntegralInfo.ValidIntegral.Value : 0;
                //}
                //获取当前会员余额信息
                var vipAmountInfo = vipAmountBLL.QueryByEntity(new VipAmountEntity()
                {
                    VipId = para.VipID, VipCardCode = VipInfo.VipCode
                }, null).FirstOrDefault();
                if (vipAmountInfo != null)
                {
                    rd.VipAmount = vipAmountInfo.EndAmount != null ? vipAmountInfo.EndAmount : 0;
                }
                else
                {
                    rd.VipAmount = 0;
                }
                //获取当前关联信息
                var vipCardMappingInfo = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
                {
                    VIPID = para.VipID, CustomerID = loggingSessionInfo.ClientID
                },
                                                                            new OrderBy[] { new OrderBy()
                                                                                            {
                                                                                                FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                            } }).FirstOrDefault();
                if (vipCardMappingInfo != null)
                {
                    //获取卡等级主标识信息
                    var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                    {
                        VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                    }, null).FirstOrDefault();
                    if (vipCardInfo != null)
                    {
                        //获取卡等级信息
                        var vipCardTypeInfo = sysVipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                        {
                            VipCardTypeID = vipCardInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (vipCardTypeInfo != null)
                        {
                            rd.VipCardTypeName = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                            CurVipCardLevel    = vipCardTypeInfo.VipCardLevel;
                        }
                        //获取充值活动列表
                        var rechargeStrategyBLL  = new RechargeStrategyBLL(loggingSessionInfo);
                        var RechargeActivityInfo = rechargeStrategyBLL.GetRechargeActivityList(loggingSessionInfo.ClientID, vipCardInfo.VipCardTypeID.ToString(), 3);
                        if (RechargeActivityInfo != null && RechargeActivityInfo.Tables[0].Rows.Count > 0)
                        {
                            rd.RechargeStrategyList = DataTableToObject.ConvertToList <RechargeStrategyInfo>(RechargeActivityInfo.Tables[0]);
                        }
                    }
                }
            }
            return(rd);
        }
Пример #18
0
        protected override GetVipCardProfitRuleListRD ProcessRequest(DTO.Base.APIRequest <GetVipCardProfitRuleListRP> pRequest)
        {
            var rd                 = new GetVipCardProfitRuleListRD();
            var parameter          = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            VipCardProfitRuleBLL            bll         = new VipCardProfitRuleBLL(loggingSessionInfo);
            VipCardProfitRuleUnitMappingBLL UnitService = new VipCardProfitRuleUnitMappingBLL(loggingSessionInfo);

            //获取会员卡销售激励规则
            rd.VipCardProfitRuleList = bll.PagedQueryByEntity(new VipCardProfitRuleEntity()
            {
                CustomerID = loggingSessionInfo.ClientID
            }, null, 100, 1)
                                       .Entities.Select(m => new VipCardProfitRuleInfo()
            {
                ProfitOwner             = m.ProfitOwner,
                CardBuyToProfitRuleId   = m.CardBuyToProfitRuleId,
                VipCardTypeID           = m.VipCardTypeID,
                RechargeProfitPct       = m.RechargeProfitPct,
                IsApplyAllUnits         = m.IsApplyAllUnits,
                FirstRechargeProfitPct  = m.FirstRechargeProfitPct,
                FirstCardSalesProfitPct = m.FirstCardSalesProfitPct,
                CardSalesProfitPct      = m.CardSalesProfitPct
            }
                                                        ).ToList();

            // 按照商户获取 会员卡 续费充值规则
            var VipCardReRechargeProfitRuleDs = bll.GetVipCardReRechargeProfitRuleList(loggingSessionInfo.ClientID);
            var ruleinfolst = DataTableToObject.ConvertToList <VipCardReRechargeProfitRuleInfo>(VipCardReRechargeProfitRuleDs.Tables[0]);


            foreach (var item in rd.VipCardProfitRuleList)
            {
                //会员卡规则 续费充值 方式
                if (ruleinfolst != null)
                {
                    item.VipCardReRechargeProfitRuleList = ruleinfolst.Where(m => m.CardBuyToProfitRuleId == item.CardBuyToProfitRuleId).ToList();
                }

                //获取门店信息 table[0]=上级门店 table[1]=门店信息
                DataSet ds = UnitService.GetAllUnitTypeList(loggingSessionInfo.ClientID, item.CardBuyToProfitRuleId);

                if (ds != null && ds.Tables.Count == 2)
                {
                    //获取会员卡上级 门店 数组
                    List <Organization> parentunitList = DataTableToObject.ConvertToList <Organization>(ds.Tables[0]);
                    //获取会员卡门店信息
                    List <Stores> StoresList = DataTableToObject.ConvertToList <Stores>(ds.Tables[1]);
                    //分组匹配门店信息
                    foreach (var parentunitInfo in parentunitList)
                    {
                        RuleUnitInfoRD unit = new RuleUnitInfoRD()
                        {
                            text = parentunitInfo.unit_name, id = parentunitInfo.src_unit_id
                        };
                        unit.children = StoresList.Where(m => m.src_unit_id == parentunitInfo.src_unit_id).Select(m => new MappingUnitInfo()
                        {
                            text = m.unit_name, id = m.UnitId, MappingUnitId = m.Id
                        }).ToList();
                        item.RuleUnitInfoList.Add(unit);
                    }
                }
            }
            return(rd);
        }
Пример #19
0
        public string GetUserList(string pRequest)
        {
            var rd     = new APIResponse <GetUserRD>();
            var rdData = new GetUserRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <GetUserRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = new LoggingSessionManager().CurrentSession;

            try
            {
                //获取普通员工employee角色标识
                string    roleId        = string.Empty;
                var       appSysService = new AppSysService(loggingSessionInfo);
                RoleModel list          = new RoleModel();
                string    key           = "D8C5FF6041AA4EA19D83F924DBF56F93";
                list = appSysService.GetRolesByAppSysId(key, 1000, 0, "", "", "");

                foreach (var item in list.RoleInfoList)
                {
                    if (item.Role_Code.ToLower() == "employee")
                    {
                        roleId = item.Role_Id;
                        break;
                    }
                }
                if (string.IsNullOrEmpty(roleId) || roleId == "")
                {
                    throw new APIException("employee的roleId未获取到")
                          {
                              ErrorCode = 103
                          }
                }
                ;

                T_UserBLL userBll = new T_UserBLL(loggingSessionInfo);
                //string typeID = System.Configuration.ConfigurationManager.AppSettings["TypeID"].ToString();
                int             totalPage = 0;
                QueryUserEntity entity    = new QueryUserEntity();
                entity.QUserName      = rp.Parameters.Keyword;
                entity.QUnitID        = rp.Parameters.UnitID;
                entity.QJobFunctionID = rp.Parameters.JobFunctionID;
                entity.QRoleID        = roleId;
                DataTable dTable = userBll.GetUserList(rp.Parameters.UserID, rp.Parameters.PageIndex, rp.Parameters.PageSize, out totalPage, entity);

                //排序
                DataView dv   = dTable.DefaultView;
                string   sort = string.IsNullOrEmpty(rp.Parameters.sort) ? "UserEmail asc" : rp.Parameters.sort;
                sort    = "UserStatus desc," + sort;
                dv.Sort = sort;
                DataTable dt2 = dv.ToTable();
                dTable = dt2;


                if (dTable != null)
                {
                    rdData.UserList = DataTableToObject.ConvertToList <UserInfo>(dTable);
                }
                rdData.TotalPage = totalPage;
                rd.Data          = rdData;
                rd.ResultCode    = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            return(rd.ToJSON());
        }
Пример #20
0
        protected override HomePageConfigRD ProcessRequest(DTO.Base.APIRequest <HomePageConfigRP> pRequest)
        {
            //创建连接用户对象
            var logginUserInfo       = base.CurrentUserInfo;
            var param                = pRequest.Parameters;
            HomePageConfigRD resData = new HomePageConfigRD();

            resData.eventList  = new List <EventListEntity>();
            resData.secondKill = new List <EventListEntity>();
            resData.groupBuy   = new List <EventListEntity>();
            resData.hotBuy     = new List <EventListEntity>();
            resData.bargain    = new List <EventListEntity>();

            var bllHome = new MobileHomeBLL(logginUserInfo);
            MobileHomeEntity entityHome = new MobileHomeEntity();;

            if (!string.IsNullOrEmpty(param.HomeId))
            {
                entityHome = bllHome.QueryByEntity(new MobileHomeEntity()
                {
                    CustomerId = logginUserInfo.ClientID, HomeId = new Guid(param.HomeId)
                }, null).FirstOrDefault();
            }
            else
            {
                entityHome = bllHome.QueryByEntity(new MobileHomeEntity()
                {
                    CustomerId = logginUserInfo.ClientID, IsActivate = 1
                }, null).FirstOrDefault();
            }
            if (entityHome == null)
            {
                resData.Success = false;
                resData.ErrMsg  = "商城正在维护1";
                return(resData);
            }
            resData.Success = true;
            string strHomeId = entityHome.HomeId.ToString();

            resData.sortActionJson = entityHome.sortActionJson == null ? "" : entityHome.sortActionJson;//返回排序数据


            #region 广告部分
            List <AdAreaInfo> AdAreaList = new List <AdAreaInfo> {
            };
            var adBll          = new MHAdAreaBLL(logginUserInfo);
            var tempAdArealist = adBll.GetAdByHomeId(strHomeId);
            AdAreaList.AddRange(tempAdArealist.Select(t => new AdAreaInfo
            {
                DisplayIndex = t.DisplayIndex,
                ImageUrl     = t.ImageUrl,
                ObjectID     = t.ObjectId,
                ObjectTypeID = t.ObjectTypeId,
                Url          = t.Url
            }));
            #endregion
            resData.adAreaList = AdAreaList.ToArray();

            #region 搜索框

            var dsSearch = adBll.GetMHSearchArea(strHomeId);//获取搜索框
            if (dsSearch != null && dsSearch.Tables.Count > 0 && dsSearch.Tables[0].Rows.Count > 0)
            {
                resData.search = DataTableToObject.ConvertToObject <MHSearchAreaEntity>(dsSearch.Tables[0].Rows[0]);//转换成一个对象时,里面的参数不能是一个表,而是一行数据
            }

            #endregion

            #region 活动部分
            var adAreaBll    = new MHAdAreaBLL(logginUserInfo);
            var itemEventBll = new MHItemAreaBLL(logginUserInfo);

            var bllCategoryAreaGroup = new MHCategoryAreaGroupBLL(this.CurrentUserInfo);

            var allGroup = bllCategoryAreaGroup.QueryByEntity(new MHCategoryAreaGroupEntity {
                CustomerID = this.CurrentUserInfo.ClientID, HomeId = strHomeId
            }, null);

            var eventGroup = allGroup.Where(a => a.ModelTypeId == 5 || a.ModelTypeId == 6 || a.ModelTypeId == 7 || a.ModelTypeId == 8 || a.ModelTypeId == 9);
            foreach (var item in eventGroup)
            {
                DataSet dsEvent = new DataSet();
                if (item.ModelTypeId == 8)
                {
                    dsEvent = itemEventBll.GetEventListItemDetails(strHomeId, item.GroupId.ToString());//获取EventList
                }
                else
                {
                    dsEvent = itemEventBll.GetItemDetails(strHomeId, item.GroupId.ToString());
                }

                if (dsEvent != null && dsEvent.Tables.Count > 0 && dsEvent.Tables[0].Rows.Count > 0)
                {
                    var dsEventList = DataTableToObject.ConvertToList <ItemEventAreaInfo>(dsEvent.Tables[0]);
                    var category    = new EventListEntity
                    {
                        showStyle    = dsEventList.FirstOrDefault().ShowStyle,
                        shopType     = dsEventList.FirstOrDefault().TypeID,
                        displayIndex = item.DisplayIndex,
                        areaFlag     = dsEventList.FirstOrDefault().areaFlag,
                        arrayList    = dsEventList
                    };

                    if (dsEventList.FirstOrDefault().areaFlag == "eventList")
                    {
                        resData.eventList.Add(category);
                    }
                    if (dsEventList.FirstOrDefault().areaFlag == "secondKill")
                    {
                        resData.secondKill.Add(category);
                    }
                    if (dsEventList.FirstOrDefault().areaFlag == "groupBuy")
                    {
                        resData.groupBuy.Add(category);
                    }
                    if (dsEventList.FirstOrDefault().areaFlag == "hotBuy")
                    {
                        resData.hotBuy.Add(category);
                    }
                    if (dsEventList.FirstOrDefault().areaFlag == "bargain")
                    {
                        resData.bargain.Add(category);
                    }
                }
            }
            #endregion
            List <CategoryGroupInfo> allList = new List <CategoryGroupInfo>();
            eventGroup = allGroup.Where(a => a.ModelTypeId != 5 && a.ModelTypeId != 6 && a.ModelTypeId != 7 && a.ModelTypeId != 8 && a.ModelTypeId != 9 && a.ModelTypeId != 2);

            if (eventGroup != null)
            {
                foreach (var groupItem in eventGroup)
                {
                    var category = new CategoryGroupInfo
                    {
                        groupID          = groupItem.GroupId,
                        CategoryAreaList = new List <CategoryAreaInfo>()
                    };
                    category.modelTypeId    = groupItem.ModelTypeId;
                    category.modelTypeName  = groupItem.ModelName;
                    category.styleType      = groupItem.StyleType;
                    category.titleName      = groupItem.TitleName;
                    category.titleStyle     = groupItem.TitleStyle;
                    category.showCount      = (int)groupItem.ShowCount;
                    category.showName       = (int)groupItem.ShowName;
                    category.showPrice      = (int)groupItem.ShowPrice;
                    category.showSalesPrice = (int)groupItem.ShowSalesPrice;
                    category.showDiscount   = (int)groupItem.ShowDiscount;
                    category.showSalesQty   = (int)groupItem.ShowSalesQty;
                    category.displayIndex   = (int)groupItem.DisplayIndex;


                    //根据groupId和HomeId来取MHCategoryArea
                    if (groupItem.ModelTypeId == 2)
                    {
                    }
                    else
                    {
                    }
                    var dsItem = adAreaBll.GetItemList(category.groupID.ToString(), entityHome.HomeId.ToString());
                    if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0)
                    {
                        category.CategoryAreaList = DataTableToObject.ConvertToList <CategoryAreaInfo>(dsItem.Tables[0]);
                    }
                    allList.Add(category);
                }
            }
            //分类组合
            List <CategoryGroupInfo> lc = allList.Where(p => p.modelTypeId == 1).ToList();
            if (lc != null && lc.Count != 0)
            {
                resData.categoryEntrance = lc.OrderByDescending(p => p.groupID).ToList()[0];;
            }


            //创意组合
            if (allList.Where(p => p.modelTypeId == 3).ToList() != null && allList.Where(p => p.modelTypeId == 3).ToList().Count != 0)
            {
                resData.originalityList = allList.Where(p => p.modelTypeId == 3).ToList();
            }
            //导航
            List <CategoryGroupInfo> lc4 = allList.Where(p => p.modelTypeId == 4).ToList();
            if (lc4 != null && lc4.Count != 0)
            {
                resData.navList = lc4.OrderByDescending(p => p.groupID).ToList()[0];; //(获取唯一的)
            }
            //商品列表
            eventGroup = allGroup.Where(a => a.ModelTypeId == 2);
            List <ProductListInfo> productList = new List <ProductListInfo>();
            if (eventGroup != null)
            {
                foreach (var groupItem in eventGroup)
                {
                    var category = new ProductListInfo
                    {
                        CategoryAreaList = new List <ProductInfo>()
                    };
                    category.modelTypeId    = groupItem.ModelTypeId;
                    category.modelTypeName  = groupItem.ModelName;
                    category.styleType      = groupItem.StyleType;
                    category.titleName      = groupItem.TitleName;
                    category.titleStyle     = groupItem.TitleStyle;
                    category.showCount      = (int)groupItem.ShowCount;
                    category.showName       = (int)groupItem.ShowName;
                    category.showPrice      = (int)groupItem.ShowPrice;
                    category.showSalesPrice = (int)groupItem.ShowSalesPrice;
                    category.showDiscount   = (int)groupItem.ShowDiscount;
                    category.showSalesQty   = (int)groupItem.ShowSalesQty;
                    category.displayIndex   = (int)groupItem.DisplayIndex;

                    MHCategoryAreaBLL bllCategoryArea = new MHCategoryAreaBLL(logginUserInfo);
                    int     intObjectId = bllCategoryArea.GetObjectTypeIDByGroupId((int)groupItem.GroupId);
                    DataSet dsItem      = null;
                    if (intObjectId == 4)
                    {
                        dsItem = adAreaBll.GetGroupProductList(groupItem.GroupId.ToString(), entityHome.HomeId.ToString(), category.showCount);
                    }
                    else
                    {
                        dsItem = adAreaBll.GetCategoryProductList(groupItem.GroupId.ToString(), entityHome.HomeId.ToString(), category.showCount);
                    }

                    if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0)
                    {
                        category.CategoryAreaList = DataTableToObject.ConvertToList <ProductInfo>(dsItem.Tables[0]);
                    }
                    productList.Add(category);
                }
            }


            if (productList != null && productList.Count != 0)
            {
                resData.productList = productList.ToList();;
            }
            #region 关注信息

            var bllFollow = new MHFollowBLL(CurrentUserInfo);
            var entity    = new MHFollowEntity();

            var dsFollow = bllFollow.QueryByEntity(new MHFollowEntity()
            {
                HomeId = strHomeId
            }, null);
            followInfo follow = new followInfo();
            follow = dsFollow.Select(f => new followInfo()
            {
                HomeId    = f.HomeId,
                FollowId  = f.FollowId.ToString(),
                Title     = f.Title,
                TextId    = f.TextId,
                TextTitle = f.TextTitle,
                Url       = f.Url,
                TypeId    = f.TypeId
            }).FirstOrDefault();
            resData.follow = follow;
            #endregion
            return(resData);
        }
        protected override GetVipCardTypeVirtualItemRD ProcessRequest(DTO.Base.APIRequest <GetVipCardTypeVirtualItemRP> pRequest)
        {
            var rd   = new GetVipCardTypeVirtualItemRD();
            var para = pRequest.Parameters;
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            var vipBLL               = new VipBLL(loggingSessionInfo);
            var vipIntegralBLL       = new VipIntegralBLL(loggingSessionInfo);
            var sysVipCardTypeBLL    = new SysVipCardTypeBLL(loggingSessionInfo);
            var vipCardVipMappingBLL = new VipCardVipMappingBLL(loggingSessionInfo);
            var vipCardBLL           = new VipCardBLL(loggingSessionInfo);
            var vipCardRuleBLL       = new VipCardRuleBLL(loggingSessionInfo);
            var vipT_InoutBLL        = new T_InoutBLL(loggingSessionInfo);
            List <VipCardUpgradeRewardInfo> VipCardUpgradeRewardList = new List <VipCardUpgradeRewardInfo>();
            List <VipCardTypeRelateInfo>    VipCardTypeRelateList    = new List <VipCardTypeRelateInfo>();
            //获取当前会员卡等级
            VipEntity VipInfo         = null;
            int?      CurVipCardLevel = 0;
            //处理会员开卡礼信息
            var VipCardUpgradeRewardInfoList = sysVipCardTypeBLL.GetCardUpgradeRewardList(loggingSessionInfo.ClientID);
            //定义卡体系信息
            DataSet VipCardTypeSystemInfoList = null;
            string  strVipID = string.Empty;

            switch (para.ApplicationType)
            {
            //为1是微信,为2时表示APP请求
            case "1":    //微信
                strVipID = pRequest.UserID;
                break;

            case "2":                  //APP
                strVipID = para.VipID; //获取会员信息
                break;
            }

            VipInfo = vipBLL.GetByID(strVipID);//获取会员信息
            if (VipInfo != null)
            {
                rd.HeadImgUrl = VipInfo.HeadImgUrl == null ? "" : VipInfo.HeadImgUrl;
                var vipIntegralInfo = vipIntegralBLL.QueryByEntity(new VipIntegralEntity()
                {
                    VipID = strVipID, VipCardCode = VipInfo.VipCode
                }, null).FirstOrDefault();
                if (vipIntegralInfo != null)//获取当前会员积分
                {
                    rd.Integration = vipIntegralInfo.ValidIntegral != null ? vipIntegralInfo.ValidIntegral.Value : 0;
                }
                //获取会员卡等级相关信息
                var vipCardMappingInfo = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
                {
                    VIPID = strVipID, CustomerID = loggingSessionInfo.ClientID
                },
                                                                            new OrderBy[] { new OrderBy()
                                                                                            {
                                                                                                FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                            } }).FirstOrDefault();
                if (vipCardMappingInfo != null)
                {
                    var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                    {
                        VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                    }, null).FirstOrDefault();
                    if (vipCardInfo != null)
                    {
                        var vipCardTypeInfo = sysVipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                        {
                            VipCardTypeID = vipCardInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (vipCardTypeInfo != null)//获取当前会员卡等级信息
                        {
                            rd.VipCardTypeName = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                            rd.VipCardLevel    = vipCardTypeInfo.VipCardLevel;
                            CurVipCardLevel    = vipCardTypeInfo.VipCardLevel;
                        }
                    }
                }
                else
                {
                    var vipCardTypeInfo = sysVipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                    {
                        VipCardLevel = 1, CustomerID = loggingSessionInfo.ClientID
                    }, null).FirstOrDefault();
                    if (vipCardTypeInfo != null)
                    {
                        rd.VipCardTypeName = vipCardTypeInfo.VipCardTypeName != null ? vipCardTypeInfo.VipCardTypeName : "";
                        rd.VipCardLevel    = vipCardTypeInfo.VipCardLevel != null ? vipCardTypeInfo.VipCardLevel : 1;
                        CurVipCardLevel    = vipCardTypeInfo.VipCardLevel != null ? vipCardTypeInfo.VipCardLevel : 1;
                    }
                }
                //获取会员消费金额
                decimal VipConsumptionInfo = vipT_InoutBLL.GetVipSumAmount(strVipID);
                if (VipConsumptionInfo > 0)
                {
                    rd.VipConsumptionAmount = Convert.ToDecimal(VipConsumptionInfo).ToString("0.00");
                }
                else
                {
                    rd.VipConsumptionAmount = "0";
                }
                //获取卡等级相关信息(会员卡等级信息、升级条件、基本权益关联虚拟商品)
                VipCardTypeSystemInfoList = sysVipCardTypeBLL.GetVipCardTypeVirtualItemList(loggingSessionInfo.ClientID, CurVipCardLevel, para.ApplicationType, VipInfo.VIPID);
            }


            if (VipCardTypeSystemInfoList != null && VipCardTypeSystemInfoList.Tables[0].Rows.Count > 0)
            {
                int flag = 0;//定义下面开卡礼能否进行展示(0=不进,1=进)
                if (VipCardUpgradeRewardInfoList != null && VipCardUpgradeRewardInfoList.Tables[0].Rows.Count > 0)
                {
                    flag = 1;
                    //获取开卡礼信息 为之后筛选数据使用
                    VipCardUpgradeRewardList = DataTableToObject.ConvertToList <VipCardUpgradeRewardInfo>(VipCardUpgradeRewardInfoList.Tables[0]);
                }
                var dt = VipCardTypeSystemInfoList.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    var DataInfo = new VipCardTypeRelateInfo();
                    //VipCardTypeRelateList = new List<VipCardTypeRelateInfo>();
                    DataInfo.VipCardType              = new VipCardTypeInfo();        //会员卡体系
                    DataInfo.VipCardUpgradeRule       = new VipCardUpgradeRuleInfo(); //会员卡升级规则
                    DataInfo.VipCardRule              = new VipCardRuleInfo();        //会员卡基本体系
                    DataInfo.VipCardUpgradeRewardList = new List <VipCardUpgradeRewardInfo>();
                    //var VipCardTypeData = new VipCardTypeInfo();
                    //给会员卡等级赋值
                    DataInfo.VipCardType.VipCardTypeID   = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardType.VipCardLevel    = Convert.ToInt32(dr["VipCardLevel"]);
                    DataInfo.VipCardType.VipCardTypeName = dr["VipCardTypeName"].ToString();
                    DataInfo.VipCardType.PicUrl          = dr["PicUrl"].ToString();
                    DataInfo.VipCardType.IsPrepaid       = Convert.ToInt32(dr["IsPrepaid"]);
                    DataInfo.VipCardType.IsOnlineSales   = Convert.ToInt32(dr["IsOnlineSales"]);
                    DataInfo.VipCardType.ItemID          = dr["ItemID"].ToString();
                    DataInfo.VipCardType.SkuID           = dr["SkuID"].ToString();
                    int cardStatus = 0;
                    //获取卡状态购买信息 0=没购买,1=已购买 pRequest.UserID
                    if (DataInfo.VipCardType.IsPrepaid != 1)//非可储值类型关联订单
                    {
                        cardStatus = vipT_InoutBLL.GetVirtualItemStatus(loggingSessionInfo.ClientID, strVipID, DataInfo.VipCardType.SkuID);
                    }
                    else//可储值类型关联充值订单
                    {
                        var RechargeOrderBll  = new RechargeOrderBLL(loggingSessionInfo);
                        var RechargeOrderInfo = RechargeOrderBll.QueryByEntity(new RechargeOrderEntity()
                        {
                            OrderDesc = "Upgrade", VipID = strVipID, VipCardTypeId = DataInfo.VipCardType.VipCardTypeID, Status = 1
                        }, null).FirstOrDefault();
                        if (RechargeOrderInfo != null)//如果为空需要在订单表里查找下记录
                        {
                            cardStatus = 1;
                        }
                        else
                        {
                            cardStatus = vipT_InoutBLL.GetVirtualItemStatus(loggingSessionInfo.ClientID, strVipID, DataInfo.VipCardType.SkuID);
                        }
                    }

                    DataInfo.VipCardType.Status = cardStatus;
                    //var VipCardUpgradeRuleData = new VipCardUpgradeRuleInfo();
                    DataInfo.VipCardUpgradeRule.VipCardTypeID        = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardUpgradeRule.VipCardUpgradeRuleId = dr["VipCardUpgradeRuleId"].ToString();
                    DataInfo.VipCardUpgradeRule.IsPurchaseUpgrade    = Convert.ToInt32(dr["IsPurchaseUpgrade"]);
                    DataInfo.VipCardUpgradeRule.IsExtraMoney         = Convert.ToInt32(dr["IsExtraMoney"]);
                    DataInfo.VipCardUpgradeRule.Prices             = Convert.ToDecimal(dr["Prices"]);
                    DataInfo.VipCardUpgradeRule.ExchangeIntegral   = Convert.ToInt32(dr["ExchangeIntegral"]);
                    DataInfo.VipCardUpgradeRule.IsRecharge         = Convert.ToInt32(dr["IsRecharge"]);
                    DataInfo.VipCardUpgradeRule.OnceRechargeAmount = Convert.ToDecimal(dr["OnceRechargeAmount"]);
                    DataInfo.VipCardUpgradeRule.IsBuyUpgrade       = Convert.ToInt32(dr["IsBuyUpgrade"]);
                    DataInfo.VipCardUpgradeRule.BuyAmount          = Convert.ToDecimal(dr["BuyAmount"]);
                    DataInfo.VipCardUpgradeRule.OnceBuyAmount      = Convert.ToDecimal(dr["OnceBuyAmount"]);

                    //var VipCardRuleData = new VipCardUpgradeRuleInfo();
                    DataInfo.VipCardRule.VipCardTypeID        = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardRule.RuleID               = Convert.ToInt32(dr["RuleID"]);
                    DataInfo.VipCardRule.CardDiscount         = Convert.ToDecimal(dr["CardDiscount"]);
                    DataInfo.VipCardRule.PaidGivePercetPoints = Convert.ToDecimal(dr["PaidGivePercetPoints"]);
                    DataInfo.VipCardRule.PaidGivePoints       = Convert.ToDecimal(dr["PaidGivePoints"]);
                    if (flag == 1)//当flag=1的时候进行开卡礼的展示
                    {
                        DataInfo.VipCardUpgradeRewardList = VipCardUpgradeRewardList.Where(m => m.VipCardTypeID == Convert.ToInt32(dr["VipCardTypeID"])).Select(
                            t => new VipCardUpgradeRewardInfo()
                        {
                            CardUpgradeRewardId = t.CardUpgradeRewardId,
                            VipCardTypeID       = t.VipCardTypeID,
                            CouponTypeID        = t.CouponTypeID,
                            CouponNum           = t.CouponNum,
                            CouponName          = t.CouponName,
                            ValidityPeriod      = t.BeginTime == null ? ("领取后" + (t.ServiceLife == 0 ? "1天内有效" : t.ServiceLife.ToString() + "天内有效")) : (t.BeginTime.Value.ToString("yyyy-MM-dd") + "至" + t.EndTime.Value.ToString("yyyy-MM-dd")),
                            BeginTime           = t.BeginTime,
                            EndTime             = t.EndTime,
                            BeginTimeDate       = t.BeginTime == null ? "" : t.BeginTime.Value.ToString("yyyy年MM月dd日"),
                            EndTimeDate         = t.EndTime == null ? "" : t.EndTime.Value.ToString("yyyy年MM月dd日"),
                            ServiceLife         = t.ServiceLife,
                            CouponDesc          = t.CouponDesc,
                            ParValue            = t.ParValue
                        }).ToList();
                    }
                    VipCardTypeRelateList.Add(DataInfo);
                }
                rd.VipCardTypeItemList = VipCardTypeRelateList;
            }
            return(rd);
        }
Пример #22
0
        public string GetEventMerchandise(string pRequest)
        {
            EventMerchandiseRD rd = new EventMerchandiseRD();

            try
            {
                var rp = pRequest.DeserializeJSONTo <APIRequest <EventMerchandiseRP> >();

                //var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
                var     loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
                var     bll = new PanicbuyingEventSkuMappingBLL(loggingSessionInfo);
                DataSet ds  = bll.GetEventMerchandise(rp.Parameters.EventId);
                if (ds.Tables.Count > 0 && ds.Tables[0] != null)
                {
                    rd.ItemList = DataTableToObject.ConvertToList <Item>(ds.Tables[0]);

                    foreach (var item in rd.ItemList)
                    {
                        DataSet skuds = bll.GetGetEventMerchandiseSku(item.EventItemMappingId.ToString());
                        if (skuds.Tables.Count > 0 && skuds.Tables[0] != null)
                        {
                            item.SkuList = DataTableToObject.ConvertToList <Sku>(skuds.Tables[0]);
                        }
                    }
                }

                //查询
                var eventBll  = new PanicbuyingEventBLL(loggingSessionInfo);
                var tempEvent = eventBll.GetPanicbuyingEventDetails(rp.Parameters.EventId);
                PanicbuyingEvent eventEntity = new PanicbuyingEvent();
                eventEntity.EventId     = tempEvent.EventId;
                eventEntity.EventName   = tempEvent.EventName;
                eventEntity.EventTypeId = tempEvent.EventTypeId;
                eventEntity.BeginTime   = tempEvent.BeginTime.ToString("yyyy-MM-dd HH:mm");
                eventEntity.EndTime     = tempEvent.EndTime.ToString("yyyy-MM-dd HH:mm");
                eventEntity.CustomerID  = tempEvent.CustomerID;
                eventEntity.Qty         = tempEvent.Qty;
                eventEntity.RemainQty   = tempEvent.RemainQty;
                eventEntity.EventStatus = tempEvent.EventStatus.ToString();
                //倒计时
                //   TimeSpan nowSpan = tempEvent.EndTime - DateTime.Now;//应该是结束时间减去当前时间
                //  eventEntity.DeadlineSecond =  nowSpan.TotalSeconds<=0?0:  Convert.ToInt32( nowSpan.TotalSeconds);


                rd.TimeFlag = "begin";
                if (tempEvent.BeginTime > DateTime.Now)
                {
                    TimeSpan nowSpan = tempEvent.BeginTime - DateTime.Now;//应该是结束时间减去当前时间
                    eventEntity.DeadlineSecond = nowSpan.TotalSeconds <= 0 ? 0 : Convert.ToInt32(nowSpan.TotalSeconds);
                    if (eventEntity.DeadlineSecond > 0)
                    {
                        eventEntity.DeadlineTime = nowSpan.Days + "天" + nowSpan.Hours + "时" + nowSpan.Minutes + "分" + nowSpan.Seconds;
                    }
                    else
                    {
                        eventEntity.DeadlineTime = 0 + "天" + 0 + "时" + 0 + "分" + 0;
                    }
                }
                else
                {
                    rd.TimeFlag = "end";
                    TimeSpan nowSpan = tempEvent.EndTime - DateTime.Now;//应该是结束时间减去当前时间
                    eventEntity.DeadlineSecond = nowSpan.TotalSeconds <= 0 ? 0 : Convert.ToInt32(nowSpan.TotalSeconds);

                    if (eventEntity.DeadlineSecond > 0)
                    {
                        eventEntity.DeadlineTime = nowSpan.Days + "天" + nowSpan.Hours + "时" + nowSpan.Minutes + "分" + nowSpan.Seconds;
                    }
                    else
                    {
                        eventEntity.DeadlineTime = 0 + "天" + 0 + "时" + 0 + "分" + 0;
                    }
                }
                rd.BeginTime = tempEvent.BeginTime.ToString("MM月dd日");



                rd.PanicbuyingEvent = eventEntity;


                var rsp = new SuccessResponse <IAPIResponseData>(rd);
                return(rsp.ToJSON());
            }
            catch (Exception ex)
            {
                throw new APIException(ex.Message);
            }
            //return "{\"ResultCode\":0,\"Message\":\"OK\",\"Data\":{\"ItemList\":[{\"ItemID\":\"22\",\"ItemName\":\"美的\",\"ImageUrl\":\"http://www.o2omarketing.cn: 8400/Framework/Javascript/Other/kindeditor/attached/image/lzlj/album1.jpg\",\"SkuList\":[{\"kuID\":\"1111\",\"SkuName\":\"138L(银灰色)\",\"Qty\":\"250\",\"KeepQty\":\"200\",\"SoldQty\":\"30\",\"InverTory\":\"20\"}]}]}}";
        }
Пример #23
0
        protected override GetSysVipCardTypeByLevelRD ProcessRequest(DTO.Base.APIRequest <GetSysVipCardTypeByLevelRP> pRequest)
        {
            LoggingSessionInfo      loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            SysVipCardTypeBLL       bll = new SysVipCardTypeBLL(loggingSessionInfo);
            VipCardRuleBLL          VipCardRuleService          = new VipCardRuleBLL(loggingSessionInfo);
            VipCardUpgradeRewardBLL VipCardUpgradeRewardService = new VipCardUpgradeRewardBLL(loggingSessionInfo);
            var rd         = new GetSysVipCardTypeByLevelRD();
            var parameter  = pRequest.Parameters;
            int?CardTypeId = 0;
            //获取等级为1的会员卡
            var model = bll.QueryByEntity(new SysVipCardTypeEntity()
            {
                CustomerID = loggingSessionInfo.ClientID, VipCardLevel = parameter.Level, IsDelete = 0
            }, null).FirstOrDefault();

            if (model != null)
            {
                //获取等级为1的升级规则信息
                var cardrulemodel = VipCardRuleService.QueryByEntity(new VipCardRuleEntity()
                {
                    VipCardTypeID = model.VipCardTypeID
                }, null).FirstOrDefault();
                if (cardrulemodel != null)
                {
                    CardTypeId = cardrulemodel.VipCardTypeID;
                    WXVipCardUpgradeRewardInfo _model = new WXVipCardUpgradeRewardInfo();

                    _model.VipCardTypeName = model.VipCardTypeName;
                    _model.Type            = 1;
                    if (cardrulemodel.CardDiscount > 0) //会员折扣
                    {
                        _model.Title          = "会员折扣";
                        _model.ImagesUrl      = "../../../images/common/vipCard/cardLegal.png";
                        _model.CouponTypeName = (Convert.ToDouble(cardrulemodel.CardDiscount) / 10.0).ToString("0.0") + "折";
                        rd.VipCardUpgradeRewardInfoList.Add(_model);
                    }

                    _model = new WXVipCardUpgradeRewardInfo();
                    _model.VipCardTypeName = model.VipCardTypeName;
                    _model.Type            = 1;
                    if (cardrulemodel.PaidGivePercetPoints > 0) //消费返积分
                    {
                        _model.Title          = "消费返积分";
                        _model.ImagesUrl      = "../../../images/common/vipCard/cardLegal2.png";
                        _model.CouponTypeName = Convert.ToInt32(cardrulemodel.PaidGivePercetPoints) + "%";
                        rd.VipCardUpgradeRewardInfoList.Add(_model);
                    }

                    if (cardrulemodel.PaidGivePoints > 0) //消费返积分
                    {
                        _model.Title          = "消费返积分";
                        _model.ImagesUrl      = "../../../images/common/vipCard/cardLegal2.png";
                        _model.CouponTypeName = "每" + Convert.ToInt32(cardrulemodel.PaidGivePoints) + "元获1积分";
                        rd.VipCardUpgradeRewardInfoList.Add(_model);
                    }
                }
            }
            //获取开卡礼
            var VipCardUpgradeRewardDs = VipCardUpgradeRewardService.GetVipCardUpgradeRewardList(CardTypeId, loggingSessionInfo.ClientID);

            if (VipCardUpgradeRewardDs != null && VipCardUpgradeRewardDs.Tables[0].Rows.Count > 0)
            {
                rd.VipCardUpgradeRewardInfoList.AddRange(DataTableToObject.ConvertToList <WXVipCardUpgradeRewardInfo>(VipCardUpgradeRewardDs.Tables[0]));
            }
            return(rd);
        }
Пример #24
0
        public void SalesItemsListExport(HttpContext pContext)
        {
            string          LeventId         = pContext.Request.QueryString["ctweventId"];
            T_CTW_LEventBLL _T_CTW_LEventBLL = new JIT.CPOS.BS.BLL.T_CTW_LEventBLL(CurrentUserInfo);

            DataSet ds = _T_CTW_LEventBLL.GeEventItemList(LeventId, 10000, 1, CurrentUserInfo.ClientID);
            List <EventItemInfo> eventItemInfo = new List <EventItemInfo>();

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[1] != null && ds.Tables[1].Columns.Count > 0)
                {
                    eventItemInfo = DataTableToObject.ConvertToList <EventItemInfo>(ds.Tables[1]);
                }
            }
            if (eventItemInfo != null)
            {
                string MapUrl            = pContext.Server.MapPath(@"~/Framework/Upload/销售商品清单" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.ms") + ".xls");
                Aspose.Cells.License lic = new Aspose.Cells.License();
                lic.SetLicense("Aspose.Total.lic");
                Workbook  workbook      = new Workbook();
                Worksheet sheetOne      = workbook.Worksheets[0];
                Cells     sheetOneCells = sheetOne.Cells;//单元格

                #region excel初始化
                //为标题设置样式
                Style styleTitle = workbook.Styles[workbook.Styles.Add()]; //新增样式
                styleTitle.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                styleTitle.Font.Name           = "宋体";                     //文字字体
                styleTitle.Font.Size           = 18;                       //文字大小
                styleTitle.Font.IsBold         = true;                     //粗体

                //样式2
                Style style2 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                style2.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                style2.Font.Name           = "宋体";                     //文字字体
                style2.Font.Size           = 14;                       //文字大小
                style2.Font.IsBold         = true;                     //粗体
                style2.IsTextWrapped       = true;                     //单元格内容自动换行
                style2.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                style2.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                style2.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                style2.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;

                //样式3
                Style style3 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                style3.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                style3.Font.Name           = "宋体";                     //文字字体
                style3.Font.Size           = 12;                       //文字大小
                style3.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                style3.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                style3.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                style3.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
                #endregion

                sheetOneCells.Merge(0, 0, 1, 9);        //合并单元格
                sheetOneCells[0, 0].PutValue("销售商品清单"); //填写内容
                sheetOneCells[0, 0].SetStyle(styleTitle);
                sheetOneCells.SetRowHeight(0, 38);
                for (int i = 0; i < 9; i++)
                {
                    sheetOneCells[1, i].SetStyle(style2);
                    sheetOneCells.SetColumnWidth(i, 30);
                }
                sheetOneCells.SetRowHeight(1, 25);

                sheetOneCells[1, 0].PutValue("商品名称");
                sheetOneCells[1, 1].PutValue("规格");
                sheetOneCells[1, 2].PutValue("原价");
                sheetOneCells[1, 3].PutValue("团购价");
                sheetOneCells[1, 4].PutValue("已售数量");
                sheetOneCells[1, 5].PutValue("总销售额");
                sheetOneCells[1, 6].PutValue("团购库存剩余");


                for (int i = 0; i < eventItemInfo.Count; i++)
                {
                    sheetOneCells[i + 2, 0].PutValue(eventItemInfo[i].item_name);
                    sheetOneCells[i + 2, 0].SetStyle(style3);

                    sheetOneCells[i + 2, 1].PutValue(eventItemInfo[i].SkuName);
                    sheetOneCells[i + 2, 1].SetStyle(style3);

                    sheetOneCells[i + 2, 2].PutValue(eventItemInfo[i].price);
                    sheetOneCells[i + 2, 2].SetStyle(style3);

                    sheetOneCells[i + 2, 3].PutValue(eventItemInfo[i].SalesPrice);
                    sheetOneCells[i + 2, 3].SetStyle(style3);

                    sheetOneCells[i + 2, 4].PutValue(eventItemInfo[i].SoldQty);
                    sheetOneCells[i + 2, 4].SetStyle(style3);

                    sheetOneCells[i + 2, 5].PutValue(eventItemInfo[i].TotalSales);
                    sheetOneCells[i + 2, 5].SetStyle(style3);

                    sheetOneCells[i + 2, 6].PutValue(eventItemInfo[i].InverTory);
                    sheetOneCells[i + 2, 6].SetStyle(style3);

                    sheetOneCells.SetRowHeight(2 + i, 24);
                }

                workbook.Save(MapUrl);
                Utils.OutputExcel(pContext, MapUrl);//输出Excel文件
            }
        }
Пример #25
0
        /// <summary>
        /// 保存商品分类
        /// </summary>
        public string SaveItemCategory()
        {
            var responseData = new ResponseData();

            int    modelTypeId   = (Int32)Utils.GetIntVal(FormatParamValue(Request("modelTypeId")));
            string modelTypeName = FormatParamValue(Request("modelTypeName"));

            if (modelTypeId == 0)
            {
                responseData.success = false;
                responseData.msg     = "模板ID不能为空";
                return(responseData.ToJSON());
            }

            if (string.IsNullOrEmpty(modelTypeName))
            {
                responseData.success = false;
                responseData.msg     = "模板名称不能为空";
                return(responseData.ToJSON());
            }

            var itemCategory = this.CurrentContext.Request["categoryList"].DeserializeJSONTo <List <ItemCategoryEntity> >();

            if (itemCategory != null && itemCategory.Count > 0)
            {
                //分组ID
                var groupId         = itemCategory.FirstOrDefault().groupId;
                var adAreaBll       = new MHAdAreaBLL(this.CurrentUserInfo);
                var categoryAreaBll = new MHCategoryAreaBLL(this.CurrentUserInfo);
                var homeBll         = new MobileHomeBLL(this.CurrentUserInfo);
                var homeList        = homeBll.QueryByEntity(new MobileHomeEntity {
                    CustomerId = this.CurrentUserInfo.ClientID
                }, null);
                var homeId = homeList.FirstOrDefault().HomeId;

                if (homeList != null && homeList.Length > 0)
                {
                    //判断groupId是否为空,为空则新增,不为空则更新
                    //如果新增,则传入 模板ID,修改则不需要传入模板ID
                    if (groupId == 0 || string.IsNullOrEmpty(groupId.ToString()))
                    {
                        //查找表中最大的groupid
                        groupId = categoryAreaBll.GetMaxGroupId();
                        //在此基础上对groupid+1
                        groupId++;
                        InsertItemCategory(itemCategory, groupId);
                    }
                    else
                    {
                        UpdateItemCategory(itemCategory);
                    }

                    var mHCategoryAreaGroup = new MHCategoryAreaGroupBLL(this.CurrentUserInfo);
                    var categoryAreaGroup   = mHCategoryAreaGroup.QueryByEntity(new MHCategoryAreaGroupEntity()
                    {
                        GroupValue = groupId,
                        CustomerID = this.CurrentUserInfo.ClientID
                    }, null);

                    var categoryAreaGroupEntity = new MHCategoryAreaGroupEntity()
                    {
                        ModelTypeId = modelTypeId,
                        ModelName   = modelTypeName,
                        GroupValue  = groupId,
                        CustomerID  = this.CurrentUserInfo.ClientID
                    };
                    if (categoryAreaGroup == null || !categoryAreaGroup.Any())
                    {
                        categoryAreaGroupEntity.GroupId = mHCategoryAreaGroup.GetMaxGroupId();
                        mHCategoryAreaGroup.Create(categoryAreaGroupEntity);
                    }
                    else
                    {
                        categoryAreaGroupEntity.GroupId = categoryAreaGroup[0].GroupId;
                        mHCategoryAreaGroup.Update(categoryAreaGroupEntity);
                    }
                }
                else
                {
                    responseData.success = false;
                    responseData.msg     = "没有查询到对应首页主表的数据";
                    return(responseData.ToJSON());
                }



                #region 返回商品分类数据

                var content = new CategoryEntity();  //商品分类

                //获取分组ID
                content.modelTypeId   = modelTypeId;
                content.modelTypeName = modelTypeName;
                content.groupId       = groupId.ToString();
                content.itemList      = new List <ItemEntity>();

                var dsItem = adAreaBll.GetItemList(content.groupId, homeId.ToString());
                if (dsItem != null && dsItem.Tables.Count > 0 && dsItem.Tables[0].Rows.Count > 0)
                {
                    content.itemList = DataTableToObject.ConvertToList <ItemEntity>(dsItem.Tables[0]);
                }

                #endregion

                responseData.success = true;
                responseData.data    = content;
                return(responseData.ToJSON());
            }
            else
            {
                responseData.success = false;
                responseData.data    = "查无数据";
                return(responseData.ToJSON());
            }
        }
Пример #26
0
        public void GivingOutAwardsListExport(HttpContext pContext)
        {
            string          LeventId         = pContext.Request.QueryString["ctweventId"];
            T_CTW_LEventBLL _T_CTW_LEventBLL = new JIT.CPOS.BS.BLL.T_CTW_LEventBLL(CurrentUserInfo);

            DataSet ds = _T_CTW_LEventBLL.GetEventPrizeDetailList(LeventId, 10000, 1, CurrentUserInfo.ClientID);//订单导出,记录数0-60000
            List <EventPrizeDetailInfo> eventPrizeDetailInfo = new List <EventPrizeDetailInfo>();

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[1] != null && ds.Tables[1].Columns.Count > 0)
                {
                    eventPrizeDetailInfo = DataTableToObject.ConvertToList <EventPrizeDetailInfo>(ds.Tables[1]);
                }
            }

            if (eventPrizeDetailInfo != null)
            {
                string MapUrl            = pContext.Server.MapPath(@"~/Framework/Upload/奖品发放清单" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.ms") + ".xls");
                Aspose.Cells.License lic = new Aspose.Cells.License();
                lic.SetLicense("Aspose.Total.lic");
                Workbook  workbook      = new Workbook();
                Worksheet sheetOne      = workbook.Worksheets[0];
                Cells     sheetOneCells = sheetOne.Cells;//单元格

                #region excel初始化
                //为标题设置样式
                Style styleTitle = workbook.Styles[workbook.Styles.Add()]; //新增样式
                styleTitle.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                styleTitle.Font.Name           = "宋体";                     //文字字体
                styleTitle.Font.Size           = 18;                       //文字大小
                styleTitle.Font.IsBold         = true;                     //粗体

                //样式2
                Style style2 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                style2.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                style2.Font.Name           = "宋体";                     //文字字体
                style2.Font.Size           = 14;                       //文字大小
                style2.Font.IsBold         = true;                     //粗体
                style2.IsTextWrapped       = true;                     //单元格内容自动换行
                style2.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                style2.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                style2.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                style2.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;

                //样式3
                Style style3 = workbook.Styles[workbook.Styles.Add()]; //新增样式
                style3.HorizontalAlignment = TextAlignmentType.Center; //文字居中
                style3.Font.Name           = "宋体";                     //文字字体
                style3.Font.Size           = 12;                       //文字大小
                style3.Borders[BorderType.LeftBorder].LineStyle   = CellBorderType.Thin;
                style3.Borders[BorderType.RightBorder].LineStyle  = CellBorderType.Thin;
                style3.Borders[BorderType.TopBorder].LineStyle    = CellBorderType.Thin;
                style3.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
                #endregion

                sheetOneCells.Merge(0, 0, 1, 5);        //合并单元格
                sheetOneCells[0, 0].PutValue("奖品发放清单"); //填写内容
                sheetOneCells[0, 0].SetStyle(styleTitle);
                sheetOneCells.SetRowHeight(0, 38);
                for (int i = 0; i < 5; i++)
                {
                    sheetOneCells[1, i].SetStyle(style2);
                    sheetOneCells.SetColumnWidth(i, 30);
                }
                sheetOneCells.SetRowHeight(1, 25);

                sheetOneCells[1, 0].PutValue("奖品名称");
                sheetOneCells[1, 1].PutValue("中奖人");
                sheetOneCells[1, 2].PutValue("中奖时间");
                sheetOneCells[1, 3].PutValue("是否使用");
                sheetOneCells[1, 4].PutValue("是否关注");

                for (int i = 0; i < eventPrizeDetailInfo.Count; i++)
                {
                    sheetOneCells[i + 2, 0].PutValue(eventPrizeDetailInfo[i].Name);
                    sheetOneCells[i + 2, 0].SetStyle(style3);

                    sheetOneCells[i + 2, 1].PutValue(eventPrizeDetailInfo[i].vipname);
                    sheetOneCells[i + 2, 1].SetStyle(style3);

                    sheetOneCells[i + 2, 2].PutValue(eventPrizeDetailInfo[i].winTime);
                    sheetOneCells[i + 2, 2].SetStyle(style3);

                    sheetOneCells[i + 2, 3].PutValue(eventPrizeDetailInfo[i].PrizeUsed == "1" ? "已使用":"未使用");
                    sheetOneCells[i + 2, 3].SetStyle(style3);

                    sheetOneCells[i + 2, 4].PutValue(eventPrizeDetailInfo[i].subscribe == "1" ? "已关注":"未关注");
                    sheetOneCells[i + 2, 4].SetStyle(style3);

                    sheetOneCells.SetRowHeight(2 + i, 24);
                }

                workbook.Save(MapUrl);
                Utils.OutputExcel(pContext, MapUrl);//输出Excel文件
            }
        }
Пример #27
0
        protected override GetVipCardTypeSystemRD ProcessRequest(DTO.Base.APIRequest <EmptyRequestParameter> pRequest)
        {
            var rd = new GetVipCardTypeSystemRD();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            //声明卡等级相关逻辑
            var bllVipCardType = new SysVipCardTypeBLL(loggingSessionInfo);
            //获取卡等级相关信息(会员卡等级信息、升级条件、基本权益)
            var VipCardTypeSystemInfoList = bllVipCardType.GetVipCardTypeSystemList(loggingSessionInfo.ClientID);
            //处理会员开卡礼信息
            var VipCardUpgradeRewardInfoList = bllVipCardType.GetCardUpgradeRewardList(loggingSessionInfo.ClientID);
            List <VipCardUpgradeRewardInfo> VipCardUpgradeRewardList = new List <VipCardUpgradeRewardInfo>();
            List <VipCardTypeRelateInfo>    VipCardTypeRelateList    = new List <VipCardTypeRelateInfo>();

            if (VipCardTypeSystemInfoList != null && VipCardTypeSystemInfoList.Tables[0].Rows.Count > 0)
            {
                int flag = 0;//定义下面开卡礼能否进行循环(0=不进,1=进)
                if (VipCardUpgradeRewardInfoList != null && VipCardUpgradeRewardInfoList.Tables[0].Rows.Count > 0)
                {
                    flag = 1;
                    //获取开卡礼信息 为之后筛选数据使用
                    VipCardUpgradeRewardList = DataTableToObject.ConvertToList <VipCardUpgradeRewardInfo>(VipCardUpgradeRewardInfoList.Tables[0]);
                }

                var dt = VipCardTypeSystemInfoList.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    var DataInfo = new VipCardTypeRelateInfo();
                    //VipCardTypeRelateList = new List<VipCardTypeRelateInfo>();
                    DataInfo.VipCardType              = new VipCardTypeInfo();        //会员卡体系
                    DataInfo.VipCardUpgradeRule       = new VipCardUpgradeRuleInfo(); //会员卡升级规则
                    DataInfo.VipCardRule              = new VipCardRuleInfo();        //会员卡基本体系
                    DataInfo.VipCardUpgradeRewardList = new List <VipCardUpgradeRewardInfo>();
                    //var VipCardTypeData = new VipCardTypeInfo();
                    //给会员卡等级赋值
                    DataInfo.VipCardType.VipCardTypeID   = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardType.VipCardLevel    = Convert.ToInt32(dr["VipCardLevel"]);
                    DataInfo.VipCardType.VipCardTypeName = dr["VipCardTypeName"].ToString();
                    DataInfo.VipCardType.PicUrl          = dr["PicUrl"].ToString();
                    DataInfo.VipCardType.IsPrepaid       = Convert.ToInt32(dr["IsPrepaid"]);
                    DataInfo.VipCardType.IsOnlineSales   = Convert.ToInt32(dr["IsOnlineSales"]);

                    //var VipCardUpgradeRuleData = new VipCardUpgradeRuleInfo();
                    DataInfo.VipCardUpgradeRule.VipCardTypeID        = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardUpgradeRule.VipCardUpgradeRuleId = dr["VipCardUpgradeRuleId"] == null ? "" : dr["VipCardUpgradeRuleId"].ToString();
                    DataInfo.VipCardUpgradeRule.IsPurchaseUpgrade    = Convert.ToInt32(dr["IsPurchaseUpgrade"]);
                    DataInfo.VipCardUpgradeRule.IsExtraMoney         = Convert.ToInt32(dr["IsExtraMoney"]);
                    DataInfo.VipCardUpgradeRule.Prices             = Convert.ToDecimal(dr["Prices"]);
                    DataInfo.VipCardUpgradeRule.ExchangeIntegral   = Convert.ToInt32(dr["ExchangeIntegral"]);
                    DataInfo.VipCardUpgradeRule.IsRecharge         = Convert.ToInt32(dr["IsRecharge"]);
                    DataInfo.VipCardUpgradeRule.OnceRechargeAmount = Convert.ToDecimal(dr["OnceRechargeAmount"]);
                    DataInfo.VipCardUpgradeRule.IsBuyUpgrade       = Convert.ToInt32(dr["IsBuyUpgrade"]);
                    DataInfo.VipCardUpgradeRule.BuyAmount          = Convert.ToDecimal(dr["BuyAmount"]);
                    DataInfo.VipCardUpgradeRule.OnceBuyAmount      = Convert.ToDecimal(dr["OnceBuyAmount"]);

                    //var VipCardRuleData = new VipCardUpgradeRuleInfo();
                    DataInfo.VipCardRule.VipCardTypeID        = Convert.ToInt32(dr["VipCardTypeID"]);
                    DataInfo.VipCardRule.RuleID               = dr["RuleID"] == null ? 0 : Convert.ToInt32(dr["RuleID"]);
                    DataInfo.VipCardRule.CardDiscount         = Convert.ToDecimal(dr["CardDiscount"]);
                    DataInfo.VipCardRule.PaidGivePercetPoints = Convert.ToDecimal(dr["PaidGivePercetPoints"]);
                    DataInfo.VipCardRule.PaidGivePoints       = Convert.ToDecimal(dr["PaidGivePoints"]);
                    if (flag == 1)//当flag=1的时候进行开卡礼的展示
                    {
                        DataInfo.VipCardUpgradeRewardList = VipCardUpgradeRewardList.Where(m => m.VipCardTypeID == Convert.ToInt32(dr["VipCardTypeID"])).Select(
                            t => new VipCardUpgradeRewardInfo()
                        {
                            CardUpgradeRewardId = t.CardUpgradeRewardId,
                            VipCardTypeID       = t.VipCardTypeID,
                            CouponTypeID        = t.CouponTypeID,
                            CouponNum           = t.CouponNum,
                            CouponName          = t.CouponName,
                            ValidityPeriod      = t.BeginTime == null ? ("领取后" + (t.ServiceLife == 0 ? "1天内有效" : t.ServiceLife.ToString() + "天内有效")) : (t.BeginTime.Value.ToString("yyyy-MM-dd") + "至" + t.EndTime.Value.ToString("yyyy-MM-dd")),
                            BeginTime           = t.BeginTime,
                            EndTime             = t.EndTime,
                            BeginTimeDate       = t.BeginTime == null ? "" : t.BeginTime.Value.ToString("yyyy年MM月dd日"),
                            EndTimeDate         = t.EndTime == null ? "" : t.EndTime.Value.ToString("yyyy年MM月dd日"),
                            ServiceLife         = t.ServiceLife,
                        }).ToList();
                    }
                    VipCardTypeRelateList.Add(DataInfo);
                }
                rd.VipCardRelateList = VipCardTypeRelateList;
            }
            return(rd);
        }
Пример #28
0
        /// <summary>
        /// 保存更新游戏信息
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public void SaveGameEvent(SetCTWEventRP para, LPrizesBLL bllPrize, T_CTW_LEventInteractionBLL bllCustomerInteraction, string strThemeId, out string strStartDate, out string strEndDate, out string strGameEventGuid)
        {
            strGameEventGuid = string.Empty;

            var imageBll = new ObjectImagesBLL(loggingSessionInfo);

            LEventsBLL bllGameEvent = new LEventsBLL(loggingSessionInfo);

            var eventEntity = new LEventsEntity();

            strStartDate = para.GameEventInfo.BeginTime;
            strEndDate   = para.GameEventInfo.EndTime + " 23:59:59";
            if (string.IsNullOrEmpty(para.GameEventInfo.LeventId))
            {
                strGameEventGuid          = Guid.NewGuid().ToString();
                eventEntity.EventID       = strGameEventGuid;
                eventEntity.Title         = para.GameEventInfo.Title;
                eventEntity.BeginTime     = para.GameEventInfo.BeginTime;
                eventEntity.EndTime       = para.GameEventInfo.EndTime;
                eventEntity.DrawMethodId  = GetDrawMethodIdByDrawMethodCode(para.DrawMethodCode);
                eventEntity.PersonCount   = para.GameEventInfo.PersonCount;
                eventEntity.PointsLottery = para.GameEventInfo.PointsLottery;
                eventEntity.LotteryNum    = para.GameEventInfo.LotteryNum;
                eventEntity.IsDelete      = 0;

                if (DateTime.Compare(Convert.ToDateTime(para.GameEventInfo.BeginTime), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) <= 0 && DateTime.Compare(Convert.ToDateTime(para.GameEventInfo.EndTime), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) >= 0)
                {
                    eventEntity.EventStatus = 20;    //10=未开始,20=运行中,30=暂停,40=结束
                }
                else if (DateTime.Compare(Convert.ToDateTime(para.GameEventInfo.BeginTime), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) > 0)
                {
                    eventEntity.EventStatus = 10;    //10=未开始,20=运行中,30=暂停,40=结束
                }
                eventEntity.IsCTW      = 1;
                eventEntity.CustomerId = loggingSessionInfo.ClientID;
                bllGameEvent.Create(eventEntity);
            }
            else
            {
                strGameEventGuid          = para.GameEventInfo.LeventId;
                eventEntity               = bllGameEvent.GetByID(strGameEventGuid);
                eventEntity.Title         = para.GameEventInfo.Title;
                eventEntity.BeginTime     = para.GameEventInfo.BeginTime;
                eventEntity.EndTime       = para.GameEventInfo.EndTime;
                eventEntity.DrawMethodId  = GetDrawMethodIdByDrawMethodCode(para.DrawMethodCode);
                eventEntity.PersonCount   = para.GameEventInfo.PersonCount;
                eventEntity.PointsLottery = para.GameEventInfo.PointsLottery;
                eventEntity.LotteryNum    = para.GameEventInfo.LotteryNum;

                bllGameEvent.Update(eventEntity);
            }

            ///图片
            if (para.GameEventInfo.ImageList.Count > 0)
            {
                imageBll.DeleteByObjectID(strGameEventGuid);

                foreach (var i in para.GameEventInfo.ImageList)
                {
                    imageEntity             = new ObjectImagesEntity();
                    imageEntity.ImageURL    = i.ImageURL;
                    imageEntity.ObjectId    = strGameEventGuid;
                    imageEntity.CreateBy    = loggingSessionInfo.UserID;
                    imageEntity.ImageId     = Guid.NewGuid().ToString();
                    imageEntity.BatId       = i.BatId;
                    imageEntity.RuleId      = para.GameEventInfo.RuleId ?? 1;
                    imageEntity.RuleContent = para.GameEventInfo.RuleContent;
                    imageEntity.IsDelete    = 0;
                    imageEntity.CustomerId  = loggingSessionInfo.ClientID;
                    imageBll.Create(imageEntity);
                }
            }
            //奖品信息
            var entityPrize        = new LPrizesEntity();
            var redisPrizePoolsBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.PrizePools.RedisPrizePoolsBLL();

            if (!string.IsNullOrEmpty(para.GameEventInfo.LeventId))
            {
                //bllPrize.Delete(new LPrizesEntity() { EventId = para.GameEventInfo.LeventId });
                bllPrize.DeletePrizesByEventId(para.GameEventInfo.LeventId);

                CC_PrizePool prizePool = new CC_PrizePool();
                prizePool.CustomerId = loggingSessionInfo.ClientID;
                prizePool.EventId    = para.GameEventInfo.LeventId;
                redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
            }
            if (para.GameEventInfo.PrizeList.Count > 0)
            {
                foreach (var i in para.GameEventInfo.PrizeList)
                {
                    entityPrize.EventId      = strGameEventGuid;
                    entityPrize.PrizeTypeId  = i.PrizeTypeId;
                    entityPrize.Point        = i.Point;
                    entityPrize.CouponTypeID = i.CouponTypeID;
                    entityPrize.PrizeName    = i.PrizeName;
                    entityPrize.CountTotal   = i.PrizeCount;
                    entityPrize.CreateBy     = loggingSessionInfo.UserID;
                    entityPrize.PrizesID     = Guid.NewGuid().ToString();

                    bllPrize.SavePrize(entityPrize);
                }

                //入奖品池队列
                LPrizePoolsBLL bllPools = new LPrizePoolsBLL(loggingSessionInfo);
                DataSet        dsPools  = bllPools.GetPrizePoolsByEvent(loggingSessionInfo.ClientID, strGameEventGuid);
                if (dsPools != null && dsPools.Tables.Count > 0 && dsPools.Tables[0].Rows.Count > 0)
                {
                    var poolTemp  = DataTableToObject.ConvertToList <CC_PrizePool>(dsPools.Tables[0]);
                    var poolsList = Utils.GetRandomList <CC_PrizePool>(poolTemp);   //随机列表
                    if (poolsList != null && poolsList.Count > 0)
                    {
                        CC_PrizePool prizePool = new CC_PrizePool();
                        prizePool.CustomerId = loggingSessionInfo.ClientID;
                        prizePool.EventId    = strGameEventGuid;

                        redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
                        redisPrizePoolsBLL.SetPrizePoolsToRedis(poolsList);
                    }
                }
            }
            if (!string.IsNullOrEmpty(para.CTWEventId))
            {
                bllCustomerInteraction.DeleteByCTWEventID(para.CTWEventId);
            }
            ///互动类型与(游戏或促销)关联
            entityInteraction = new T_CTW_LEventInteractionEntity()
            {
                CTWEventId       = new Guid(strCTWEventId),
                ThemeId          = new Guid(strThemeId),
                InteractionType  = para.InteractionType,
                DrawMethodCode   = para.DrawMethodCode,
                LeventId         = strGameEventGuid,
                OriginalLeventId = new Guid(para.OriginalLeventId),
                CustomerId       = loggingSessionInfo.ClientID
            };
            bllCustomerInteraction.Create(entityInteraction);
        }
Пример #29
0
        protected override GetVipCardTypeRD ProcessRequest(APIRequest <GetVipCardTypeRP> pRequest)
        {
            var rd   = new GetVipCardTypeRD();
            var para = pRequest.Parameters;
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            //声明卡等级相关逻辑
            var    bllVipCardType         = new SysVipCardTypeBLL(loggingSessionInfo);
            var    bllVip                 = new VipBLL(loggingSessionInfo);
            string strPhone               = string.Empty;
            int?   CurVipLevel            = 0;
            List <IWhereCondition> wheres = new List <IWhereCondition>();

            wheres.Add(new EqualsCondition()
            {
                FieldName = "clientid", Value = pRequest.CustomerID
            });
            wheres.Add(new EqualsCondition()
            {
                FieldName = "VipID", Value = pRequest.UserID
            });
            wheres.Add(new EqualsCondition()
            {
                FieldName = "Status", Value = 2
            });
            //wheres.Add(new DirectCondition("Phone!=''"));
            var vipInfo = bllVip.Query(wheres.ToArray(), null).FirstOrDefault();

            if (vipInfo != null)
            {
                strPhone = vipInfo.Phone;
                var vipCardVipMappingBLL = new VipCardVipMappingBLL(CurrentUserInfo);
                var vipCardBLL           = new VipCardBLL(CurrentUserInfo);
                var vipCardTypeBLL       = new SysVipCardTypeBLL(CurrentUserInfo);
                var vipCardMappingInfo   = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
                {
                    VIPID = pRequest.UserID, CustomerID = CurrentUserInfo.ClientID
                },
                                                                              new OrderBy[] { new OrderBy()
                                                                                              {
                                                                                                  FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                              } }).FirstOrDefault();
                if (vipCardMappingInfo != null)//根据当前会员与卡关联表获取当前会员等级
                {
                    var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                    {
                        VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                    }, null).FirstOrDefault();
                    if (vipCardInfo != null)
                    {
                        var vipCardTypeInfo = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                        {
                            VipCardTypeID = vipCardInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (vipCardTypeInfo != null)//获取当前会员等级
                        {
                            CurVipLevel = vipCardTypeInfo.VipCardLevel;
                            if (CurVipLevel <= 1)
                            {
                                CurVipLevel = 1;
                            }
                        }
                    }
                }
            }
            else
            {
                strPhone = para.Phone;
            }
            try
            {
                //获取当前会员可绑卡列表
                var VipCardTypeSysInfoList = bllVipCardType.GetBindVipCardTypeInfo(loggingSessionInfo.ClientID, strPhone, pRequest.UserID, CurVipLevel);
                if (VipCardTypeSysInfoList != null && VipCardTypeSysInfoList.Tables[0].Rows.Count > 0)
                {
                    rd.VipCardTypeList = DataTableToObject.ConvertToList <VipCardRelateInfo>(VipCardTypeSysInfoList.Tables[0]);
                }
                else
                {
                    throw new APIException("未检测到实体卡!")
                          {
                              ErrorCode = ERROR_CODES.INVALID_BUSINESS
                          };
                }
            }
            catch (APIException ex)
            {
                throw ex;
            }

            return(rd);
        }
Пример #30
0
        /// <summary>
        /// 登录Action。
        ///1. 验证用户信息
        ///2. 登录
        // 登录: 1)如果登录成功,验证则调用云通讯接口:创建子账号。 并将返回的信息保存在(2050用户与第三方用户关联表TUserThirdPartyMapping)TUserThirdPartyMapping中,
        //
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        private string Login(string reqContent)
        {
            var rd = new APIResponse <UserInfoRD>();

            try
            {
                var rp = reqContent.DeserializeJSONTo <APIRequest <UserInfoRP> >();
                if (rp.Parameters != null)
                {
                    rp.Parameters.Validate();
                }
                var       loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
                T_UserBLL bll = new T_UserBLL(loggingSessionInfo);
                DataSet   ds  = bll.GetUserInfoByEmail(rp.Parameters.Email);
                if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    var user = DataTableToObject.ConvertToList <T_UserEntity>(ds.Tables[0]).FirstOrDefault();
                    if (user.user_password.Equals(MD5Helper.Encryption(rp.Parameters.Password)))  //
                    {
                        var userID = user.user_id;
                        //验证是否在第三方注册
                        TUserThirdPartyMappingBLL    tutpmBll   = new TUserThirdPartyMappingBLL(loggingSessionInfo);
                        TUserThirdPartyMappingEntity tutpmEntiy = tutpmBll.GetByID(userID);

                        UserViewModel userinfo = null;
                        if (tutpmEntiy == null)
                        {
                            ThirdUserViewModel  token   = null;
                            CloudRequestFactory factory = new CloudRequestFactory();
                            //调用云通讯创建子账户
                            Dictionary <string, object> retData = factory.CreateSubAccount("sandboxapp.cloopen.com", "8883", "ff8080813bbcae3f013bcc39c18a0022", "8f32e2023d804e1390a3b0b8b36d6e28", "aaf98f893e7df943013e8728b2b400c7", "user1234544rr656678");
                            string jsonData = getDictionaryData(retData);
                            token = CWHelper.Deserialize <ThirdUserViewModel>(jsonData);
                            if (token.statusCode == MessageStatusCode.Success)
                            {
                                tutpmEntiy = CreateThirdUser(tutpmEntiy, token, userID);
                                tutpmBll.Create(tutpmEntiy);
                            }

                            userinfo = new UserViewModel
                            {
                                UserID      = userID,
                                VoipAccount = token.SubAccount.voipAccount,
                                UserName    = user.user_name,
                                UserImgURL  = ""
                            };
                        }

                        var rdData = new UserInfoRD();
                        rdData.UserInfo = userinfo;
                        rd.Data         = rdData;
                        rd.Message      = "登录成功";
                    }
                    else
                    {
                        rd.ResultCode = 300;
                        rd.Message    = "密码错误";
                    }
                }
                else
                {
                    rd.ResultCode = 300;
                    rd.Message    = "邮箱不存在";
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(rd.ToJSON());
        }