private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here // Put user code to initialize the page here //this.AuthenticatePage(Globals.PermissionLevels.ManageAdministrators); //if (this.CimsUser.RolePermission(Globals.PermissionLevels.ManageAdministrators) < 2) //{ //} if (IsNewSession) { AddToListIfAdmin(); IsNewSession = false; } if (!Page.IsPostBack) { BPUsers bp = new BPUsers(); DSUsers = bp.SelectByID(UserID); DataBind(); } }
private void Page_Load(object sender, System.EventArgs e) { this.AuthenticatePage(new string[] {Globals.PermissionLevels.EditUsers, Globals.PermissionLevels.AddUsers, Globals.PermissionLevels.ViewUsers}); if (UserID > 0) { if (this.OryxUser.RolePermission(Globals.PermissionLevels.EditUsers) != 2) { btnSubmit.Visible = false; btnDelete.Visible = false; btnChangePass.Visible = false; } } else { if (this.OryxUser.RolePermission(Globals.PermissionLevels.AddUsers) != 2) { btnSubmit.Visible = false; btnChangePass.Visible = false; } } if (IsNewSession) { AddToListIfAdmin(); IsNewSession = false; } if (!Page.IsPostBack) { BPUsers bpUsers = new BPUsers(); if (UserID != 0) { //edit administrator DSUsers = bpUsers.SelectByID(UserID); user = DSUsers.tbl_Users.FindByUserID(UserID); txtFirstName.Text = user.UserFirstName; txtLastName.Text = user.UserLastName; chkActive.Checked = user.UserActive; txtEmail.Text = user.UserEmail; //lblLoginID.Text = user.LoginID; lblTitle.Text = "Edit User"; } else { //add administrator btnChangePass.Visible = false; lblTitle.Text = "Add User"; } BindUserGroups(); } }
private void btnDelete_Click(object sender, System.EventArgs e) { BPUsers bp = new BPUsers(); BEUsers.tbl_UsersRow User; DSUsers = bp.SelectByID(UserID); User = DSUsers.tbl_Users.FindByUserID(UserID); User.Delete(); bp.Update(DSUsers); Response.Redirect("BrowseUsers.aspx"); }
private void btnSubmit_Click(object sender, System.EventArgs e) { BPUsers bpUsers = new BPUsers(); BEUsers.tbl_UsersRow user; if (UserID == 0) { // Add a user user = DSUsers.tbl_Users.Newtbl_UsersRow(); } else { // Edit a user DSUsers = bpUsers.SelectByID(UserID); user = DSUsers.tbl_Users.FindByUserID(UserID); } this.Save(user); DSUsers.EnforceConstraints = false; user.UserActive = chkActive.Checked; if (UserID == 0) { user.DateCreated = DateTime.Now; user.DateModified = DateTime.Now; user.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID); DSUsers.tbl_Users.Addtbl_UsersRow(user); } else { user.DateModified = DateTime.Now; user.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID); } bpUsers.Update(DSUsers); Response.Redirect("BrowseUsers.aspx"); }
private void btnSubmit_Click(object sender, System.EventArgs e) { BPUsers bp = new BPUsers(); DSUsers = bp.SelectByID(UserID); BEUsers.tbl_UsersRow user = DSUsers.tbl_Users.FindByUserID(UserID); user.LoginID = txtLoginName.Text; user.Password = txtPassword.Text; int testUserID = bp.Login(txtLoginName.Text, txtPassword.Text); if (testUserID == 0 || testUserID == UserID) { bp.Update(DSUsers); lblErr.Text = ""; Response.Redirect(HttpUtility.UrlDecode( Request.QueryString["ReturnUrl"])); } else { lblErr.Text = "Sorry username and password taken."; } }