protected void updateMember(object sender, EventArgs e) { this.enableFieldsBtt.Visible = false; Member member = new Member(); string databaseResponse = ""; MemberDAO memberDAO = new MemberDAO(); if (this.searchMembers.SelectedIndex == -1) { this.errorMsg.Text = "Select one member to be updated."; this.errorDiv.Visible = true; } else { if (accountNumber.Text.ToString() == "" || memberName.Text.ToString() == "" || this.datepicker.Text.Equals("") || address.Text.ToString() == "" || city.Text.ToString() == "" || province.SelectedValue.ToString() == "Select..." || postalCode.Text.ToString() == "") { this.errorMsg.Text = "One or more of the required fields are blank!"; this.errorDiv.Visible = true; } else { if (memberDAO.alreadyExists(this.accountNumber.Text)) { this.errorMsg.Text = "This account number already exists. Please choose another one."; } else { //Loads the form content into the member object member.id = this.searchMembers.SelectedRow.Cells[6].Text; member.idGroup = this.searchMembers.SelectedRow.Cells[7].Text; member.accountNumber = accountNumber.Text.ToString().Trim(); member.dateJoined = this.datepicker.Text; member.doctor = doctorName.Text.ToString().Trim(); member.name = memberName.Text.ToString().Trim(); member.address = address.Text.ToString().Trim(); member.city = city.Text.ToString().Trim(); member.province = province.SelectedItem.ToString(); member.region = region.Text.ToString(); member.postalCode = postalCode.Text.ToString(); member.website = website.Text.ToString().Trim(); member.emailAddress = emailAddress.Text.ToString().Trim(); member.phoneNumber = phoneNumber.Text.ToString(); member.faxNumber = faxNumber.Text.ToString(); member.contactPerson = contactPerson.Text.ToString().Trim(); member.dateLastActivated = this.datepicker.Text; //Sends the member object to the updateMember method in MemberDAO.. databaseResponse = memberDAO.updateMember(member); clearAllFields(); this.responseText.Text = databaseResponse; this.editMemberForm.Visible = false; this.response.Visible = true; } } } }