private void btnSave_Click(object sender, EventArgs e) { bool blnValid = false; bool blnSuccess = false; int intMemberNum = 0; int intLoanId = 0; blnValid = ValidateInputs(); if (blnValid) { string strXML = CreateInsertXML(); try { Member _obj = new Member(); string strPaymentId = string.Empty; byte[] bytes = null; if (!strPhotoName.Equals(string.Empty)) { bytes = File.ReadAllBytes(fdPhoto.FileName); } blnSuccess = _obj.AddNewMember(strXML, out intMemberNum, bytes, out intLoanId, out strPaymentId); if (blnSuccess) { ShowMesage("New member added successfully", "New member added", MessageBoxButtons.OK, MessageBoxIcon.Information); MembershipForm _form = new MembershipForm(intMemberNum); _form.ShowDialog(); if (intLoanId != 0) { LoanApplicationForm applicationForm = new LoanApplicationForm(intLoanId); applicationForm.ShowDialog(); } PaymentReceipt receipt = new PaymentReceipt(strPaymentId); receipt.ShowDialog(); ClearAllControls(); } else { MessageBox.Show("Transaction failed. Try again later", "Transaction failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } catch (Exception ex) { MessageBox.Show("Transaction failed. Try again later", "Transaction failed", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LogError.LogEvent("Create New Member", ex.Message, "Save Button Click Event"); } } }