Beispiel #1
0
        public static DataSet GetPagerData(int intPageSize, int intCurrentPageIndex)
        {
            int num  = 0;
            int num2 = 0;

            return(LoginLog.GetPagerData(intPageSize, intCurrentPageIndex, ref num, ref num2));
        }
Beispiel #2
0
        public void AddLoginLog(UserType userType, string strUserName, bool isLogined)
        {
            LoginLogInfo last   = LoginLog.GetLast(userType, strUserName);
            LoginLogInfo entity = new LoginLogInfo
            {
                UserType       = userType.ToString(),
                UserName       = strUserName,
                IPAddress      = IPUtils.GetIP(),
                IPArea         = ((userType == UserType.Manager) ? IPUtils.GetIPAreaFromPcOnline(IPUtils.GetIP()) : string.Empty),
                LoginStatus    = (isLogined ? 1 : 0),
                LoginFailCount = ((!isLogined) ? ((last == null) ? 1 : (last.LoginFailCount + 1)) : 0),
                Lang           = JObject.cultureLang,
                AutoTimeStamp  = DateTime.Now
            };

            LoginLog.Add(entity);
        }
Beispiel #3
0
        public static IList <LoginLogInfo> GetList(int intTopCount, string strCondition)
        {
            string strSort = " Sort asc,AutoID desc ";

            return(LoginLog.GetList(intTopCount, strCondition, strSort));
        }
Beispiel #4
0
 public static IList <LoginLogInfo> GetTopNList(int intTopCount, string strSort)
 {
     return(LoginLog.GetList(intTopCount, string.Empty, strSort));
 }
Beispiel #5
0
 public static IList <LoginLogInfo> GetAllList()
 {
     return(LoginLog.GetList(0, string.Empty));
 }
Beispiel #6
0
 public static LoginLogInfo GetTopData()
 {
     return(LoginLog.GetTopData(" Sort ASC,AutoID desc "));
 }
Beispiel #7
0
 public static LoginLogInfo GetLast(string strUserName)
 {
     return(LoginLog.GetLast(UserType.Manager, strUserName));
 }
Beispiel #8
0
 public static IList <LoginLogInfo> GetPagerList(int intCurrentPageIndex, int intPageSize, ref int intTotalCount, ref int intTotalPage)
 {
     return(LoginLog.GetPagerList("", "Sort ASC,AutoID DESC", intCurrentPageIndex, intPageSize, ref intTotalCount, ref intTotalPage));
 }
Beispiel #9
0
 public static DataSet GetPagerData(string strFilter, string strCondition, int intPageSize, int intCurrentPageIndex, ref int intTotalCount, ref int intTotalPage)
 {
     return(LoginLog.GetPagerData(strFilter, strCondition, " Sort asc,AutoID desc ", intPageSize, intCurrentPageIndex, ref intTotalCount, ref intTotalPage));
 }
Beispiel #10
0
 public static DataSet GetPagerData(string strCondition, int intPageSize, int intCurrentPageIndex, ref int intTotalCount, ref int intTotalPage)
 {
     return(LoginLog.GetPagerData("*", strCondition, intPageSize, intCurrentPageIndex, ref intTotalCount, ref intTotalPage));
 }
Beispiel #11
0
        public static LoginStatus UserLogin(string strLoginName, string strEncryPassword, ref UserInfo userRef)
        {
            SqlParameter[] arrParam = new SqlParameter[]
            {
                new SqlParameter("@loginname", strLoginName)
            };
            userRef = BizBase.dbo.GetModel <UserInfo>(BizBase.dbo.ExecProcReReader("p_System_UserLogin", arrParam));
            LoginLogInfo last = LoginLog.GetLast(UserType.User, strLoginName);
            LoginStatus  result;

            if (userRef == null)
            {
                result = LoginStatus.UserNameIncorrect;
            }
            else if (last != null && last.LoginFailCount >= ConfigProvider.Configs.TryLoginTimes && (DateTime.Now - last.AutoTimeStamp).TotalMinutes < 5.0)
            {
                result = LoginStatus.MutilLoginFail;
            }
            else if (strEncryPassword != userRef.Password)
            {
                new LogManager().AddLoginLog(UserType.User, strLoginName, false);
                result = LoginStatus.PasswordIncorrect;
            }
            else if (userRef.Status != 99)
            {
                result = LoginStatus.StatusNotAllow;
            }
            else
            {
                HttpCookie httpCookie = new HttpCookie("singoouser");
                httpCookie.Values["uid"]      = userRef.AutoID.ToString();
                httpCookie.Values["uname"]    = HttpUtility.UrlEncode(userRef.UserName);
                httpCookie.Values["nickname"] = HttpUtility.UrlEncode(userRef.NickName);
                httpCookie.Values["pwd"]      = HttpUtility.UrlEncode(DEncryptUtils.DESEncode(userRef.Password));
                string cookieTime = ConfigProvider.Configs.CookieTime;
                if (cookieTime != null)
                {
                    if (!(cookieTime == "一周"))
                    {
                        if (cookieTime == "一年")
                        {
                            httpCookie.Expires = DateTime.Now.AddYears(1);
                        }
                    }
                    else
                    {
                        httpCookie.Expires = DateTime.Now.AddDays(7.0);
                    }
                }
                HttpContext.Current.Response.Cookies.Add(httpCookie);
                userRef.LoginCount++;
                userRef.LastLoginIP   = IPUtils.GetIP();
                userRef.LastLoginTime = DateTime.Now;
                if (string.IsNullOrEmpty(userRef.Province))
                {
                    TaoBaoAreaInfo iPAreaFromTaoBao = IPUtils.GetIPAreaFromTaoBao(IPUtils.GetIP());
                    if (iPAreaFromTaoBao != null)
                    {
                        userRef.Country  = iPAreaFromTaoBao.data.country;
                        userRef.Province = iPAreaFromTaoBao.data.region;
                        userRef.City     = iPAreaFromTaoBao.data.city;
                        userRef.County   = iPAreaFromTaoBao.data.county;
                    }
                }
                User.Update(userRef);
                new LogManager().AddLoginLog(UserType.User, strLoginName, true);
                result = LoginStatus.Success;
            }
            return(result);
        }