Пример #1
0
        /// <summary>
        /// Reset password
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int    userId    = Convert.ToInt32(Session["userId"]);
            string userName  = Session["username"].ToString();
            string lastName  = Session["lastname"].ToString();
            string firstName = Session["firstname"].ToString();
            string email     = Session["email"].ToString();
            int    roleId    = Convert.ToInt32(Session["roleId"]);
            int    isAdmin   = 0;

            if (Session["isAdmin"].ToString().Equals("Yes"))
            {
                isAdmin = 1;
            }

            // get the update user info
            ManageUsers.editUser u = new ManageUsers.editUser(userId, userName, roleId, firstName, lastName, email, isAdmin, txtPassword1.Text.Trim());

            ManageUsers.updateUser(u);

            Session.Clear();

            // go to the ManagerUsers page
            Response.Redirect(ResolveUrl("~\\WebContent\\UsersManagement\\UsersManagement.aspx"));
        }
        /// <summary>
        /// Add a new user to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int isAdmin = 0;

            if (chkAdmin.Checked)
            {
                isAdmin = 1;
            }

            // get the update user info
            ManageUsers.editUser u = new ManageUsers.editUser(Convert.ToInt32(Session["userId"]), txtUserName.Text.Trim(), Convert.ToInt32(ddlUserRoles.SelectedValue),
                                                              txtFirstName.Text.Trim(), txtLastName.Text.Trim(), txtEmail.Text.Trim(), isAdmin, string.Empty);

            ManageUsers.updateUser(u);

            Session.Clear();

            // go to the ManagerUsers page
            Response.Redirect(ResolveUrl("~\\WebContent\\UsersManagement\\UsersManagement.aspx"));
        }