示例#1
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string Name = txtName.Text.Trim();
        string Pwd  = txtPwd.Text.Trim();

        if (Name == "" || Pwd == "")
        {
            lblError.Text = "用户名和密码不能为空!";
            return;
        }
        User user = new User();

        user.Name     = Name;
        user.LoginPwd = Pwd;
        int cnt = Convert.ToInt32(UserManagers.IsRegisteUser(Name, Pwd));

        if (cnt > 0)
        {
            PanLogin.Visible    = false;
            PanLoginMes.Visible = true;
            lblMes.Text         = "欢迎" + txtName.Text + "登录";
        }
        else
        {
            lblError.Text = "账号或密码错误!";
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            HeadNameResourceManager headNameResourceManager = new HeadNameResourceManager();

            headNameResources = headNameResourceManager.SelectHeadNameResource();

            ReSourceManager reSourceManager = new ReSourceManager();

            reSources = reSourceManager.SelectMultySelect();

            RequestManager requestManager = new RequestManager();

            requests = requestManager.SelectRequests();

            UserManagers userManagers = new UserManagers();

            users = userManagers.selectUser();

            if (Request.Cookies["DCookies"] != null)
            {
                HiddenField1.Value = Request.Cookies["Cookies4"]["id"];
            }
            else
            {
                string msg = "No Cookies";
                Label1.Text = msg;
            }
        }
示例#3
0
        public void OnGet()
        {
            var rolename = RoleManagers.FindByIdAsync(RoleId).Result.Name;

            Users    = UserManagers.GetUsersInRoleAsync(rolename).Result.ToList();
            RoleName = rolename;
        }
示例#4
0
        public IActionResult OnGetAddUserRole(string roleId)
        {
            var rolename       = RoleManagers.FindByIdAsync(RoleId).Result.Name;
            var Usersinrole    = UserManagers.GetUsersInRoleAsync(rolename).Result.ToList();
            var UserList       = _context.Users.ToList();
            var Usersnotinrole = UserList.Except(Usersinrole).ToList();
            var Usersrole      = new UserRole();

            Usersrole.RoleId = roleId;
            Usersrole.Users  = Usersnotinrole;
            return(Partial("_adduserole", Usersrole));
        }
示例#5
0
        public string GetBanks(string username)
        {
            //Model.User user = Session[ProjectConfig.LOGINUSER] as Model.User;
            UserManagers um = new UserManagers();

            //Model.User info = new Model.User();
            //info.UserName = user.UserName;
            //info.bankName = bankName;

            //info.bankUserName = bankUserName;
            //info.bankCard = bankCard;

            return(um.GetBanks(username));
        }
示例#6
0
        public bool UpdateUserInfoS(string username, string bankName, string bankUserName, string bankCard)
        {
            //Model.User user = Session[ProjectConfig.LOGINUSER] as Model.User;
            UserManagers um = new UserManagers();

            //Model.User info = new Model.User();
            //info.UserName = user.UserName;
            //info.bankName = bankName;

            //info.bankUserName = bankUserName;
            //info.bankCard = bankCard;

            return(um.UpdateUserInfoS(username, bankName, bankUserName, bankCard));
        }
示例#7
0
        public IActionResult OnGetAddUserToRole(string userId)
        {
            var UsersId  = UserManagers.FindByIdAsync(userId).Result;
            var rolename = RoleManagers.FindByIdAsync(RoleId).Result.Name;
            var result1  = UserManagers.AddToRoleAsync(UsersId, rolename).Result;

            if (result1.Succeeded)
            {
                flashMessage = "User added to role";
            }
            else
            {
                flashMessage = "Error adding user to role";
            }
            return(RedirectToPage("ViewUserRoles", new { RoleId = RoleId, flashMessage = flashMessage }));
        }
示例#8
0
    protected void btnAdd0_Click(object sender, ImageClickEventArgs e)
    {
        string LoginId = txtUname.Text.Trim();

        //判断非空
        if (txtUname.Text == "" || txtAPWD.Text == "" || txtNName.Text == "" || txtRePwd.Text == "" || txtQQ.Text == "" || txtEmail.Text == "")
        {
            lblErr.Text = "请输入完整信息!";
            return;
        }
        User user = new User();

        user.LoginId  = LoginId;
        user.LoginPwd = txtRePwd.Text;
        user.Name     = txtUname.Text;
        user.QQ       = Convert.ToInt32(txtQQ.Text);
        user.Mail     = txtEmail.Text;
        //判断两次密码是否一致
        if (txtAPWD.Text == txtRePwd.Text)
        {
            int cnt = Convert.ToInt32(UserManagers.GetUsersName(LoginId));
            if (cnt > 0)
            {
                lblErr.Text = "存在同名账户!";
            }
            else
            {
                int cmt = UserManagers.insertUser(user);
                if (cmt > 0)
                {
                    lblErr.Text = "注册成功!";
                }
                else
                {
                    lblErr.Text = "注册失败!";
                }
            }
        }
        else
        {
            lblErr.Text = "两次输入密码不一致!";
        }
    }
示例#9
0
        public bool UpdateUserInfo(string nicheng, string Tel, string post, string mark)
        {
            if (Session[ProjectConfig.LOGINUSER] == null)
            {
                return(false);
            }
            Model.User   user = Session[ProjectConfig.LOGINUSER] as Model.User;
            UserManagers um   = new UserManagers();

            Model.User info = new Model.User();
            info.UserName = user.UserName;
            info.nicheng  = nicheng;

            info.Tel  = Tel;
            info.post = post;
            info.mark = mark;

            return(um.UpdateUserInfo(info));
        }
示例#10
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string       Name     = txtName.Text.Trim();
         string       Family   = txtFamily.Text.Trim();
         string       Phone    = txtPhone.Text.Trim();
         string       Address  = txtAddress.Text.Trim();
         string       Gender   = ddlGender.SelectedValue.Trim();
         string       Email    = txtEmail.Text.Trim();
         string       Username = txtUsername.Text.Trim();
         string       Password = txtPassword.Text.Trim();
         UserManagers ob       = new UserManagers();
         ob.AddData(Name, Family, Phone, Email, Address, Gender, Username, Password);
         Response.Write("<script>alert('اطلاعات شما با موفقیت ثبت شد');</script>");
     }
     else
     {
         Response.Write("<script>alert('اطلاعات شما ثبت نشد:(');</script>");
     }
     clear();
 }
示例#11
0
        public IActionResult OnGetDeleteUserRole(string userId)
        {
            var UsersId  = UserManagers.FindByIdAsync(userId).Result;
            var rolename = RoleManagers.FindByIdAsync(RoleId).Result.Name;

            if (UsersId.Email == "*****@*****.**" && rolename == "Admin")
            {
                return(RedirectToPage("ViewUserRoles", new { RoleId = RoleId, flashMessage = flashMessage }));
            }
            else
            {
                var result1 = UserManagers.RemoveFromRoleAsync(UsersId, rolename).Result;
                if (result1.Succeeded)
                {
                    flashMessage = "User removed from role";
                }
                else
                {
                    flashMessage = "Error removing user from role";
                }
            }
            return(RedirectToPage("ViewUserRoles", new { RoleId = RoleId, flashMessage = flashMessage }));
        }