/// <summary> /// Finish button event on wizard /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnWizardStepFinishButton_Click(object sender, EventArgs e) { AccountsServiceClient accountsService = null; // Saves the draft bill if (Page.IsValid) { try { DraftBill bill = GetControlData(); accountsService = new AccountsServiceClient(); DraftBillReturnValue returnValue = accountsService.AddDraftBill(_logonSettings.LogonId, bill); if (returnValue.Success) { // if the page is valid it redirects to view page Response.Redirect("ViewDraftBills.aspx", true); } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; return; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } } }