protected void btnUpdate_Click(object sender, EventArgs e) { try { DepartmentTableAdapters.DepartmentSelectCommandTableAdapter dep_Adapter = new DepartmentTableAdapters.DepartmentSelectCommandTableAdapter(); DataTable count = dep_Adapter.GetShortNameCountByDeptId(int.Parse(Request[WebConstants.Request.DEPT_ID]), txtCompanyShortName.Text); if (count.Rows.Count == 0) { dep_Adapter.UpdateDepartment(txtCompanyShortName.Text, txtCompanyLongName.Text, txtContactTitle.Text, txtContactInitial.Text.Trim(), txtForename.Text.Trim(), txtSurname.Text.Trim(), txtAddressNo.Text.Trim(), txtAddress1.Text.Trim(), txtAddress2.Text.Trim(), txtAddress3.Text.Trim(), txtAddress4.Text.Trim(), txtAddress5.Text.Trim(), txtPostalCode.Text.Trim(), GetFullAddress(), txtTele.Text.Trim(), txtTele1.Text.Trim(), txtFax.Text.Trim(), txtEmail.Text.Trim(), txtCoNotes.Text.Trim(), loggedInUserId, DateTime.Now, int.Parse(Request[WebConstants.Request.DEPT_ID])); Response.Redirect("DepartmentList.aspx"); } else { SetErrorMessage(WebConstants.Messages.Error.ALREAD_EXISTS); } } catch { SetErrorMessage(WebConstants.Messages.Error.CONNECTION_ERROR); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { DepartmentTableAdapters.DepartmentSelectCommandTableAdapter dep_Adapter = new DepartmentTableAdapters.DepartmentSelectCommandTableAdapter(); DataTable count = dep_Adapter.GetShortNameCountByDeptId((int)Session[WebConstants.Session.REG_DEPT_ID], txtCompanyShortName.Text); if (count.Rows.Count == 0) { dep_Adapter.UpdateDepartment(txtCompanyShortName.Text, txtCompanyLongName.Text, txtContactTitle.Text, txtContactInitial.Text.Trim(), txtForename.Text.Trim(), txtSurname.Text.Trim(), txtAddressNo.Text.Trim(), txtAddress1.Text.Trim(), txtAddress2.Text.Trim(), txtAddress3.Text.Trim(), txtAddress4.Text.Trim(), txtAddress5.Text.Trim(), txtPostalCode.Text.Trim(), GetFullAddress(), txtTele.Text.Trim(), txtTele1.Text.Trim(), txtFax.Text.Trim(), txtEmail.Text.Trim(), txtCoNotes.Text.Trim(), null, DateTime.Now, (int)Session[WebConstants.Session.REG_DEPT_ID] ); Session[WebConstants.Session.WIZARD_STEP] = 3; Response.Redirect("~/Register/AddUser.aspx"); } else { SetErrorMessage(WebConstants.Messages.Error.ALREAD_EXISTS); } } catch { SetErrorMessage(WebConstants.Messages.Error.CONNECTION_ERROR); } }