Пример #1
0
        public void Save(UserLogin objUserLogin)
        {
            string sql = null;
            List<DbParameter> parameterList = new List<DbParameter>();

            sql = " insert into tbl_user_login(PkId, UserId, LoginTime, LoginIp) values(TUL_PKID.NEXTVAL, :UserId, :LoginTime, :LoginIp) ";

            parameterList.Add(new OracleParameter(":UserId", objUserLogin.UserId));
            parameterList.Add(new OracleParameter(":LoginTime", objUserLogin.LoginTime));
            parameterList.Add(new OracleParameter(":LoginIp", objUserLogin.LoginIp));

            DbHelper.ExecuteNonQuery(sql, CommandType.Text, parameterList.ToArray());
        }
Пример #2
0
        public void Save(UserLogin objUserLogin)
        {
            string sql = null;
            List<DbParameter> parameterList = new List<DbParameter>();

            sql = " insert into tbl_user_login(UserId, LoginTime, LoginIp) values(@UserId, @LoginTime, @LoginIp) ";

            parameterList.Add(new MySqlParameter("@UserId", objUserLogin.UserId));
            parameterList.Add(new MySqlParameter("@LoginTime", objUserLogin.LoginTime));
            parameterList.Add(new MySqlParameter("@LoginIp", objUserLogin.LoginIp));

            DbHelper.ExecuteNonQuery(sql, CommandType.Text, parameterList.ToArray());
        }
Пример #3
0
        public void Save_Login(UserLogin objUserLogin)
        {
            var repository = ServiceFactory.GetService<IUserLoginRepository>();

            repository.Save(objUserLogin);
        }
Пример #4
0
        private bool CheckUser(string userAccount, string userPwd)
        {
            IUserService service = ServiceFactory.GetService<IUserService>();

            UserInfo uiCurrent = service.GetObjectByUserAccount_Info(userAccount);

            if (uiCurrent != null)
            {
                if (uiCurrent.UserPwd == userPwd.DESEncrypt())
                {
                    this.TempUserId = uiCurrent.PkId.ToString();
                    this.CurrentUser = uiCurrent;
                    this.CurrentUserRole = service.GetObject_Role(this.CurrentUser.RoleId);
                    this.CurrentUserRolePermissionList = (from rp in service.GetList_RolePermission(this.CurrentUserRole.PkId) select rp.PermCode).ToList();

                    if (this.CurrentUserRole.RoleStatus == (byte)UserRole.RoleStatusEnum.Disable)
                    {
                        this.lblMessage.Text = "账户所属角色被禁用";

                        return false;
                    }

                    if (this.CurrentUser.UserStatus == (byte)UserInfo.UserStatusEnum.Disable)
                    {
                        this.lblMessage.Text = "账户被禁用";

                        return false;
                    }

                    UserLogin ulCurrent = new UserLogin()
                    {
                        UserId = this.CurrentUser.PkId,
                        LoginIp = ApplicationHelper.GetClientIp(),
                        LoginTime = DateTime.Now
                    };

                    service.Save_Login(ulCurrent);

                    return true;
                }

                else
                {
                    this.lblMessage.Text = "密码输入错误";

                    return false;
                }
            }

            else
            {
                this.lblMessage.Text = "账户不存在";

                return false;
            }
        }