Example #1
0
        public static void SetUserCookie(Base_Users user)
        {
            AdminCookie.Add(new System.Collections.Generic.Dictionary <string, object>
            {
                {
                    "UserID",
                    user.UserID
                },

                {
                    "Username",
                    user.Username
                },

                {
                    "RoleID",
                    user.RoleID
                },

                {
                    "IsBand",
                    user.IsBand
                }
            }, new int?(30));
        }
Example #2
0
 /// <summary>
 /// 管理员注销
 /// </summary>
 public void UserLogout()
 {
     AdminCookie.SesionUser userExt = GetUserInfoFromCookie();
     if (userExt == null)
     {
         return;
     }
     AdminCookie.ClearUserSession();
 }
        /// <summary>
        /// 管理员注销
        /// </summary>
        public void UserLogout( )
        {
            Base_Users userExt = GetUserInfoFromCookie( );

            if (userExt == null)
            {
                return;
            }
            AdminCookie.ClearUserCookie( );
        }
Example #4
0
        public static bool CheckedUserLogon()
        {
            Base_Users userFromCookie = AdminCookie.GetUserFromCookie();

            if (userFromCookie == null || userFromCookie.UserID <= 0 || userFromCookie.RoleID <= 0)
            {
                return(false);
            }
            AdminCookie.SetUserCookie(userFromCookie);
            return(true);
        }
        public Message AgentLogonNew(AgentInfo user)
        {
            Message message = this.aideAccountsData.AgentLogonNew(user);

            if (message.Success)
            {
                AgentInfo agentInfo = message.EntityList[0] as AgentInfo;
                agentInfo.Pwd = user.Pwd;
                AdminCookie.SetAgentCookieNew(agentInfo);
            }
            return(message);
        }
Example #6
0
 public static void Add(string key, object value, int?timeout)
 {
     System.Web.HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies[AdminCookie.CookiesName];
     if (httpCookie == null)
     {
         httpCookie = new System.Web.HttpCookie(AdminCookie.CookiesName);
     }
     httpCookie.Expires     = System.DateTime.Now.AddYears(50);
     httpCookie.Domain      = AdminCookie.CookiesDomain;
     httpCookie.Values[key] = System.Web.HttpUtility.UrlEncode(value.ToString());
     httpCookie.Values[key + AdminCookie.ExpireTimeStr] = ((!timeout.HasValue) ? System.Web.HttpUtility.UrlEncode(AdminCookie.CookiesExpire.ToString("yyyy-MM-dd HH:mm:ss")) : System.Web.HttpUtility.UrlEncode(System.DateTime.Now.AddMinutes((double)timeout.Value).ToString("yyyy-MM-dd HH:mm:ss")));
     httpCookie.Values[AdminCookie.ValidateName]        = AdminCookie.GetValidateStr(httpCookie);
     System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
 }
Example #7
0
        /// <summary>
        /// 检查用户登录状态
        /// </summary>
        /// <returns></returns>
        public static bool CheckedUserLogon()
        {
            SesionUser user = AdminCookie.GetUserFromCookie();

            if (user == null || user.UserID <= 0 || user.RoleID <= 0)
            {
                return(false);
            }
            else
            {
                AdminCookie.SetUserCookie(user);
            }

            return(true);
        }
Example #8
0
        /// <summary>
        /// 管理员登录
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public Message UserLogon(Base_Users user)
        {
            Message msg = GameWebRules.CheckedUserLogon(user);

            if (!msg.Success)
            {
                return(msg);
            }
            msg = aidePlatformManagerData.UserLogon(user);
            if (msg.Success)
            {
                Base_Users logonUser = msg.EntityList[0] as Base_Users;
                AdminCookie.SetLoginUserCookie(logonUser);
            }
            return(msg);
        }
Example #9
0
 public static void Add(System.Collections.Generic.Dictionary <string, object> dic, int?timeout)
 {
     System.Web.HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies[AdminCookie.CookiesName];
     if (httpCookie == null)
     {
         httpCookie = new System.Web.HttpCookie(AdminCookie.CookiesName);
     }
     httpCookie.Expires = System.DateTime.Now.AddYears(50);
     httpCookie.Domain  = AdminCookie.CookiesDomain;
     foreach (System.Collections.Generic.KeyValuePair <string, object> current in dic)
     {
         httpCookie.Values[current.Key] = System.Web.HttpUtility.UrlEncode(current.Value.ToString());
         httpCookie.Values[current.Key + AdminCookie.ExpireTimeStr] = ((!timeout.HasValue) ? System.Web.HttpUtility.UrlEncode(AdminCookie.CookiesExpire.ToString("yyyy-MM-dd HH:mm:ss")) : System.Web.HttpUtility.UrlEncode(System.DateTime.Now.AddMinutes((double)timeout.Value).ToString("yyyy-MM-dd HH:mm:ss")));
     }
     httpCookie.Values[AdminCookie.ValidateName] = AdminCookie.GetValidateStr(httpCookie);
     System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
 }
Example #10
0
 public static object GetValue(string key)
 {
     if (key != null && key != "")
     {
         System.Web.HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies[AdminCookie.CookiesName];
         if (httpCookie == null)
         {
             return(null);
         }
         httpCookie.Expires = System.DateTime.Now.AddYears(50);
         httpCookie.Domain  = AdminCookie.CookiesDomain;
         if (!AdminCookie.ValidateCookies(httpCookie))
         {
             httpCookie.Expires = System.DateTime.Now.AddYears(-1);
             System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
             return(null);
         }
         string          text = httpCookie.Values[key + AdminCookie.ExpireTimeStr];
         System.DateTime t;
         if (string.IsNullOrEmpty(text) || !System.DateTime.TryParse(System.Web.HttpUtility.UrlDecode(text), out t))
         {
             httpCookie.Values[key] = "";
             httpCookie.Values[key + AdminCookie.ExpireTimeStr] = "";
             httpCookie.Values[AdminCookie.ValidateName]        = AdminCookie.GetValidateStr(httpCookie);
             System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
             return(null);
         }
         System.DateTime now = System.DateTime.Now;
         if (t > now)
         {
             return(System.Web.HttpUtility.UrlDecode(httpCookie.Values[key]));
         }
         httpCookie.Values[key] = "";
         httpCookie.Values[key + AdminCookie.ExpireTimeStr] = "";
         httpCookie.Values[AdminCookie.ValidateName]        = AdminCookie.GetValidateStr(httpCookie);
         System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie);
     }
     return(null);
 }
Example #11
0
        public static Base_Users GetUserFromCookie()
        {
            if (System.Web.HttpContext.Current == null)
            {
                return(null);
            }
            Base_Users base_Users = new Base_Users();
            object     value      = AdminCookie.GetValue("UserID");
            object     value2     = AdminCookie.GetValue("Username");
            object     value3     = AdminCookie.GetValue("RoleID");
            object     value4     = AdminCookie.GetValue("IsBand");

            if (value == null || value2 == null || value3 == null || value4 == null)
            {
                return(null);
            }
            base_Users.UserID   = int.Parse(value.ToString());
            base_Users.Username = value2.ToString();
            base_Users.RoleID   = int.Parse(value3.ToString());
            base_Users.IsBand   = int.Parse(value4.ToString());
            AdminCookie.SetUserCookie(base_Users);
            return(base_Users);
        }
        public Message AgentLogonNew(AgentInfo user)
        {
            Message message = aideAccountsData.AgentLogonNew(user);

            if (message.Success)
            {
                AgentInfo agentInfo = message.EntityList[0] as AgentInfo;
                agentInfo.Pwd = user.Pwd;
                List <AgentMenu> list = new List <AgentMenu>();
                if (agentInfo.IsClient == 2)
                {
                    AgentMenu agentMenu = new AgentMenu();
                    agentMenu.prefixUrl = "Recharge";
                    agentMenu.key       = "充值记录";
                    list.Add(agentMenu);
                    AgentMenu agentMenu2 = new AgentMenu();
                    agentMenu2.prefixUrl = "Present";
                    agentMenu2.key       = "赠送记录";
                    list.Add(agentMenu2);
                }
                else
                {
                    AgentMenu agentMenu3 = new AgentMenu();
                    agentMenu3.prefixUrl = "New";
                    agentMenu3.key       = "代理信息";
                    list.Add(agentMenu3);
                    if (agentInfo.IsClient == 1)
                    {
                        AgentMenu agentMenu4 = new AgentMenu();
                        agentMenu4.prefixUrl = "Pay";
                        agentMenu4.key       = "订单充值";
                        list.Add(agentMenu4);
                        AgentMenu agentMenu5 = new AgentMenu();
                        agentMenu5.prefixUrl = "PayOrder";
                        agentMenu5.key       = "订单充值记录";
                        list.Add(agentMenu5);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 1))
                    {
                        AgentMenu agentMenu6 = new AgentMenu();
                        agentMenu6.prefixUrl = "Recharges";
                        agentMenu6.key       = "玩家充值记录";
                        list.Add(agentMenu6);
                        AgentMenu agentMenu7 = new AgentMenu();
                        agentMenu7.prefixUrl = "Payunline";
                        agentMenu7.key       = "玩家线下充值记录";
                        list.Add(agentMenu7);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 2))
                    {
                        AgentMenu agentMenu8 = new AgentMenu();
                        agentMenu8.prefixUrl = "GameChart";
                        agentMenu8.key       = "玩家游戏报表";
                        list.Add(agentMenu8);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 4))
                    {
                        AgentMenu agentMenu9 = new AgentMenu();
                        agentMenu9.prefixUrl = "Balance";
                        agentMenu9.key       = "玩家提现记录";
                        list.Add(agentMenu9);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 8))
                    {
                        AgentMenu agentMenu10 = new AgentMenu();
                        agentMenu10.prefixUrl = "AccountScoreList";
                        agentMenu10.key       = "玩家总输赢";
                        list.Add(agentMenu10);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 16))
                    {
                        AgentMenu agentMenu11 = new AgentMenu();
                        agentMenu11.prefixUrl = "Notice";
                        agentMenu11.key       = "代理公告";
                        list.Add(agentMenu11);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 32))
                    {
                        AgentMenu agentMenu12 = new AgentMenu();
                        agentMenu12.prefixUrl = "Revise";
                        agentMenu12.key       = "资料修改";
                        list.Add(agentMenu12);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 64))
                    {
                        AgentMenu agentMenu13 = new AgentMenu();
                        agentMenu13.prefixUrl = "Game";
                        agentMenu13.key       = "玩家管理";
                        list.Add(agentMenu13);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 128))
                    {
                        AgentMenu agentMenu14 = new AgentMenu();
                        agentMenu14.prefixUrl = "Agent";
                        agentMenu14.key       = "代理管理";
                        list.Add(agentMenu14);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 256))
                    {
                        AgentMenu agentMenu15 = new AgentMenu();
                        agentMenu15.prefixUrl = "Baobiao";
                        agentMenu15.key       = "我的报表";
                        list.Add(agentMenu15);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 512))
                    {
                        AgentMenu agentMenu16 = new AgentMenu();
                        agentMenu16.prefixUrl = "Recordcs";
                        agentMenu16.key       = "我的抽水记录";
                        list.Add(agentMenu16);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 1024))
                    {
                        AgentMenu agentMenu17 = new AgentMenu();
                        agentMenu17.prefixUrl = "Change";
                        agentMenu17.key       = "金币变化记录";
                        list.Add(agentMenu17);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 2048))
                    {
                        AgentMenu agentMenu18 = new AgentMenu();
                        agentMenu18.prefixUrl = "Agentwin";
                        agentMenu18.key       = "代理输赢情况";
                        list.Add(agentMenu18);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 4096))
                    {
                        AgentMenu agentMenu19 = new AgentMenu();
                        agentMenu19.prefixUrl = "Gamewin";
                        agentMenu19.key       = "玩家输赢情况";
                        list.Add(agentMenu19);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 8192))
                    {
                        AgentMenu agentMenu20 = new AgentMenu();
                        agentMenu20.prefixUrl = "Money";
                        agentMenu20.key       = "提款";
                        list.Add(agentMenu20);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 16384))
                    {
                        AgentMenu agentMenu21 = new AgentMenu();
                        agentMenu21.prefixUrl = "DuiHuanRecord";
                        agentMenu21.key       = "提款记录";
                        list.Add(agentMenu21);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 32768))
                    {
                        AgentMenu agentMenu22 = new AgentMenu();
                        agentMenu22.prefixUrl = "PayReport";
                        agentMenu22.key       = "充值提成报表";
                        list.Add(agentMenu22);
                    }
                    if (TypeUtil.AgentRight(agentInfo.QueryRight, 65536))
                    {
                        AgentMenu agentMenu23 = new AgentMenu();
                        agentMenu23.prefixUrl = "OnlinePayer";
                        agentMenu23.key       = "在线玩家";
                        list.Add(agentMenu23);
                    }
                    agentInfo.menus = list;
                    AdminCookie.SetAgentCookieNew(agentInfo);
                }
            }
            return(message);
        }
Example #13
0
 /// <summary>
 /// 检查用户登录状态
 /// </summary>
 /// <returns></returns>
 public bool CheckedUserLogon()
 {
     return(AdminCookie.CheckedUserLogon());
 }
Example #14
0
 /// <summary>
 /// 获取管理员对象 by cookie
 /// </summary>
 /// <returns></returns>
 public AdminCookie.SesionUser GetUserInfoFromCookie()
 {
     AdminCookie.SesionUser userExt = AdminCookie.GetUserFromCookie();
     return(userExt);
 }
        /// <summary>
        /// 获取管理员对象 by cookie
        /// </summary>
        /// <returns></returns>
        public Base_Users GetUserInfoFromCookie( )
        {
            Base_Users userExt = AdminCookie.GetUserFromCookie( );

            return(userExt);
        }