/// <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);
        }
        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);
                        }
                    }
                }
            }
        }
        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 = "登录失败";
            //}
        }
Beispiel #4
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);
        }