Beispiel #1
0
    protected Boolean checkUserStaus(int adminid)
    {
        useradminprofile = new UserAdminProfileBLL();
        List <UserAdminProfile> lst = useradminprofile.ListAdminPrifileWithUID(adminid);
        UserAdminProfile        pro = lst.FirstOrDefault();

        return(pro.ProfileStatus);
    }
Beispiel #2
0
    protected void btnNewUser_Click(object sender, EventArgs e)
    {
        try
        {
            useradmin        = new UserAdminBLL();
            useradminprofile = new UserAdminProfileBLL();
            string Uname     = txtUsername.Text;
            string Uemail    = txtEmail.Text;
            string Fname     = txtFirstname.Text;
            string Lname     = txtLastname.Text;
            string Upassword = txtPrePassword.Text;

            List <UserAdmin> lst1 = useradmin.ListUserWithName(Uname);
            UserAdmin        ad1  = lst1.FirstOrDefault();
            List <UserAdmin> lst2 = useradmin.ListUserWithEmail(Uemail);
            UserAdmin        ad2  = lst2.FirstOrDefault();

            if (ad1 != null)
            {
                this.AlertPageValid(true, "The username already exists !", alertPageValid, lblPageValid);
            }
            else
            {
                if (ad2 != null)
                {
                    this.AlertPageValid(true, "The E-mail already exists !", alertPageValid, lblPageValid);
                }
                else
                {
                    bool bol1 = this.useradmin.NewUserAdmin(Uname, Uemail, CreateSHAHash(Upassword, SaltPassword()));
                    bool bol2 = this.useradminprofile.CreateUserAdminProfile(Fname, Lname, useradmin.GetUserIDWithName(Uname));

                    if (bol1 || bol2)
                    {
                        Response.Write("<script>alert('Thêm người dùng thành công !')</script>");
                    }
                    else
                    {
                        this.AlertPageValid(true, "Thêm người dùng thất bại. Lỗi kết nối CSDL !", alertPageValid, lblPageValid);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
        }
    }