protected override GetHomePageActivityListRD ProcessRequest(APIRequest <GetHomePageActivityListRP> pRequest)
        {
            var bll = new LEventsBLL(this.CurrentUserInfo);
            GetHomePageActivityListRD rd = new GetHomePageActivityListRD();

            if (pRequest.Parameters.PageIndex.HasValue == false)
            {
                pRequest.Parameters.PageIndex = 0;
            }
            if (pRequest.Parameters.PageSize.HasValue == false)
            {
                pRequest.Parameters.PageSize = 15;
            }
            var datas = bll.GetHomePageActivityList(pRequest.Parameters.PageIndex.Value, pRequest.Parameters.PageSize.Value);

            if (datas != null)
            {
                rd.Items = datas.Select(item => new ActivityListItemInfo()
                {
                    Title      = item.Title
                    , ImageUrl = item.ImageURL
                    , LinkUrl  = item.URL
                }).ToList();
            }
            //
            return(rd);
        }
Ejemplo n.º 2
0
        protected override DelayEventRD ProcessRequest(APIRequest <DelayEventRP> pRequest)
        {
            var                rd   = new DelayEventRD();
            var                para = pRequest.Parameters;
            var                loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            T_CTW_LEventBLL    bllCTWEvent        = new T_CTW_LEventBLL(loggingSessionInfo);
            T_CTW_LEventEntity entityCTWEvent     = new T_CTW_LEventEntity();

            entityCTWEvent         = bllCTWEvent.GetByID(para.CTWEventId);
            entityCTWEvent.EndDate = Convert.ToDateTime(para.EndDate);
            bllCTWEvent.Update(entityCTWEvent, null);
            if (para.EventType == "Game")
            {
                T_CTW_LEventInteractionBLL bllEventInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);
                string strEventId = bllEventInteraction.QueryByEntity(new T_CTW_LEventInteractionEntity()
                {
                    CTWEventId = new Guid(para.CTWEventId)
                }, null).FirstOrDefault().LeventId;
                LEventsBLL bllEvent = new LEventsBLL(loggingSessionInfo);
                bllEvent.Update(new LEventsEntity()
                {
                    EndTime = para.EndDate, EventID = strEventId
                }, false);
            }
            if (para.EventType == "Sales")
            {
                PanicbuyingEventBLL bllEvent = new PanicbuyingEventBLL(loggingSessionInfo);

                bllEvent.DelayEvent(para.CTWEventId, para.EndDate);
            }
            rd.EventId = para.CTWEventId;
            return(rd);
        }
Ejemplo n.º 3
0
        //处理扫描带参数二维码事件
        public virtual void HandlerScan(string eventKey)
        {
            var application = new WApplicationInterfaceDAO(requestParams.LoggingSessionInfo);
            var appEntitys  = application.QueryByEntity(new WApplicationInterfaceEntity()
            {
                WeiXinID = requestParams.WeixinId
            }, null);

            if (appEntitys != null && appEntitys.Length > 0)
            {
                var entity = appEntitys.FirstOrDefault();

                BaseService.WriteLogWeixin("AppID:  " + entity.AppID);
                BaseService.WriteLogWeixin("AppSecret:  " + entity.AppSecret);
                BaseService.WriteLogWeixin("qrcodeId:  " + eventKey);

                //保存用户信息
                // /// <param name="isShow">1: 关注  0: 取消关注</param>
                //这个里面处理临时二维码的信息的代码(建立员工与会员的上下级关系)**
                commonService.SaveUserInfo(requestParams.OpenId, requestParams.WeixinId, "1", entity.AppID, entity.AppSecret, eventKey, requestParams.LoggingSessionInfo);

                #region 微信扫描二维码 回复消息 update by wzq 20140731
                var eventsBll = new LEventsBLL(requestParams.LoggingSessionInfo);

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = "二维码信息:" + eventKey
                });

                string nodeMsg = string.Empty;
                foreach (System.Xml.XmlNode item in requestParams.XmlNode.ChildNodes)
                {
                    nodeMsg += " |  " + item.Name + "-" + item.Value;
                }

                //加log记录信息看下 2014-11-24 15:57:30
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = "二维码全部信息:"
                              + "~" + requestParams.OpenId
                              + "~" + requestParams.WeixinId
                              + "~" + requestParams.MsgType
                              + "~" + requestParams.XmlNode.ToString()
                              + nodeMsg
                });

                #region 注释备注:扫码时始终会调用保存用户信息接口,这里已经推送了消息
                //BaseService.WriteLogWeixin("开始推送消息Wzq");
                //处理扫描静态二维码的事件(包含处理上下级关系和推送图文信息)
                int sendMessageCount = 0;
                eventsBll.SendQrCodeWxMessage(requestParams.LoggingSessionInfo, requestParams.LoggingSessionInfo.CurrentLoggingManager.Customer_Id, requestParams.WeixinId, eventKey,
                                              requestParams.OpenId, this.httpContext, requestParams, out sendMessageCount);

                //BaseService.WriteLogWeixin("推送消息成功Wzq");
                #endregion

                #endregion
            }
        }
Ejemplo n.º 4
0
        protected override GetRecommendRD ProcessRequest(DTO.Base.APIRequest <GetRecommendRP> pRequest)
        {
            var rd = new GetRecommendRD();

            var bll = new LEventsBLL(CurrentUserInfo);

            rd.EventId = bll.GetRecommendId(CurrentUserInfo.ClientID);

            return(rd);
        }
Ejemplo n.º 5
0
        protected override GetEventListRD ProcessRequest(DTO.Base.APIRequest <GetEventListRP> pRequest)
        {
            var rd = new GetEventListRD();

            //string customerId = pRequest.CustomerID;
            string eventTypeId = pRequest.Parameters.EventTypeId;
            string eventName   = pRequest.Parameters.EventName;

            int  drawMethodId = pRequest.Parameters.DrowMethodId;
            bool?beginFlag    = pRequest.Parameters.BeginFlag;
            bool?endFlag      = pRequest.Parameters.EndFlag;

            int?pageSize  = pRequest.Parameters.PageSize;
            int?pageIndex = pRequest.Parameters.PageIndex;

            int?eventStatus = pRequest.Parameters.EventStatus;

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

            var bll = new LEventsBLL(CurrentUserInfo);

            var ds = bll.GetEventList(CurrentUserInfo.ClientID, eventTypeId, eventName, drawMethodId, beginFlag, endFlag, eventStatus ?? 0, pageIndex ?? 0, pageSize ?? 15);

            if (ds.Tables[0].Rows.Count == 0)
            {
                //throw new APIException("没有数据") { ErrorCode = Error_EmptyData };
                rd.EventList  = null;
                rd.TotalPages = 0;
            }
            else
            {
                var temp = ds.Tables[0].AsEnumerable().Select(t => new EventInfo
                {
                    EventId       = t["EventId"].ToString(),
                    EventName     = t["Title"].ToString(),
                    EventTypeId   = t["EventTypeId"].ToString(),
                    EventTypeName = t["EventTypeName"].ToString(),
                    BegTime       = t["BeginTime"].ToString(),
                    EndTime       = t["EndTime"].ToString(),
                    //DisplayIndex = Convert.ToInt32(t["_row"]),
                    DrawMethod      = t["DrawMethodName"].ToString(),
                    EventStatus     = Convert.ToInt32(t["EventStatus"]),
                    EventStatusName = t["EventStatusName"].ToString(),
                    CityName        = t["cityid"].ToString()
                });

                rd.EventList = temp.ToArray();
                int totalCount = bll.GetEventListCount(CurrentUserInfo.ClientID, eventTypeId, eventName, drawMethodId,
                                                       beginFlag, endFlag, eventStatus ?? 0);

                rd.TotalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(totalCount * 1.00 / (pageSize ?? 15) * 1.00)));
            }
            return(rd);
        }
        public string DeleteEvent(string pRequest)
        {
            var        reqObj             = pRequest.DeserializeJSONTo <APIRequest <EventRP> >();
            var        loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            LEventsBLL bll = new LEventsBLL(loggingSessionInfo);

            bll.DeleteByProc(reqObj.Parameters.EventId);
            var rd  = new EmptyRD();
            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
Ejemplo n.º 7
0
        public string getEventTotalInfo()
        {
            var loggingSessionInfo = Default.GetLjLoggingSession();

            //根据客户标识获取连接字符串  qianzhi  2013-07-30
            if (!string.IsNullOrEmpty(Request["customerId"]))
            {
                loggingSessionInfo = Default.GetBSLoggingSession(Request["customerId"].Trim(), "");
            }

            string content = string.Empty;
            GetResponseParams <EventTotalInfo> response = new GetResponseParams <EventTotalInfo>();

            response.Code        = "200";
            response.Description = "操作成功";
            try
            {
                string        WeiXinId    = Request["WeiXinId"].ToString().Trim();
                string        EventId     = Request["EventId"].ToString().Trim();
                LEventsEntity eventInfo   = new LEventsEntity();
                LEventsBLL    inoutServer = new LEventsBLL(loggingSessionInfo);
                string        strError    = string.Empty;
                eventInfo = inoutServer.GetEventTotalInfo(WeiXinId, EventId, loggingSessionInfo, out strError);
                if (eventInfo == null)
                {
                    response.Code        = "201";
                    response.Description = strError;
                }
                else
                {
                    EventTotalInfo eventTotalInfo = new EventTotalInfo();
                    eventTotalInfo.hasOrderCount  = eventInfo.hasOrderCount;
                    eventTotalInfo.hasPayCount    = eventInfo.hasPayCount;
                    eventTotalInfo.hasSalesAmount = eventInfo.hasSalesAmount;
                    eventTotalInfo.hasVipCount    = eventInfo.hasVipCount;
                    eventTotalInfo.newVipCount    = eventInfo.newVipCount;
                    response.Params = eventTotalInfo;
                }
            }
            catch (Exception ex)
            {
                response.Code        = "201";
                response.Description = "失败" + ex.ToString();
            }
            content = string.Format("{{\"Description\":\"{2}\",\"Code\":\"{1}\",\"Vip\":{0}}}",
                                    response.Params.ToJSON(), response.Code, response.Description);
            return(content);
        }
        public string GetNoStartAndWorkingEventList(string pRequest)
        {
            EventListRD rd                 = new EventListRD();
            var         reqObj             = pRequest.DeserializeJSONTo <APIRequest <EventListRP> >();
            var         loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            LEventsBLL  bll                = new LEventsBLL(loggingSessionInfo);
            var         ds                 = bll.GetNoStartAndWorkingEventList();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                rd.LEventsList = DataTableToObject.ConvertToList <EventsList>(ds.Tables[0]).ToArray();//直接根据所需要的字段反序列化
            }
            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
        public string GetEventList(string pRequest)
        {
            EventListRD rd                 = new EventListRD();
            var         reqObj             = pRequest.DeserializeJSONTo <APIRequest <EventListRP> >();
            var         loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            LEventsBLL  bll                = new LEventsBLL(loggingSessionInfo);
            DataSet     ds                 = bll.GetEventList(reqObj.Parameters.PageIndex, reqObj.Parameters.PageSize, reqObj.Parameters.Title, reqObj.Parameters.DrawMethodName, reqObj.Parameters.BeginTime, reqObj.Parameters.EndTime);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                rd.LEventsList = DataTableToObject.ConvertToList <EventsList>(ds.Tables[0]).ToArray();//直接根据所需要的字段反序列化
                rd.TotalCount  = Convert.ToInt32(ds.Tables[1].Rows[0]["TotalCount"].ToString());
                rd.PageCount   = Convert.ToInt32(ds.Tables[1].Rows[0]["PageCount"].ToString());
            }
            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
        public void SetRedisPrizePools()
        {
            var CustomerIDList = CustomerBLL.Instance.GetCustomerList();//这里的Instance使用了单例的模式


            LoggingSessionInfo loggingSessionInfo    = new LoggingSessionInfo();
            LoggingManager     CurrentLoggingManager = new LoggingManager();

            foreach (var customer in CustomerIDList)
            {
                loggingSessionInfo.ClientID              = customer.Key;
                CurrentLoggingManager.Connection_String  = customer.Value;
                loggingSessionInfo.CurrentLoggingManager = CurrentLoggingManager;
                //入奖品池队列
                LEventsBLL     bllEvent = new LEventsBLL(loggingSessionInfo);
                LPrizePoolsBLL bllPools = new LPrizePoolsBLL(loggingSessionInfo);

                var eventList = bllEvent.QueryByEntity(new LEventsEntity()
                {
                    CustomerId = customer.Key, IsDelete = 0, EventStatus = 20
                }, null).ToList();
                foreach (var levent in eventList)
                {
                    DataSet dsPools = bllPools.GetPrizePoolsByEvent(loggingSessionInfo.ClientID, levent.EventID);
                    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)
                        {
                            var          redisPrizePoolsBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.PrizePools.RedisPrizePoolsBLL();
                            CC_PrizePool prizePool          = new CC_PrizePool();
                            prizePool.CustomerId = customer.Key;
                            prizePool.EventId    = levent.EventID;

                            redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
                            redisPrizePoolsBLL.SetPrizePoolsToRedis(poolsList);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes             nodes   = new TreeNodes();
            LEventsBLL            service = new LEventsBLL(new SessionManager().CurrentUserLoginInfo);
            IList <LEventsEntity> units;

            string key     = string.Empty;
            string content = string.Empty;

            key = pParentNodeID;

            var orderBy = new OrderBy[] {
                new OrderBy {
                    FieldName = "DisplayIndex", Direction = OrderByDirections.Asc
                }
            };

            if (key == null || key == "-1" || key == "root" || key.Length == 0)
            {
                units = service.QueryByEntity(new LEventsEntity()
                {
                    IsSubEvent = 0,
                    CustomerId = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }
            else
            {
                units = service.QueryByEntity(new LEventsEntity()
                {
                    ParentEventID = key,
                    CustomerId    = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }

            foreach (var item in units)
            {
                nodes.Add(item.EventID, item.Title, item.ParentEventID, false);
            }
            return(nodes);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        protected override GetImageRD ProcessRequest(APIRequest <GetImageRP> pRequest)
        {
            var             rd       = new GetImageRD();
            ObjectImagesBLL bllImage = new ObjectImagesBLL(this.CurrentUserInfo);
            LEventsBLL      bllEvent = new LEventsBLL(this.CurrentUserInfo);
            LCoverBLL       bllCover = new LCoverBLL(CurrentUserInfo);

            string strEventId           = pRequest.Parameters.EventId;
            string strCTWEventId        = string.Empty;
            string strOnLineRedirectUrl = string.Empty;

            rd.EventId = strEventId;
            rd.IsCTW   = 0;
            //if (!string.IsNullOrEmpty(pRequest.Parameters.CTWEventId))
            //{
            T_CTW_LEventInteractionBLL bllLEventInteraction = new T_CTW_LEventInteractionBLL(this.CurrentUserInfo);
            DataSet ds = bllLEventInteraction.GetCTWLEventInteraction(strEventId);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                strEventId           = ds.Tables[0].Rows[0]["LeventId"].ToString();
                strCTWEventId        = ds.Tables[0].Rows[0]["CTWEventId"].ToString();
                strOnLineRedirectUrl = ds.Tables[0].Rows[0]["OnLineRedirectUrl"].ToString();
                ContactEventBLL bllContact = new ContactEventBLL(this.CurrentUserInfo);
                LPrizesBLL      bllPrize   = new LPrizesBLL(this.CurrentUserInfo);

                var contactList = bllContact.QueryByEntity(new ContactEventEntity()
                {
                    EventId = strCTWEventId, IsCTW = 1, IsDelete = 0
                }, null).ToList();

                T_CTW_SpreadSettingBLL bllSpreadSetting = new T_CTW_SpreadSettingBLL(this.CurrentUserInfo);

                DataSet    dsFocus    = bllSpreadSetting.GetSpreadSettingQRImageByCTWEventId(strCTWEventId, "Focus");
                var        regContact = contactList.Where(a => a.ContactTypeCode == "Reg").SingleOrDefault();
                ButtonInfo reg        = new ButtonInfo();
                reg.Text = "注册";
                if (regContact != null)
                {
                    if (dsFocus != null && dsFocus.Tables[0].Rows.Count > 0)
                    {
                        reg.Text = dsFocus.Tables[0].Rows[0]["LeadPageRegPromptText"].ToString();
                    }

                    if (bllPrize.QueryByEntity(new LPrizesEntity()
                    {
                        EventId = regContact.EventId
                    }, null).SingleOrDefault() != null)
                    {
                        reg.Text = "注册有惊喜";
                    }
                }
                rd.Reg = reg;

                ButtonInfo share = new ButtonInfo();
                share.Text = "分享";
                DataSet dsShare = bllSpreadSetting.GetSpreadSettingQRImageByCTWEventId(strCTWEventId, "Share");
                if (dsShare != null && dsShare.Tables.Count > 0 && dsShare.Tables[0].Rows.Count > 0)
                {
                    share.Title      = dsShare.Tables[0].Rows[0]["Title"].ToString();
                    share.Summary    = dsShare.Tables[0].Rows[0]["Summary"].ToString();
                    share.BGImageUrl = dsShare.Tables[0].Rows[0]["BGImageUrl"].ToString();
                }
                var shareContact = contactList.Where(a => a.ContactTypeCode == "Share").SingleOrDefault();
                if (shareContact != null)
                {
                    if (bllPrize.QueryByEntity(new LPrizesEntity()
                    {
                        EventId = shareContact.EventId
                    }, null).SingleOrDefault() != null)
                    {
                        share.Text = "分享有惊喜";
                    }
                    //if (dsFocus != null && dsFocus.Tables[0].Rows.Count > 0)
                    //{
                    //    share.Text = dsFocus.Tables[0].Rows[0]["LeadPageSharePromptText"].ToString();
                    //}
                }
                rd.Share = share;

                ButtonInfo focus = new ButtonInfo();
                focus.Text = "扫码关注";

                if (dsFocus != null && dsFocus.Tables.Count > 0 && dsFocus.Tables[0].Rows.Count > 0)
                {
                    focus.BGImageUrl             = dsFocus.Tables[0].Rows[0]["BGImageUrl"].ToString();
                    focus.LeadPageQRCodeImageUrl = dsFocus.Tables[0].Rows[0]["LeadPageQRCodeImageUrl"].ToString();
                    var focusContact = contactList.Where(a => a.ContactTypeCode == "Focus").SingleOrDefault();
                    if (focusContact != null)
                    {
                        focus.Text = dsFocus.Tables[0].Rows[0]["LeadPageFocusPromptText"].ToString();
                    }
                }

                rd.Focus = focus;

                rd.IsCTW             = 1;
                rd.CTWEventId        = strCTWEventId;
                rd.EventId           = strEventId;
                rd.OnLineRedirectUrl = strOnLineRedirectUrl;
            }
            //}

            var image = bllImage.QueryByEntity(new ObjectImagesEntity()
            {
                ObjectId = strEventId, IsDelete = 0
            }, null).ToList();
            var eventInfo = bllEvent.GetByID(strEventId);

            if (image.Count != 0)
            {
                foreach (var i in image)
                {
                    if (i.BatId == "BackGround")
                    {
                        rd.BackGround = i.ImageURL;
                    }
                    if (i.BatId == "BeforeGround")
                    {
                        rd.BeforeGround = i.ImageURL;
                    }
                    if (i.BatId == "Logo")
                    {
                        rd.Logo = i.ImageURL;
                    }
                    if (i.BatId == "Rule")
                    {
                        rd.Rule = i.ImageURL;
                    }
                    if (i.BatId == "LT_kvPic")
                    {
                        rd.LT_kvPic = i.ImageURL;
                    }
                    if (i.BatId == "LT_Rule")
                    {
                        rd.LT_Rule = i.ImageURL;
                    }
                    if (i.BatId == "LT_bgpic1")
                    {
                        rd.LT_bgpic1 = i.ImageURL;
                    }
                    if (i.BatId == "LT_bgpic2")
                    {
                        rd.LT_bgpic2 = i.ImageURL;
                    }
                    if (i.BatId == "LT_regularpic")
                    {
                        rd.LT_regularpic = i.ImageURL;
                    }
                    if (i.BatId == "Receive")
                    {
                        rd.Receive = i.ImageURL;
                    }
                    if (i.BatId == "NotReceive")
                    {
                        rd.NotReceive = i.ImageURL;
                    }
                }
                ;
                rd.RuleContent = image.FirstOrDefault().RuleContent;
                rd.RuleId      = image.FirstOrDefault().RuleId ?? 0;
                rd.ImageList   = bllImage.QueryByEntity(new ObjectImagesEntity()
                {
                    ObjectId = strEventId, BatId = "list", IsDelete = 0
                }, null).ToList();
            }
            rd.EventTitle     = eventInfo.Title;
            rd.EventContent   = eventInfo.Content;
            rd.BootUrl        = eventInfo.BootURL;
            rd.ShareRemark    = eventInfo.ShareRemark;
            rd.PosterImageUrl = eventInfo.PosterImageUrl;
            rd.OverRemark     = eventInfo.OverRemark;
            rd.ShareLogoUrl   = eventInfo.ShareLogoUrl;
            rd.IsShare        = eventInfo.IsShare == null ? 0 : (int)eventInfo.IsShare;

            var entityCover = bllCover.QueryByEntity(new LCoverEntity()
            {
                EventId = strEventId, IsDelete = 0, IsShow = 1
            }, null).FirstOrDefault();

            if (entityCover != null)
            {
                rd.CoverInfo = entityCover;
            }

            return(rd);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取活动奖项信息
        /// </summary>
        public string getEventPrizes()
        {
            string content = string.Empty;

            var respData = new getEventPrizesRespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <getEventPrizesReqData>();

                string openId    = reqObj.common.openId;
                string weixinId  = reqObj.common.weiXinId ?? reqObj.common.openId;
                string eventId   = reqObj.special.eventId;  //活动ID
                string vipId     = reqObj.common.userId;
                string vipName   = string.Empty;
                string longitude = reqObj.special.longitude;   //经度
                string latitude  = reqObj.special.latitude;    //纬度

                if (string.IsNullOrEmpty(eventId))
                {
                    eventId = "E5A304D716D14CD2B96560EBD2B6A29C";
                }

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("getEventPrizes: {0}", reqContent)
                });

                //判断客户ID是否传递
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                respData.content           = new getEventPrizesRespContentData();
                respData.content.prizeList = new List <PrizesEntity>();

                var eventList = new LEventsBLL(loggingSessionInfo).QueryByEntity(new LEventsEntity {
                    EventID = eventId
                }, null);

                if (eventList != null && eventList.Length > 0)
                {
                    var eventEntity = eventList.FirstOrDefault();

                    if (Convert.ToDateTime(eventEntity.EndTime).AddDays(1) > DateTime.Now)  //当天还是有效的   updated by Willie Yan on 2014-04-28
                    {
                        #region 获取VIPID

                        VipBLL vipService = new VipBLL(loggingSessionInfo);
                        var    vipList    = vipService.QueryByEntity(new VipEntity()
                        {
                            WeiXinUserId = openId
                        }, null);

                        if (vipList == null || vipList.Length == 0)
                        {
                            respData.code        = "103";
                            respData.description = "未查找到匹配的VIP信息";
                            return(respData.ToJSON());
                        }
                        else
                        {
                            vipId   = vipList.FirstOrDefault().VIPID;
                            vipName = vipList.FirstOrDefault().VipName;
                        }

                        #endregion

                        //查询抽奖日志
                        LLotteryLogBLL lotteryService = new LLotteryLogBLL(loggingSessionInfo);
                        var            lotteryList    = lotteryService.QueryByEntity(new LLotteryLogEntity()
                        {
                            EventId = eventId, VipId = vipId
                        }, null);

                        #region 奖品信息

                        LPrizesBLL prizesService = new LPrizesBLL(loggingSessionInfo);

                        var prizesList = prizesService.QueryByEntity(new LPrizesEntity()
                        {
                            EventId = eventId
                        },
                                                                     new OrderBy[] { new OrderBy {
                                                                                         FieldName = " DisplayIndex ", Direction = OrderByDirections.Asc
                                                                                     } });

                        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
                                };

                                respData.content.prizeList.Add(entity);
                            }
                        }

                        #endregion

                        #region 抽奖信息

                        //respData.content.lotteryCount = eventEntity.PrizesCount.ToString();
                        respData.content.lotteryNumber = "0";
                        respData.content.validTime     = ConfigurationManager.AppSettings["ValidTime"];
                        int totalLotteryCount = 0;

                        //获取剩余抽奖次数
                        VwVipCenterInfoBLL vwVipCenterInfoBLL = new VwVipCenterInfoBLL(loggingSessionInfo);
                        var vwVipCenterInfo = vwVipCenterInfoBLL.GetByID(vipId);
                        totalLotteryCount = vwVipCenterInfo.LotteryCount ?? 0;

                        //获取已抽奖次数
                        if (lotteryList != null && lotteryList.Length > 0)
                        {
                            respData.content.lotteryNumber = lotteryList.FirstOrDefault().LotteryCount.ToString();
                        }
                        else
                        {
                            totalLotteryCount++; //如果未抽奖,活动默认有一次抽奖机会
                        }
                        //判断抽奖次数是否有效
                        if (Convert.ToInt32(respData.content.lotteryNumber) >= totalLotteryCount)
                        {
                            respData.content.isLottery   = "0";
                            respData.content.lotteryDesc = "您已经没有抽奖机会了,想得到更多抽奖机会,请在对话栏内发送中文“分享”给我们,获得图文消息后多多转发。详情关注“推荐有礼”菜单。";
                        }
                        else
                        {
                            //判断之前是否已经中奖
                            LPrizeWinnerBLL winnerService = new LPrizeWinnerBLL(loggingSessionInfo);
                            var             prize         = winnerService.GetWinnerInfo(vipId, eventId);

                            if (!prize.Read())
                            {
                                //抽奖
                                LPrizePoolsBLL poolsServer   = new LPrizePoolsBLL(loggingSessionInfo);
                                var            returnDataObj = poolsServer.SetShakeOffLottery(vipName, vipId, eventId, ToFloat(longitude), ToFloat(latitude));

                                if (returnDataObj.Params.result_code.Equals("1"))   //中奖
                                {
                                    //获取奖品信息
                                    prize = winnerService.GetWinnerInfo(vipId, eventId);
                                    if (prize.Read())
                                    {
                                        var prizeValue = GetPrizeValue(prize["PrizeShortDesc"].ToString());

                                        respData.content.isLottery    = "1";
                                        respData.content.lotteryDesc  = returnDataObj.Params.result_message;// "恭喜您中奖了";
                                        respData.content.isWinning    = "1";
                                        respData.content.winningValue = prizeValue;
                                    }
                                    //added by zhangwei 中奖后绑定推荐关系,设置奖项
                                    BindRecommender();
                                    setEventPrizes();
                                }
                                else    //没有中奖,一直能抽奖
                                {
                                    respData.content.isLottery    = "1";
                                    respData.content.isWinning    = "0";
                                    respData.content.winningValue = "0";
                                    respData.content.lotteryDesc  = "恭喜您中奖了";//张伟,为泸州老窖新人有礼前台判断使用
                                }
                            }
                            else
                            {
                                var prizeValue = GetPrizeValue(prize["PrizeShortDesc"].ToString());

                                respData.content.isLottery    = "1";
                                respData.content.lotteryDesc  = "恭喜您中奖了";
                                respData.content.isWinning    = "1";
                                respData.content.winningValue = prizeValue;
                            }
                            prize.Close();
                            respData.content.lotteryCount = totalLotteryCount.ToString();
                        }

                        #endregion
                    }
                    else
                    {
                        respData.content.isLottery   = "0";
                        respData.content.lotteryDesc = "活动已经结束";
                    }
                }
                else
                {
                    respData.content.isLottery   = "0";
                    respData.content.lotteryDesc = "指定的活动不存在";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                //respData.exception = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
Ejemplo n.º 15
0
        //用户关注微信号
        public override void UserSubscribe()
        {
            var eventsBll = new LEventsBLL(requestParams.LoggingSessionInfo);
            //设置关注信息
            var modelDAO = new WModelDAO(requestParams.LoggingSessionInfo);
            var ds       = new DataSet();// /// <param name="KeyworkType">1=关键字回复 2=关注回复 3=自动回复</param>

            //优先处理二维码
            var qrcodeId = string.Empty;
            var eventKey = requestParams.XmlNode.SelectSingleNode("//EventKey");

            var application = new WApplicationInterfaceDAO(requestParams.LoggingSessionInfo);
            var appEntitys  = application.QueryByEntity(new WApplicationInterfaceEntity()
            {
                WeiXinID = requestParams.WeixinId
            }, null);

            if (eventKey != null && eventKey.InnerText.Contains("qrscene_"))//如果是二维码的就之返回二维码的
            {
                qrcodeId = eventKey.InnerText.Substring(8);
            }
            if (appEntitys != null && appEntitys.Length > 0)
            {
                var entity = appEntitys.FirstOrDefault();
                BaseService.WriteLogWeixin("AppID:  " + entity.AppID);
                BaseService.WriteLogWeixin("AppSecret:  " + entity.AppSecret);
                //扫描带参数二维码事件

                /**
                 * BaseService.WriteLogWeixin("二维码 eventKey:  " + eventKey.InnerText);
                 * if (!string.IsNullOrEmpty(eventKey.InnerText))//这里如果是二维码扫锚,就找出了二维码的code,可以在这里推送该二维码对应的图文素材******
                 * {
                 *  qrcodeId = eventKey.InnerText.Substring(8);
                 *  //这个地方传得是eventKey.ToString(),,而不是上面做的qrcodeId = eventKey.InnerText.Substring(8),所以不会找到对应的二维码的真正的key,也就不会推送二维码的key对应的图文素材信息
                 *  eventsBll.SendQrCodeWxMessage(requestParams.LoggingSessionInfo, requestParams.LoggingSessionInfo.CurrentLoggingManager.Customer_Id, requestParams.WeixinId, eventKey.ToString(),
                 *  requestParams.OpenId, this.httpContext, requestParams);
                 * }
                 **/
                //BaseService.WriteLogWeixin("二维码 qrcodeId:  " + qrcodeId);
                ////保存用户信息///// <param name="isShow">1: 关注  0: 取消关注</param>
                //这个里面处理临时二维码的信息的代码(建立员工与会员的上下级关系)**
                commonService.SaveUserInfo(requestParams.OpenId, requestParams.WeixinId, "1", entity.AppID, entity.AppSecret, qrcodeId, requestParams.LoggingSessionInfo);
            }

            int sendMessageCount = 0;

            if (eventKey != null && eventKey.InnerText.Contains("qrscene_"))//如果是二维码的就之返回二维码的
            {
                qrcodeId = eventKey.InnerText.Substring(8);
                //处理扫描静态二维码的事件(包含处理上下级关系和推送图文信息)
                eventsBll.SendQrCodeWxMessage(requestParams.LoggingSessionInfo, requestParams.LoggingSessionInfo.CurrentLoggingManager.Customer_Id, requestParams.WeixinId, qrcodeId,
                                              requestParams.OpenId, this.httpContext, requestParams, out sendMessageCount); //保存用户信息时,有推送消息
                //eventsBll.QrCodeHandlerText(qrcodeId, requestParams.LoggingSessionInfo,
                // requestParams.WeixinId, 4, requestParams.OpenId, httpContext, requestParams);
                //ds = modelDAO.GetMaterialByWeixinIdJermyn(requestParams.WeixinId, 4);
            }

            if (sendMessageCount == 0) //这种情况,就是没有eventKey,或者这个eventkey没有设置对应的关键字回复
            {
                #region  处理关注事件的图文信息
                ds = modelDAO.GetMaterialByWeixinIdJermyn(requestParams.WeixinId, 2);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    string typeId  = ds.Tables[0].Rows[0]["ReplyType"].ToString(); //素材类型 1=文字2=图片3=图文4=语音5=视频6=其他
                    string ReplyId = ds.Tables[0].Rows[0]["ReplyId"].ToString();   //素材ID
                    string Text    = ds.Tables[0].Rows[0]["text"].ToString();      //内容

                    BaseService.WriteLogWeixin("自动回复: typeId:" + typeId);
                    BaseService.WriteLogWeixin("自动回复:ReplyId:" + ReplyId);
                    switch (typeId)
                    {
                    case MaterialType.TEXT:             //回复文字消息
                        //ReplyText(materialId);
                        ReplyTextJermyn(Text);
                        break;

                    case MaterialType.IMAGE_TEXT:       //回复图文消息
                        //ReplyNews(materialId);
                        ReplyNewsJermyn(ReplyId, 2, 1);
                        break;

                    case MaterialType.OTHER:        //后台处理
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    UserSubscribeOld();//老版本的微信关注自动回复 Jermyn20140512
                }
                #endregion
            }


            /**
             * var application = new WApplicationInterfaceDAO(requestParams.LoggingSessionInfo);
             * var appEntitys = application.QueryByEntity(new WApplicationInterfaceEntity() { WeiXinID = requestParams.WeixinId }, null);
             * if (appEntitys != null && appEntitys.Length > 0)
             * {
             *  var entity = appEntitys.FirstOrDefault();
             *
             *  BaseService.WriteLogWeixin("AppID:  " + entity.AppID);
             *  BaseService.WriteLogWeixin("AppSecret:  " + entity.AppSecret);
             *
             *  //扫描带参数二维码事件
             *
             *  BaseService.WriteLogWeixin("二维码 eventKey:  " + eventKey.InnerText);
             *
             *
             *  if (!string.IsNullOrEmpty(eventKey.InnerText))//这里如果是二维码扫锚,就找出了二维码的code,可以在这里推送该二维码对应的图文素材******
             *  {
             *      qrcodeId = eventKey.InnerText.Substring(8);
             *      //这个地方传得是eventKey.ToString(),,而不是上面做的qrcodeId = eventKey.InnerText.Substring(8),所以不会找到对应的二维码的真正的key,也就不会推送二维码的key对应的图文素材信息
             *      eventsBll.SendQrCodeWxMessage(requestParams.LoggingSessionInfo, requestParams.LoggingSessionInfo.CurrentLoggingManager.Customer_Id, requestParams.WeixinId, eventKey.ToString(),
             *      requestParams.OpenId, this.httpContext, requestParams);
             *  }
             *
             *
             *  //BaseService.WriteLogWeixin("二维码 qrcodeId:  " + qrcodeId);
             *
             *  ////保存用户信息///// <param name="isShow">1: 关注  0: 取消关注</param>
             *   commonService.SaveUserInfo(requestParams.OpenId, requestParams.WeixinId, "1", entity.AppID, entity.AppSecret, qrcodeId, requestParams.LoggingSessionInfo);
             * }
             **/
        }
Ejemplo n.º 16
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);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 活动详细内容获取
        /// </summary>
        public string getEventDetail()
        {
            string ReqContent = string.Empty;
            string content    = string.Empty;
            var    respObj    = new getEventDetailRespData();
            string respStr    = string.Empty;

            try
            {
                ReqContent = Request["ReqContent"];
                ReqContent = HttpUtility.HtmlDecode(ReqContent);
                var reqContentObj = ReqContent.DeserializeJSONTo <getEventDetailReqData>();

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format(
                        "getEventDetail ReqContent:{0}",
                        ReqContent)
                });

                if (!string.IsNullOrEmpty(reqContentObj.common.customerId))
                {
                    customerId = reqContentObj.common.customerId;
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                //LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");
                var service = new LEventsBLL(loggingSessionInfo);

                //var service = new EventsBLL(Default.GetBasicUserInfo(reqContentObj));

                GetResponseParams <LEventsEntity> returnDataObj = service.WEventGetEventDetail(
                    reqContentObj.special.eventId,
                    reqContentObj.common.userId);

                var contentObj = new getEventDetailRespContentData();
                respObj.code        = returnDataObj.Code;
                respObj.description = returnDataObj.Description;
                //
                if (returnDataObj.Flag == "1" && returnDataObj.Params != null)
                {
                    contentObj.eventId = returnDataObj.Params.EventID;
                    contentObj.title   = returnDataObj.Params.Title;
                    contentObj.city    = returnDataObj.Params.CityID;
                    contentObj.address = Default.ToStr(returnDataObj.Params.Address);
                    contentObj.contact = Default.ToStr(returnDataObj.Params.Content);
                    contentObj.email   = Default.ToStr(returnDataObj.Params.Email);
                    //qianzhi 2013-05-25  添加结束时间
                    if (returnDataObj.Params.BeginTime == null || Convert.ToDateTime(returnDataObj.Params.BeginTime).ToString("yyyy-MM-dd").Equals("0001-01-01"))
                    {
                        contentObj.timeStr = "待定";
                    }
                    else
                    {
                        if (returnDataObj.Params.EndTime == null || returnDataObj.Params.EndTime.Equals(""))
                        {
                            contentObj.timeStr = Default.ToStr(Convert.ToDateTime(returnDataObj.Params.BeginTime).ToString("yyyy-MM-dd HH:mm"));
                        }
                        else
                        {
                            contentObj.timeStr = Default.ToStr(Convert.ToDateTime(returnDataObj.Params.BeginTime).ToString("yyyy-MM-dd HH:mm")) + " 至 " +
                                                 Default.ToStr(Convert.ToDateTime(returnDataObj.Params.EndTime).ToString("yyyy-MM-dd HH:mm"));
                        }
                    }

                    contentObj.imageUrl = Default.ToStr(returnDataObj.Params.ImageURL);

                    contentObj.organizer     = "";
                    contentObj.organizerType = "";
                    contentObj.applyCount    = Default.ToStr(returnDataObj.Params.signUpCount);     //报名数量
                    contentObj.checkinCount  = Default.ToStr(returnDataObj.Params.CheckinsCount);   //签到数量
                    contentObj.hasPrize      = "";
                    contentObj.intervalDays  = Default.ToStr(returnDataObj.Params.IntervalDays);
                    contentObj.description   = HttpUtility.HtmlDecode(returnDataObj.Params.Description);

                    contentObj.longitude = Default.ToStr(returnDataObj.Params.Longitude);
                    contentObj.latitude  = Default.ToStr(returnDataObj.Params.Latitude);
                }

                respObj.content = contentObj;

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format(
                        "getEventDetail RespContent:{0}",
                        respObj.ToJSON())
                });
            }
            catch (Exception ex)
            {
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
                respObj.exception   = ex.ToString();
            }
            content = respObj.ToJSON();
            return(content);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 活动报名表数据获取
        /// </summary>
        public string getEventApplyQues()
        {
            string ReqContent = string.Empty;
            string content    = string.Empty;
            var    respObj    = new getEventApplyQuesRespData();
            string respStr    = string.Empty;

            try
            {
                ReqContent = Request["ReqContent"];
                ReqContent = HttpUtility.HtmlDecode(ReqContent);
                var reqContentObj = ReqContent.DeserializeJSONTo <getEventApplyQuesReqData>();

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format(
                        "getEventApplyQues ReqContent:{0}",
                        ReqContent)
                });
                if (!string.IsNullOrEmpty(reqContentObj.common.customerId))
                {
                    customerId = reqContentObj.common.customerId;
                }
                LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");
                var service = new WEventUserMappingBLL(loggingSessionInfo);

                GetResponseParams <QuestionnaireEntity> returnDataObj = service.getEventApplyQues(
                    reqContentObj.special.eventId);

                var contentObj = new getEventApplyQuesRespContentData();
                respObj.code        = returnDataObj.Code;
                respObj.description = returnDataObj.Description;


                if (returnDataObj.Flag == "1" && returnDataObj.Params != null)
                {
                    contentObj.questionCount = Default.ToStr(returnDataObj.Params.QuestionCount);

                    // questions
                    if (returnDataObj.Params.QuesQuestionEntityList != null)
                    {
                        contentObj.questions = new List <getEventApplyQuesRespQuestionData>();
                        foreach (var tmpQuestion in returnDataObj.Params.QuesQuestionEntityList)
                        {
                            if (tmpQuestion == null)
                            {
                                continue;
                            }
                            var tmpQues = new getEventApplyQuesRespQuestionData();
                            tmpQues.questionId     = Default.ToStr(tmpQuestion.QuestionID);
                            tmpQues.isSaveOutEvent = Default.ToStr(tmpQuestion.IsSaveOutEvent);
                            tmpQues.cookieName     = Default.ToStr(tmpQuestion.CookieName);
                            tmpQues.questionText   = Default.ToStr(tmpQuestion.QuestionDesc);
                            tmpQues.questionType   = Default.ToStr(tmpQuestion.QuestionType);
                            tmpQues.minSelected    = Default.ToStr(tmpQuestion.MinSelected);
                            tmpQues.maxSelected    = Default.ToStr(tmpQuestion.MaxSelected);
                            tmpQues.isRequired     = Default.ToStr(tmpQuestion.IsRequired);
                            tmpQues.isFinished     = Default.ToStr(tmpQuestion.IsFinished);

                            // options
                            if (tmpQuestion.QuesOptionEntityList != null)
                            {
                                tmpQues.options = new List <getEventApplyQuesRespOptionData>();
                                foreach (var tmpOption in tmpQuestion.QuesOptionEntityList)
                                {
                                    if (tmpOption == null)
                                    {
                                        continue;
                                    }
                                    var tmpOp = new getEventApplyQuesRespOptionData();
                                    tmpOp.optionId   = Default.ToStr(tmpOption.OptionsID);
                                    tmpOp.optionText = Default.ToStr(tmpOption.OptionsText);
                                    tmpOp.isSelected = Default.ToStr(tmpOption.IsSelect);
                                    tmpQues.options.Add(tmpOp);
                                }
                            }

                            contentObj.questions.Add(tmpQues);
                        }
                    }
                }

                respObj.content = contentObj;
                LEventsBLL    eventServer = new LEventsBLL(loggingSessionInfo);
                LEventsEntity eventInfo   = new LEventsEntity();
                eventInfo = eventServer.GetByID(reqContentObj.special.eventId);
                respObj.content.imageUrl = eventInfo.URL;

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format(
                        "getEventApplyQues RespContent:{0}",
                        respObj.ToJSON())
                });
            }
            catch (Exception ex)
            {
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
                //respObj.exception = ex.ToString();
            }
            content = respObj.ToJSON();
            return(content);
        }
Ejemplo n.º 19
0
        private void DoWork()
        {
            while (true)
            {
                try
                {
                    ConfigurationManager.RefreshSection("appSettings");
                    var time = ConfigurationManager.AppSettings["Timing"];

                    TimeSpan.TryParse(time, out _timeSpan);
                    if (DateTime.Now.TimeOfDay.Hours == _timeSpan.Hours)
                    {
                        //支持配置多客户
                        string[] customerIDs = ConfigurationManager.AppSettings["CustomerIDs"].Split(',');

                        foreach (string customerID in customerIDs)
                        {
                            loggingSessionInfo = Default.GetBSLoggingSession(customerID, "1");
                            var eventsService = new LEventsBLL(loggingSessionInfo);

                            LEventsEntity queryEntity = new LEventsEntity();
                            queryEntity.EventType = 0;
                            var data = eventsService.WEventGetWebEvents(queryEntity, 0, 100000000);

                            foreach (var item in data)
                            {
                                XieHuiBaoBLL b = new XieHuiBaoBLL(loggingSessionInfo, "vip");

                                List <DefindControlEntity> l          = new List <DefindControlEntity>();
                                PageResultEntity           pageEntity = null;
                                try
                                {
                                    pageEntity = b.GetPageDataByEventID(l, 100000000, 0, item.EventID);
                                }
                                catch (Exception e)
                                {
                                    Loggers.Debug(new DebugLogInfo
                                    {
                                        Message = string.Format("{0} {1} (EventID:{3})报名人员信息通知邮件发送{2}", DateTime.Now.ToShortDateString(), DateTime.Now.TimeOfDay, "失败", item.EventID)
                                    });
                                    Loggers.Exception(new BasicUserInfo(), e);
                                    continue;
                                }

                                if (pageEntity.GridData != null)
                                {
                                    if (pageEntity.GridData.Rows.Count == 0)
                                    {
                                        continue;
                                    }
                                }

                                GridInitEntity g = GetInitGridDataByEventID(item.EventID);
                                if (pageEntity != null && pageEntity.GridData != null)
                                {
                                    #region 替换标题信息
                                    if (g != null && g.GridColumnDefinds != null)
                                    {
                                        if (pageEntity.GridData.Columns.Contains("ROW_NUMBER"))
                                        {
                                            pageEntity.GridData.Columns.Remove("ROW_NUMBER");
                                        }
                                        if (pageEntity.GridData.Columns.Contains("SignUpID"))
                                        {
                                            pageEntity.GridData.Columns.Remove("SignUpID");
                                        }

                                        if (pageEntity.GridData.Columns.Count == 0)
                                        {
                                            continue;
                                        }


                                        for (int i = 0; i < pageEntity.GridData.Columns.Count; i++)
                                        {
                                            for (int j = 0; j < g.GridColumnDefinds.Count; j++)
                                            {
                                                if (pageEntity.GridData.Columns[i].ColumnName.ToLower() == g.GridColumnDefinds[j].DataIndex.ToLower())
                                                {
                                                    pageEntity.GridData.Columns[i].ColumnName = g.GridColumnDefinds[j].ColumnText;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    #endregion
                                }
                                //数据获取
                                Workbook wb = DataTableExporter.WriteXLS(pageEntity.GridData, 0);
                                wb.Worksheets[0].Name = "参加活动人员信息";

                                string savePath = ConfigurationManager.AppSettings["FileURL"];
                                if (!Directory.Exists(savePath))
                                {
                                    Directory.CreateDirectory(savePath);
                                }
                                savePath = savePath + "/" + item.Title + DateTime.Now.ToString("yyyyMMdd") + ".xls";
                                wb.Save(savePath);//保存Excel文件

                                #region 邮件发送
                                FromSetting fs = new FromSetting();
                                fs.SMTPServer = ConfigurationManager.AppSettings["SmtpServer"];
                                fs.SendFrom   = ConfigurationManager.AppSettings["MailSendFrom"];
                                fs.UserName   = ConfigurationManager.AppSettings["MailUserName"];
                                fs.Password   = ConfigurationManager.AppSettings["MailUserPassword"];

                                string mailTo     = ConfigurationManager.AppSettings["MailTo"];
                                string isSendMail = ConfigurationManager.AppSettings["IsSendMailToCreator"];

                                //是否发送成功
                                bool result = false;

                                if (!string.IsNullOrEmpty(mailTo))
                                {
                                    result = Mail.SendMail(fs, mailTo, ConfigurationManager.AppSettings["MailTitle"], ConfigurationManager.AppSettings["Subject"], savePath.Split(','));
                                }

                                if (isSendMail == "1")
                                {
                                    if (!string.IsNullOrEmpty(item.Email))
                                    {
                                        if (DateTime.Now < DateTime.Parse(item.EndTime))
                                        {
                                            //等于0表示不发送邮件
                                            if (item.MailSendInterval == null || item.MailSendInterval == 0)
                                            {
                                                continue;
                                            }

                                            //日期差与间隔时间取余判断是否符合发送邮件日期
                                            int dateDiff = ((TimeSpan)(DateTime.Now.Date - item.LastUpdateTime.Value.Date)).Days;
                                            if (dateDiff % item.MailSendInterval != 0)
                                            {
                                                continue;
                                            }


                                            result = Mail.SendMail(fs, item.Email, ConfigurationManager.AppSettings["MailTitle"], ConfigurationManager.AppSettings["Subject"], savePath.Split(','));

                                            Loggers.Debug(new DebugLogInfo
                                            {
                                                Message = string.Format("{0} {1} (EventID:{3})报名人员信息通知邮件发送{2}", DateTime.Now.ToShortDateString(), DateTime.Now.TimeOfDay, result ? "成功" : "失败", item.EventID)
                                            });
                                        }
                                    }
                                }
                                #endregion
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Loggers.Exception(new BasicUserInfo(), ex);
                }
                Thread.Sleep(new TimeSpan(0, 1, 0, 0));
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 活动报名表数据提交
        /// </summary>
        public string submitEventApply()
        {
            string ReqContent = string.Empty;
            string content    = string.Empty;
            var    respObj    = new submitEventApplyRespData();
            string respStr    = string.Empty;

            try
            {
                ReqContent = Request["Form"];

                //ReqContent = "{\"common\":{\"locale\":\"zh\",\"userId\":\"4f4ef63846f646b68e796cbc3604f2ed\",\"openId\":\"o8Y7Ejv3jR5fEkneCNu6N1_TIYIM\",\"customerId\":\"f6a7da3d28f74f2abedfc3ea0cf65c01\"},\"special\":{\"eventId\":\"8D41CDD7D5E4499195316E4645FCD7B9\",\"questions\":[{\"questionId\":\"87871FCE7117481DB2F72F28D627579F\",\"isSaveOutEvent\":\"0\",\"cookieName\":\"110801\",\"questionValue\":\"E9EAAE121543475EB57B1936EB98B4B7\"},{\"questionId\":\"CF21F654796F4E0B8F6F47D9D05B9407\",\"isSaveOutEvent\":\"0\",\"cookieName\":\"110802\",\"questionValue\":\"81E327E3252F4071AD9556F89580DCE2\"},{\"questionId\":\"4A73FEA6C1484ED4B1730A1EBC54E5B8\",\"isSaveOutEvent\":\"0\",\"cookieName\":\"110803\",\"questionValue\":\"11778879013148F2A424D5220FB02E09\"}],\"userName\":\"\",\"mobile\":\"\",\"email\":\"\"}}";

                //ReqContent = HttpUtility.HtmlDecode(ReqContent);
                var reqContentObj = ReqContent.DeserializeJSONTo <submitEventApplyReqData>();

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format(
                        "submitEventApply ReqContent:{0}",
                        ReqContent)
                });
                if (!string.IsNullOrEmpty(reqContentObj.common.customerId))
                {
                    customerId = reqContentObj.common.customerId;
                }
                LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");
                var service = new LEventsBLL(loggingSessionInfo);

                // WEventUserMappingEntity
                WEventUserMappingEntity userMappingEntity = new WEventUserMappingEntity();
                userMappingEntity.UserName = reqContentObj.special.userName;
                userMappingEntity.Mobile   = reqContentObj.special.mobile;
                userMappingEntity.Email    = reqContentObj.special.email;

                // quesAnswerList
                IList <QuesAnswerEntity> quesAnswerList = new List <QuesAnswerEntity>();
                if (reqContentObj.special.questions != null)
                {
                    foreach (var question in reqContentObj.special.questions)
                    {
                        QuesAnswerEntity quesAnswerEntity = new QuesAnswerEntity();
                        quesAnswerEntity.QuestionID    = question.questionId;
                        quesAnswerEntity.QuestionValue = question.questionValue;
                        quesAnswerList.Add(quesAnswerEntity);
                    }
                }

                GetResponseParams <bool> returnDataObj = service.WEventSubmitEventApply(
                    reqContentObj.special.eventId,
                    reqContentObj.common.userId,
                    userMappingEntity,
                    quesAnswerList);

                respObj.code        = returnDataObj.Code;
                respObj.description = returnDataObj.Description;
                //Jermyn20131108 提交问题之后微信推送 Jermyn20131209 更改了业务逻辑,暂时关闭
                //PushWeiXin(reqContentObj.common.openId, loggingSessionInfo, reqContentObj.special.eventId, reqContentObj.common.userId);
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format(
                        "submitEventApply RespContent:{0}",
                        respObj.ToJSON())
                });
            }
            catch (Exception ex)
            {
                respObj.code        = "103";
                respObj.description = "数据库操作错误";
                //respObj.exception = ex.ToString();
            }
            content = respObj.ToJSON();
            return(content);
        }
Ejemplo n.º 21
0
        protected override TemplateDetailRD ProcessRequest(APIRequest <TemplateDetailRP> pRequest)
        {
            var rd = new TemplateDetailRD();

            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            CTW_LEventThemeBLL        bllTheme         = new CTW_LEventThemeBLL(loggingSessionInfo);
            CTW_LEventInteractionBLL  bllInteraction   = new CTW_LEventInteractionBLL(loggingSessionInfo);
            CTW_SpreadSettingBLL      bllSpreadSetting = new CTW_SpreadSettingBLL(loggingSessionInfo);
            T_CTW_LEventsBLL          bllEvents        = new T_CTW_LEventsBLL(loggingSessionInfo);
            T_CTW_PanicbuyingEventBLL bllPanicbuying   = new T_CTW_PanicbuyingEventBLL(loggingSessionInfo);
            //更新模板点击数量
            T_CTW_LEventTemplateBLL bllTemplate = new T_CTW_LEventTemplateBLL(loggingSessionInfo);

            try
            {
                bllTemplate.UpdateTemplateInfo(para.TemplateId, 2);
            }
            catch { }
            ///获取模版信息
            DataSet dsInteraction = bllInteraction.GetEventInteractionByTemplateId(para.TemplateId);

            if (dsInteraction != null && dsInteraction.Tables[0].Rows.Count > 0)
            {
                var entityInteraction = DataTableToObject.ConvertToList <EventInteractionInfo>(dsInteraction.Tables[0]);

                var entityTheme = DataTableToObject.ConvertToList <CTW_LEventThemeEntity>(bllTheme.GetThemeInfo(para.TemplateId).Tables[0]);//.QueryByEntity(new CTW_LEventThemeEntity() { TemplateId = new Guid(para.TemplateId), IsDelete = 0 }, null);
                List <CTW_LEventThemeEntity> listTheme = new List <CTW_LEventThemeEntity>();
                foreach (var theme in entityTheme)
                {
                    List <EventInteractionInfo> listEventInteractionInfo = new List <EventInteractionInfo>();

                    ///互动信息
                    foreach (var itemAction in entityInteraction.Where(a => a.ThemeId == theme.ThemeId.ToString() && a.TemplateId == theme.TemplateId.ToString()))
                    {
                        listEventInteractionInfo.Add(itemAction);
                        if (itemAction.InteractionType == 1)
                        {
                            itemAction.GameEventImageList = DataTableToObject.ConvertToList <GameEventImageInfo>(bllEvents.GetImageList(itemAction.LeventId).Tables[0]);
                        }
                        if (itemAction.InteractionType == 2)//促销
                        {
                            itemAction.PanicbuyingEventImage = DataTableToObject.ConvertToObject <PanicbuyingEventImageInfo>(bllPanicbuying.GetPanicbuyingEventImage(itemAction.LeventId).Tables[0].Rows[0]);
                        }
                        theme.EventInteractionList = listEventInteractionInfo;
                    }
                    ;
                    listTheme.Add(theme);
                    rd.TemplateThemeList = listTheme;
                }
                rd.ActivityGroupId = entityTheme.FirstOrDefault().ActivityGroupId;
                rd.TemplateId      = entityTheme.FirstOrDefault().TemplateId.ToString();
                rd.TemplateName    = entityTheme.FirstOrDefault().TemplateName;
                rd.ImageURL        = dsInteraction.Tables[0].Rows[0]["ImageURL"].ToString();
                //推广设置
                DataSet dsSpresd = bllSpreadSetting.GetSpreadSettingInfoByTemplateId(para.TemplateId);
                if (dsSpresd != null && dsSpresd.Tables[0].Rows.Count > 0)
                {
                    rd.TemplateSpreadSettingList = DataTableToObject.ConvertToList <CTW_SpreadSettingEntity>(dsSpresd.Tables[0]);
                }

                ///获取商户所有信息
                if (!string.IsNullOrEmpty(para.CTWEventId))
                {
                    T_CTW_LEventBLL bllCTWEvent = new T_CTW_LEventBLL(loggingSessionInfo);
                    DataSet         dsCTWEvent  = bllCTWEvent.GetLeventInfoByCTWEventId(para.CTWEventId);
                    ObjectImagesBLL bllImage    = new ObjectImagesBLL(loggingSessionInfo);
                    var             bllPrizes   = new LPrizesBLL(loggingSessionInfo);

                    T_CTW_SpreadSettingBLL bllCustomerSpreadSetting = new T_CTW_SpreadSettingBLL(loggingSessionInfo);
                    if (dsCTWEvent != null && dsCTWEvent.Tables.Count > 0 && dsCTWEvent.Tables[0].Rows.Count > 0)
                    {
                        rd.CustomerCTWEventInfo = DataTableToObject.ConvertToObject <CustomerCTWEventInfo>(dsCTWEvent.Tables[0].Rows[0]);
                        //游戏活动信息
                        if (dsCTWEvent.Tables[0].Rows[0]["InteractionType"].ToString() == "1")
                        {
                            LEventsBLL bllLevents = new LEventsBLL(loggingSessionInfo);
                            string     strEventId = dsCTWEvent.Tables[0].Rows[0]["LeventId"].ToString();
                            var        ds         = bllLevents.GetNewEventInfo(strEventId);
                            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.EventInfo = DataTableToObject.ConvertToObject <LEventsInfo>(ds.Tables[0].Rows[0]);//直接根据所需要的字段反序列化
                            }
                            DataSet dsPrizes = bllPrizes.GetPirzeList(strEventId);
                            if (dsPrizes.Tables != null && dsPrizes.Tables.Count > 0 && dsPrizes.Tables[0] != null && dsPrizes.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.EventInfo.PrizeList = DataTableToObject.ConvertToList <Prize>(dsPrizes.Tables[0]);
                            }


                            rd.CustomerCTWEventInfo.EventInfo.ImageList = bllImage.QueryByEntity(new ObjectImagesEntity()
                            {
                                ObjectId = strEventId, IsDelete = 0
                            }, null).ToList();
                        }
                        //促销活动信息
                        if (dsCTWEvent.Tables[0].Rows[0]["InteractionType"].ToString() == "2")
                        {
                            T_CTW_PanicbuyingEventKVBLL bllPanicbuyingEventKV = new T_CTW_PanicbuyingEventKVBLL(loggingSessionInfo);
                            rd.CustomerCTWEventInfo.PanicbuyingEventInfo = DataTableToObject.ConvertToObject <T_CTW_PanicbuyingEventKVEntity>(bllPanicbuyingEventKV.GetPanicbuyingEventKV(para.CTWEventId).Tables[0].Rows[0]);
                            T_CTW_LEventInteractionBLL bllEventInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);
                            DataSet dsP = bllEventInteraction.GetPanicbuyingEventId(para.CTWEventId);
                            if (dsP != null && dsP.Tables.Count > 0 && dsP.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.PanicbuyingEventInfo.PanicbuyingEventList = DataTableToObject.ConvertToList <PanicbuyingEventId>(dsP.Tables[0]);
                            }
                        }

                        //图文信息
                        var ds2 = bllCTWEvent.GetMaterialTextInfo(dsCTWEvent.Tables[0].Rows[0]["OnlineQRCodeId"].ToString());//活动图文素材对应的keyword其实是这个活动的标识,也就是生成二维码的关键字
                        if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
                        {
                            rd.CustomerCTWEventInfo.MaterialText = DataTableToObject.ConvertToObject <WMaterialTextEntity>(ds2.Tables[0].Rows[0]);//直接根据所需要的字段反序列化
                            rd.CustomerCTWEventInfo.MappingId    = ds2.Tables[0].Rows[0]["MappingId"].ToString();
                        }
                        //推广设置

                        DataSet dsCustomerSpread = bllCustomerSpreadSetting.GetSpreadSettingByCTWEventId(para.CTWEventId);
                        if (dsCustomerSpread != null && dsCustomerSpread.Tables[0].Rows.Count > 0)
                        {
                            rd.CustomerCTWEventInfo.SpreadSettingList = DataTableToObject.ConvertToList <T_CTW_SpreadSettingEntity>(dsCustomerSpread.Tables[0]);
                        }
                        //触点
                        ContactEventBLL bllContactEvent = new ContactEventBLL(loggingSessionInfo);
                        DataSet         dsContact       = bllContactEvent.GetContactEventByCTWEventId(para.CTWEventId);
                        if (dsContact != null && dsContact.Tables[0].Rows.Count > 0)
                        {
                            List <ContactEventInfo> ContactInfoList = new List <ContactEventInfo>();
                            ContactEventInfo        ContactInfo     = new ContactEventInfo();
                            foreach (DataRow dr in dsContact.Tables[0].Rows)
                            {
                                ContactInfo = new ContactEventInfo();
                                ContactInfo.ContactTypeCode = dr["ContactTypeCode"].ToString();
                                DataSet dsPrizes = bllPrizes.GetPirzeListForCTW(dr["ContactEventId"].ToString());
                                if (dsPrizes.Tables != null && dsPrizes.Tables.Count > 0 && dsPrizes.Tables[0] != null && dsPrizes.Tables[0].Rows.Count > 0)
                                {
                                    ContactInfo.ContactPrizeList = DataTableToObject.ConvertToList <Prize>(dsPrizes.Tables[0]);
                                }
                                ContactInfoList.Add(ContactInfo);
                            }
                            rd.CustomerCTWEventInfo.ContactEventList = ContactInfoList;
                        }
                    }


                    rd.CTWEventId = para.CTWEventId;
                }
                else
                {
                    rd.CTWEventId = Guid.NewGuid().ToString();
                }
            }
            return(rd);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 获取活动相册信息
        /// </summary>
        public string GetEventAlbum()
        {
            string content = string.Empty;

            var respData = new GetEventAlbumRespData();

            try
            {
                string reqContent = Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <GetEventAlbumReqData>();

                string eventId    = reqObj.special.eventId;                     //活动ID
                string moduleType = (reqObj.special.eventType ?? 1).ToString(); //1: 活动

                if (string.IsNullOrEmpty(eventId))
                {
                    throw new Exception("活动ID不能为空");
                    //eventId = "3DD35B9A122F41C8A0E5D5B78D72CE65";
                }

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("GetEventAlbum: {0}", reqContent)
                });

                //判断客户ID是否传递
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                respData.content           = new GetEventAlbumRespContentData();
                respData.content.albumList = new List <AlbumEntity>();

                var eventList = new LEventsBLL(loggingSessionInfo).QueryByEntity(new LEventsEntity {
                    EventID = eventId
                }, null);

                if (eventList != null && eventList.Length > 0)
                {
                    var eventEntity = eventList.FirstOrDefault();

                    respData.content.title       = eventEntity.Title;
                    respData.content.description = eventEntity.Description;
                    respData.content.imageUrl    = eventEntity.ImageURL;

                    #region 相册信息

                    LEventsAlbumBLL albumService = new LEventsAlbumBLL(loggingSessionInfo);

                    var albumList = albumService.QueryByEntity(new LEventsAlbumEntity {
                        ModuleId = eventId, ModuleType = moduleType
                    },
                                                               new OrderBy[] { new OrderBy {
                                                                                   FieldName = " SortOrder ", Direction = OrderByDirections.Asc
                                                                               } });

                    if (albumList != null && albumList.Length > 0)
                    {
                        foreach (var item in albumList)
                        {
                            var entity = new AlbumEntity()
                            {
                                albumId    = item.AlbumId,
                                albumTitle = item.Title,
                                albumType  = item.Type,
                                imageUrl   = item.ImageUrl,
                                count      = item.Count
                            };

                            respData.content.albumList.Add(entity);
                        }
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                //respData.exception = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
0
        private void loadUser(string customer_id, string token)
        {
            //try
            //{
            //获取登录管理平台的用户信息
            var AuthWebService = new JIT.CPOS.BS.WebServices.AuthManagerWebServices.AuthServiceSoapClient();

            AuthWebService.Endpoint.Address = new System.ServiceModel.EndpointAddress(
                ConfigurationManager.AppSettings["sso_url"].ToString() + "/AuthService.asmx");
            //   AuthWebService.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:42305/AuthService.asmx");

            //AuthWebService.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://localhost:7335/AuthService.asmx");
            if (token == null)
            {
                token = "";
            }
            string str = AuthWebService.GetLoginUserInfo(token);

            if (string.IsNullOrEmpty(str))
            {
                //this.lbErr.Text = "用户不存在,请与管理员联系";
                //return;
                PageLog.Current.Write("SSO登录失败,AuthWebService.asmx返回空数据");
                //Response.Write("登录失败,请重试!");
                //Response.End();
                var redirectUrl = ConfigurationManager.AppSettings["sso_url"].ToString() + "?errorinfo=" + "网络繁忙,请重新登录!";
                //var redirectUrl = "http://localhost:7335/login.aspx";
                Response.Redirect(redirectUrl, true);
            }

            var myLoggingManager = (JIT.CPOS.BS.Entity.LoggingManager)cXMLService.Deserialize(
                str, typeof(JIT.CPOS.BS.Entity.LoggingManager));

            //判断登录进来的用户是否存在,并且返回用户信息
            LoggingSessionInfo loggingSession = new LoggingSessionInfo();

            loggingSession.CurrentLoggingManager = myLoggingManager;
            cUserService userService = new cUserService(loggingSession);
            UnitService  unitService = new UnitService(loggingSession);

            if (!userService.IsExistUser(loggingSession))
            {
                this.lbErr.Text = "用户不存在,请与管理员联系";
                return;
            }
            var login_user = userService.GetUserById(loggingSession, myLoggingManager.User_Id);

            loggingSession.CurrentUser = login_user;

            // 获取角色
            string applicationId = PageBase.JITPage.GetApplicationId();
            IList <UserRoleInfo> userRoleList = userService.GetUserRoles(login_user.User_Id, applicationId);

            if (userRoleList != null && userRoleList.Count > 0)
            {
                loggingSession.CurrentUserRole          = new UserRoleInfo();
                loggingSession.CurrentUserRole.UserId   = login_user.User_Id;
                loggingSession.CurrentUserRole.UserName = login_user.User_Name;
                loggingSession.CurrentUserRole.RoleId   = userRoleList[0].RoleId;
                loggingSession.CurrentUserRole.RoleCode = userRoleList[0].RoleCode;
                loggingSession.CurrentUserRole.RoleName = userRoleList[0].RoleName;

                loggingSession.ClientID = login_user.customer_id;
                loggingSession.CurrentLoggingManager.Customer_Id = login_user.customer_id;
                loggingSession.UserID = loggingSession.CurrentUser.User_Id;

                try
                {
                    loggingSession.CurrentUserRole.UnitId = userService.GetDefaultUnitByUserIdAndRoleId(
                        loggingSession.CurrentUserRole.UserId, loggingSession.CurrentUserRole.RoleId);
                }
                catch (Exception ex)
                {
                    PageLog.Current.Write(ex);
                    Response.Write("找不到默认单位");
                    Response.End();
                }

                try
                {
                    var unitInfo = unitService.GetUnitById(loggingSession.CurrentUserRole.UnitId);
                    loggingSession.CurrentUserRole.UnitName      = unitInfo.Name;
                    loggingSession.CurrentUserRole.UnitShortName = unitInfo.ShortName;
                }
                catch (Exception ex)
                {
                    PageLog.Current.Write(ex);
                    Response.Write("找不到单位");
                    Response.End();
                }
            }
            else
            {
                //PageLog.Current.Write(ex);
                Response.Write("该用户没有权限登录管理平台");
                Response.End();
            }



            //this.Session["UserInfo"] = login_user;
            //this.Session["LoggingManager"] = myLoggingManager;
            //this.Session["loggingSessionInfo"] = loggingSession;


            //loggingSession.CurrentLoggingManager = myLoggingManager;
            new SessionManager().SetCurrentUserLoginInfo(loggingSession);

            //清空密码
            login_user.User_Password = null;
            //string go_url = "~/login/SelectRoleUnit.aspx?p=0";
            string go_url = "~/Default.aspx";

            if (loggingSession.CurrentUserRole != null && loggingSession.CurrentUserRole.RoleId == "860E69754D3B490F8A5B401DF3F66E15")
            {
                string eventId = string.Empty;
                //switch (loggingSession.CurrentUserRole.UserId.Trim())
                //{
                //    case "FA1BDA8937924D45AFA3123FE4DEE8FA":
                //        eventId = "0326056B219340D5B234BFAD9AF02AF5";
                //        break;
                //    case "4913B21CFD714C7986842B859EC1289B":
                //        eventId = "793150439CF94190A70CF2EC229A951D";
                //        break;
                //    case "BD8079F886BD492E90A335EBC1DE9676":
                //        eventId = "F8A7E2E8807B49558F1A516F23C34473";
                //        break;
                //    default:
                //        eventId = "793150439CF94190A70CF2EC229A951D";
                //        break;
                //}
                LEventsBLL lEventsBLL = new LEventsBLL(loggingSession);
                var        eventList  = lEventsBLL.QueryByEntity(new LEventsEntity()
                {
                    EventManagerUserId = loggingSession.CurrentUserRole.UserId
                }, null);
                if (eventList != null && eventList.Length > 0)
                {
                    eventId = eventList[0].EventID;
                    loggingSession.CurrentUserRole.RoleName = eventId;
                    Response.Redirect("~/Module/MarketEvent/EventList/EventAnalysisList4.aspx", true);
                }
            }
            else
            {
                //loggingSession.CurrentUserRole.RoleName = "793150439CF94190A70CF2EC229A951D";
                Response.Redirect(go_url, true);
            }
            //}
            //catch (Exception ex)
            //{
            //    PageLog.Current.Write(ex);
            //    lbErr.Text = "登录失败";
            //}
        }
Ejemplo n.º 25
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");
            var leventsBll         = new LEventsBLL(this.CurrentUserInfo);
            var vipService         = new VipBLL(loggingSessionInfo);
            var levents            = leventsBll.QueryByEntity(new LEventsEntity()
            {
                EventID = eventId
            }, null);

            Loggers.Debug(new DebugLogInfo()
            {
                Message = string.Format("zk levent==null:{0}", null == levents)
            });
            if (null == levents || levents.Length == 0)
            {
                return(rd);
            }
            var levent = levents.FirstOrDefault();

            rd.IsShare        = levent.IsShare == null ? 0 : levent.IsShare.Value;
            rd.BootUrl        = levent.BootURL;
            rd.PosterImageUrl = levent.PosterImageUrl;
            rd.ShareLogoUrl   = levent.ShareLogoUrl;
            rd.ShareRemark    = levent.ShareRemark;
            rd.OverRemark     = levent.OverRemark;
            if (string.IsNullOrEmpty(levent.EventFlag))
            {
                rd.SignFlag = 0;
            }
            else
            {
                if (levent.EventFlag.Substring(0, 1) == "1")
                {
                    rd.SignFlag = 1;
                }
                else
                {
                    rd.SignFlag = 0;
                }
            }
            Loggers.Debug(new DebugLogInfo()
            {
                Message = string.Format("zk levent.BootURL:{0}", levent.BootURL)
            });
            return(rd);
        }
Ejemplo n.º 26
0
        public void PushWeiXin(string OpenId, LoggingSessionInfo loggingSessionInfo, string OrderId, string VipId)
        {
            string webUrl  = ConfigurationManager.AppSettings["website_url"];
            string msgUrl  = ConfigurationManager.AppSettings["push_weixin_msg_url"];;
            Random rad     = new Random();
            string msgText = "<a href='" + webUrl + "wap/Event/20131109/aboutEvent.htm'>点击查看本次活动议程</a>";
            string msgData = "<xml><OpenID><![CDATA[" + OpenId + "]]></OpenID>"
                             + "<Content><![CDATA[" + msgText + "]]></Content></xml>";

            //var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData);
            #region 发送日志
            MarketSendLogBLL    logServer = new MarketSendLogBLL(loggingSessionInfo);
            MarketSendLogEntity logInfo   = new MarketSendLogEntity();
            logInfo.LogId           = BaseService.NewGuidPub();
            logInfo.IsSuccess       = 1;
            logInfo.MarketEventId   = OrderId;
            logInfo.SendTypeId      = "2";
            logInfo.TemplateContent = msgData;
            logInfo.VipId           = VipId;
            logInfo.WeiXinUserId    = OpenId;
            logInfo.CreateTime      = System.DateTime.Now;
            logServer.Create(logInfo);
            #endregion

            #region
            msgText = "亲爱的,为答谢您参加本次活动,主办方推出多个奖品的刮刮卡等你来刮,快来试试运气,<a href='" + webUrl + "OnlineClothing/1109guagua.html?customerId="
                      + loggingSessionInfo.CurrentUser.customer_id
                      + "&userId="
                      + VipId
                      + "&openId="
                      + OpenId
                      + "&eventId=" + OrderId + "'>点击试试手气</a>";
            //msgData = "<xml><OpenID><![CDATA[" + OpenId + "]]></OpenID>"
            //                + "<Content><![CDATA[" + msgText + "]]></Content></xml>";
            LEventsBLL    eventServer = new LEventsBLL(loggingSessionInfo);
            LEventsEntity eventInfo   = new LEventsEntity();
            eventInfo = eventServer.GetByID(OrderId);
            if (eventInfo != null && eventInfo.EventID != null)
            {
                string picUrl1 = eventInfo.Content;
                string Url1    = "" + webUrl + "OnlineClothing/1109guagua.html?customerId="
                                 + loggingSessionInfo.CurrentUser.customer_id
                                 + "&userId="
                                 + VipId
                                 + "&openId="
                                 + OpenId
                                 + "&eventId=" + OrderId + "";
                msgData = "<xml>"
                          + "<OpenID><![CDATA[" + OpenId + "]]></OpenID>"
                          + "<MsgType><![CDATA[news]]></MsgType>"
                          + "<Articles>"
                          + "<item>"
                          + "<Title><![CDATA[活动刮刮卡,惊喜享不停!]]></Title> "
                          + "<Description><![CDATA[亲!为答谢您来参加本次活动,我们特别推出刮刮卡,大量精美奖品等你来取,快来试试运气吧。]]></Description> "
                          + "<Url><![CDATA[" + Url1 + "]]></Url> "
                          + "<PicUrl><![CDATA[" + picUrl1 + "]]></PicUrl> "
                          + "</item>"
                          + "</Articles>"
                          + "</xml>";

                var msgResult1 = Common.Utils.GetRemoteData(msgUrl, "POST", msgData);
            }
            #endregion

            #region 发送日志
            MarketSendLogEntity logInfo1 = new MarketSendLogEntity();
            logInfo1.LogId           = BaseService.NewGuidPub();
            logInfo1.IsSuccess       = 1;
            logInfo1.MarketEventId   = OrderId;
            logInfo1.SendTypeId      = "2";
            logInfo1.TemplateContent = msgData;
            logInfo1.VipId           = VipId;
            logInfo1.WeiXinUserId    = OpenId;
            logInfo1.CreateTime      = System.DateTime.Now;
            logServer.Create(logInfo1);
            #endregion
        }