private void Page_Load(object sender, 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) { BPCompanyUsers bp = new BPCompanyUsers(); DSCompanyUsers = bp.SelectCompanyUsersByID(CompanyUserID); DataBind(); } }
private void GetCompanyID() { BPCompanyUsers bp = new BPCompanyUsers(); DSCompanyUsers = bp.SelectCompanyUsersByID(Convert.ToInt32(OryxUser.OryxIdentity.MemberID)); BECompanyUsers.tbl_CompanyUsersRow companyuser = DSCompanyUsers.tbl_CompanyUsers.FindByCompanyUserID(Convert.ToInt32(OryxUser.OryxIdentity.MemberID)); CompanyID = companyuser.CompanyID; }
private void btnSubmit_Click(object sender, EventArgs e) { BPCompanyUsers bp = new BPCompanyUsers(); DSCompanyUsers = bp.SelectCompanyUsersByID(CompanyUserID); BECompanyUsers.tbl_CompanyUsersRow user = DSCompanyUsers.tbl_CompanyUsers.FindByCompanyUserID(CompanyUserID); user.CompanyUserLoginID = txtLoginName.Text; user.CompanyUserPassword = txtPassword.Text; int testCompanyUserID = bp.Login(txtLoginName.Text, txtPassword.Text); if (testCompanyUserID == 0 || testCompanyUserID == CompanyUserID) { bp.Update(DSCompanyUsers); lblErr.Text = ""; Response.Redirect(HttpUtility.UrlDecode( Request.QueryString["ReturnUrl"])); } else { lblErr.Text = "Sorry username and password taken."; } }
private void btnDelete_Click(object sender, EventArgs e) { BPCompanyUsers bp = new BPCompanyUsers(); BECompanyUsers.tbl_CompanyUsersRow CompanyUser; DSCompanyUsers = bp.SelectCompanyUsersByID(CompanyUserID); CompanyUser = DSCompanyUsers.tbl_CompanyUsers.FindByCompanyUserID(CompanyUserID); CompanyUser.Delete(); bp.Update(DSCompanyUsers); Response.Redirect("BrowseCompanyUsers.aspx"); }
private void btnSubmit_ServerClick(object sender, EventArgs e) { BPCompanyUsers bp = new BPCompanyUsers(); BECompanyUsers.tbl_CompanyUsersRow CompanyUser; DSCompanyUsers = new BECompanyUsers(); if (CompanyUserID == 0) { // Add new Company CompanyUser = DSCompanyUsers.tbl_CompanyUsers.Newtbl_CompanyUsersRow(); } else { // Edit a Company DSCompanyUsers = bp.SelectCompanyUsersByID(CompanyUserID); CompanyUser = DSCompanyUsers.tbl_CompanyUsers.FindByCompanyUserID(CompanyUserID); } //all content to be updated/inserted between here CompanyUser.CompanyUserFirstName = txtCompanyUserFirstName.Text; CompanyUser.CompanyUserLastName = txtCompanyUserLastName.Text; if (ddlCompanyUserCompanyID.SelectedValue != "-1") { CompanyUser.CompanyID = Convert.ToInt32(ddlCompanyUserCompanyID.SelectedValue); } CompanyUser.CompanyUserEmail = txtCompanyUserEmail.Text; CompanyUser.CompanyUserAddress1 = txtCompanyUserAddress1.Text; CompanyUser.CompanyUserAddress2 = txtCompanyUserAddress2.Text; CompanyUser.CompanyUserCity = txtCompanyUserCity.Text; CompanyUser.CompanyUserProvince = txtCompanyUserProvince.Text; CompanyUser.CompanyUserCountry = txtCompanyUserCountry.Text; CompanyUser.CompanyUserPostalCode = txtCompanyUserPostalCode.Text; CompanyUser.CompanyUserPhone = txtCompanyUserPhone.Text; CompanyUser.CompanyUserFax = txtCompanyUserFax.Text; CompanyUser.CompanyUserActive = chkCompanyUserActive.Checked; if(CompanyUserID == 0) { CompanyUser.CompanyUserPassword = ""; CompanyUser.CompanyUserLoginID = CompanyUser.CompanyUserFirstName.Substring(0, 1) + CompanyUser.CompanyUserLastName; } CompanyUser.DateModified = DateTime.Now; CompanyUser.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID); //all content to be updated/inserted between here if (CompanyUserID == 0) { //Add new Application Category CompanyUser.DateCreated = DateTime.Now; DSCompanyUsers.tbl_CompanyUsers.Addtbl_CompanyUsersRow(CompanyUser); } bp.Update(DSCompanyUsers); //if (CompanyUserID == 0) //{ // Response.Redirect("EditCompanyUsers.aspx?CompanyUserID=" + CompanyUser.CompanyUserID); //} //else //{ Response.Redirect("BrowseCompanyUsers.aspx"); //} }
private void Page_Load(object sender, EventArgs e) { this.AuthenticatePage(new string[] {PermissionLevels.EditCompanyUsers, PermissionLevels.AddCompanyUsers, PermissionLevels.ViewCompanyUsers}); if (CompanyUserID > 0) { if (this.OryxUser.RolePermission(PermissionLevels.EditCompanyUsers) != 2) { btnSubmit.Visible = false; btnDelete.Visible = false; } else { btnSubmit.Visible = true; btnDelete.Visible = true; } } else { if (this.OryxUser.RolePermission(PermissionLevels.AddCompanyUsers) != 2) { btnSubmit.Visible = false; } } if (hdnCompanyInformation.Value == "hidden") { pnlCompanyInformation.CssClass = "panel-closed"; cntCompanyInformation.Style.Add("display", "none"); hdnCompanyInformation.Value = "hidden"; } else { pnlCompanyInformation.CssClass = "panel-open"; cntCompanyInformation.Style.Add("display", ""); hdnCompanyInformation.Value = "visible"; } // if (hdnAssignedCompanies.Value == "hidden") // { // pnlAssignedCompanies.CssClass = "panel-closed"; // cntAssignedCompanies.Style.Add("display", "none"); // hdnAssignedCompanies.Value = "hidden"; // } // else if (hdnAssignedCompanies.Value== "visible") // { // pnlAssignedCompanies.CssClass = "panel-open"; // cntAssignedCompanies.Style.Add("display", ""); // hdnAssignedCompanies.Value = "visible"; // } // else // { // pnlAssignedCompanies.CssClass = "panel-closed"; // cntAssignedCompanies.Style.Add("display", "none"); // hdnAssignedCompanies.Value = "hidden"; // } pnlAssignedCompanies.Visible = false; if(!IsPostBack) { ViewAssignedCompanies(); BindCompanies(); if (CompanyUserID == 0) { lblTitle.Text = "Add Company User"; btnDelete.Visible = false; //btnSubmit.Value = "Next >"; btnChangePass.Visible = false; pnlAssignedCompanies.Visible = false; } else { BPCompanyUsers bp = new BPCompanyUsers(); BECompanyUsers ds = bp.SelectCompanyUsersByID(CompanyUserID); BECompanyUsers.tbl_CompanyUsersRow CompanyUser = ds.tbl_CompanyUsers.FindByCompanyUserID(CompanyUserID); lblTitle.Text = "Edit Company - " + CompanyUser.CompanyUserFirstName + CompanyUser.CompanyUserLastName; txtCompanyUserFirstName.Text = CompanyUser.CompanyUserFirstName; txtCompanyUserLastName.Text = CompanyUser.CompanyUserLastName; if (ddlCompanyUserCompanyID.Items.FindByValue(CompanyUser.CompanyID.ToString()) != null) { ddlCompanyUserCompanyID.SelectedValue = CompanyUser.CompanyID.ToString(); } txtCompanyUserEmail.Text = CompanyUser.CompanyUserEmail; txtCompanyUserAddress1.Text = CompanyUser.CompanyUserAddress1; txtCompanyUserAddress2.Text = CompanyUser.CompanyUserAddress2; txtCompanyUserCity.Text = CompanyUser.CompanyUserCity; txtCompanyUserProvince.Text = CompanyUser.CompanyUserProvince; txtCompanyUserCountry.Text = CompanyUser.CompanyUserCountry; txtCompanyUserPostalCode.Text = CompanyUser.CompanyUserPostalCode; txtCompanyUserPhone.Text = CompanyUser.CompanyUserPhone; txtCompanyUserFax.Text = CompanyUser.CompanyUserFax; chkCompanyUserActive.Checked = CompanyUser.CompanyUserActive; } } }