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_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 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"); //} }