/// <summary> /// Loads office cheque request details by office cheque request id /// for printing. /// </summary> /// <param name="chequeRequestId">Client cheque request id to populate client cheque request details</param> private void LoadControls(int officeRequestId) { AccountsServiceClient accountsService = null; ChequeRequestReturnValue returnValue = null; try { accountsService = new AccountsServiceClient(); returnValue = new ChequeRequestReturnValue(); Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; returnValue = accountsService.LoadOfficeChequeRequestDetailsForPrinting(logonId, officeRequestId); if (returnValue.Success) { // Sets controls on page load. _lblName.Text = returnValue.ChequeRequest.PersonName; _lblAddressLine1.Text = returnValue.ChequeRequest.AddressLine1; _lblAddressLine2.Text = returnValue.ChequeRequest.AddressLine2; _lblAddressLine3.Text = returnValue.ChequeRequest.AddressLine3; _lblAddressTown.Text = returnValue.ChequeRequest.AddressTown; _lblAddressCounty.Text = returnValue.ChequeRequest.AddressCounty; _lblAddressPostcode.Text = returnValue.ChequeRequest.AddressPostcode; _lblMatterDescription.Text = returnValue.ChequeRequest.MatterDescription; _lblMatterReference.Text = returnValue.ChequeRequest.MatterReference; _lblFeeEarner.Text = returnValue.ChequeRequest.FeeEarnerReference; _lblPartner.Text = returnValue.ChequeRequest.PartnerName; _lblUserName.Text = returnValue.ChequeRequest.UserName; _lblOfficeChequeRequestDate.Text = returnValue.ChequeRequest.ChequeRequestDate.ToShortDateString(); _lblOfficeChequeRequestDescription.Text = returnValue.ChequeRequest.ChequeRequestDescription; _lblOfficeChequeRequestPayee.Text = returnValue.ChequeRequest.ChequeRequestPayee; _lblOfficeChequeRequestBank.Text = returnValue.ChequeRequest.BankName; _lblOfficeChequeRequestVATRate.Text = returnValue.ChequeRequest.VATRate; _lblOfficeChequeRequestAmount.Text = returnValue.ChequeRequest.ChequeRequestAmount.ToString("0.00").Trim(); _lblOfficeChequeRequestVATAmount.Text = returnValue.ChequeRequest.VATAmount.ToString("0.00").Trim(); _chkBxOfficeChequeRequestAuthorised.Checked = returnValue.ChequeRequest.IsChequeRequestAuthorised; _chkBxOfficeChequeRequestAnticipated.Checked = returnValue.ChequeRequest.IsChequeRequestAnticipated; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <summary> /// Binds VAT rates on page load /// </summary> private void BindVATRates() { _ddlVATRate.Items.Clear(); AccountsServiceClient vatRateClient = new AccountsServiceClient(); try { VatRateSearchCriteria criteria = new VatRateSearchCriteria(); criteria.IncludeNonVatable = false; criteria.IncludeArchived = false; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = 0; VatRateSearchReturnValue vatReturnValue = vatRateClient.VatRateSearch(_logonSettings.LogonId, collectionRequest, criteria); if (vatReturnValue.Success) { if (vatReturnValue.VatRates != null) { for (int i = 0; i < vatReturnValue.VatRates.Rows.Length; i++) { ListItem item = new ListItem(vatReturnValue.VatRates.Rows[i].Description, vatReturnValue.VatRates.Rows[i].Id.ToString() + "$" + vatReturnValue.VatRates.Rows[i].Percentage.ToString()); if (vatReturnValue.VatRates.Rows[i].IsDefault) { _ddlVATRate.SelectedIndex = -1; item.Selected = true; } _ddlVATRate.Items.Add(item); } } } else { _lblMessage.Text = vatReturnValue.Message; } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (vatRateClient.State != System.ServiceModel.CommunicationState.Faulted) { vatRateClient.Close(); } } }
public ChequeAuthorisationSearchItem[] LoadUnauthorisedClientChequeRequestsCredit(int startRow, int pageSize, bool forceRefresh) { AccountsServiceClient accountsService = null; ChequeAuthorisationSearchItem[] clientChequeRequests = null; try { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; ChequeAuthorisationSearchCriteria searchCriteria = new ChequeAuthorisationSearchCriteria(); searchCriteria.IsAuthorised = false; searchCriteria.IsPosted = false; // Suggestd by client after introducing new properties in service layer searchCriteria.IncludeDebit = false; searchCriteria.IncludeCredit = true; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; ChequeAuthorisationReturnValue returnValue = accountsService.GetUnauthorisedClientChequeRequests(logonId, collectionRequest, searchCriteria); if (returnValue.Success) { _clientChequeRequestsCreditRowCount = returnValue.ChequeRequests.TotalRowCount; clientChequeRequests = returnValue.ChequeRequests.Rows; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } return(clientChequeRequests); }
/// <summary> /// Populate Clearance Days /// </summary> private void SetClearanceDays(int clearanceTypeId, bool isCredit) { AccountsServiceClient accountService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); ClearanceTypeSearchCriteria criteria = new ClearanceTypeSearchCriteria(); criteria.IsCredit = isCredit; criteria.IncludeArchived = false; accountService = new AccountsServiceClient(); ClearanceTypeSearchReturnValue returnValue = accountService.ClearanceTypes(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { foreach (ClearanceTypeSearchItem type in returnValue.ClearanceTypes.Rows) { if (clearanceTypeId == type.ClearanceTypeId) { _txtClearanceDaysChq.Text = type.ClearanceTypeChqDays.ToString(); _txtClearanceDaysElec.Text = type.ClearanceTypeElecDays.ToString(); } } } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountService != null) { if (accountService.State != System.ServiceModel.CommunicationState.Faulted) { accountService.Close(); } } } }
/// <summary> /// Gets list of clearance type /// </summary> /// <returns>Returns clearance types.</returns> private ClearanceTypeSearchItem[] GetClearanceType(bool isCredit) { AccountsServiceClient accountService = null; ClearanceTypeSearchItem[] clearanceType = null; try { CollectionRequest collectionRequest = new CollectionRequest(); ClearanceTypeSearchCriteria criteria = new ClearanceTypeSearchCriteria(); criteria.IsCredit = isCredit; criteria.IncludeArchived = false; accountService = new AccountsServiceClient(); ClearanceTypeSearchReturnValue returnValue = accountService.ClearanceTypes(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { clearanceType = returnValue.ClearanceTypes.Rows; } else { throw new Exception(returnValue.Message); } return(clearanceType); } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; return(clearanceType); } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; return(clearanceType); } finally { if (accountService != null) { if (accountService.State != System.ServiceModel.CommunicationState.Faulted) { accountService.Close(); } } } }
public ChequeAuthorisationSearchItem[] LoadUnauthorisedClientChequeRequestsCredit(int startRow, int pageSize, bool forceRefresh) { AccountsServiceClient accountsService = null; ChequeAuthorisationSearchItem[] clientChequeRequests = null; try { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; ChequeAuthorisationSearchCriteria searchCriteria = new ChequeAuthorisationSearchCriteria(); searchCriteria.IsAuthorised = false; searchCriteria.IsPosted = false; // Suggestd by client after introducing new properties in service layer searchCriteria.IncludeDebit = false; searchCriteria.IncludeCredit = true; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; ChequeAuthorisationReturnValue returnValue = accountsService.GetUnauthorisedClientChequeRequests(logonId, collectionRequest, searchCriteria); if (returnValue.Success) { _clientChequeRequestsCreditRowCount = returnValue.ChequeRequests.TotalRowCount; clientChequeRequests = returnValue.ChequeRequests.Rows; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } return clientChequeRequests; }
/// <summary> /// Binds disbursement types /// </summary> private void BindDisbursementTypes() { _ddlDisbursementType.Items.Clear(); AccountsServiceClient accountsClient = new AccountsServiceClient(); try { DisbursmentTypeSearchCriteria criteria = new DisbursmentTypeSearchCriteria(); criteria.IsExternal = true; criteria.IsIncludeArchived = false; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = 0; DisbursmentTypeReturnValue bankReturnValue = accountsClient.DisbursmentTypeSearch(_logonSettings.LogonId, collectionRequest, criteria); if (bankReturnValue.Success) { if (bankReturnValue.DisbursementType != null) { _ddlDisbursementType.DataSource = bankReturnValue.DisbursementType.Rows; _ddlDisbursementType.DataTextField = "Description"; _ddlDisbursementType.DataValueField = "Id"; _ddlDisbursementType.DataBind(); } } else { _lblMessage.Text = bankReturnValue.Message; } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsClient.State != System.ServiceModel.CommunicationState.Faulted) { accountsClient.Close(); } } }
/// <summary> /// Loads client balances details by project id /// </summary> /// <param name="startRow">starting row for grid view</param> /// <param name="pageSize">Sets the page size for grid view.</param> /// <param name="forceRefresh">Gets records if forcefresh is true else gets records from cacahe.</param> /// <returns>Retrieves client balances details by project id</returns> public BalancesSearchItem[] LoadClientBalancesDetails(int startRow, int pageSize, bool forceRefresh) { AccountsServiceClient accountsService = null; BalancesSearchItem[] clientBalances = null; try { if (Session[SessionName.ProjectId] != null) { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; BalancesSearchReturnValue returnValue = accountsService.GetClientBalancesDetails(logonId, collectionRequest, projectId); if (returnValue.Success) { _clientRowCount = returnValue.Balances.TotalRowCount; clientBalances = returnValue.Balances.Rows; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } return(clientBalances); }
/// <summary> /// Loads financial information about office, client and deposit balances /// by project id /// </summary> private void SetFinancialInfo() { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; FinancialInfoReturnValue returnValue = accountsService.GetFinancialInfoByProjectId(logonId, projectId); if (returnValue.Success) { _txtOffice.Text = returnValue.OfficeBalance; _txtClient.Text = returnValue.ClientBalance; _txtDeposit.Text = returnValue.DepositBalance; _txtClientFinancialInfo.Text = returnValue.ClientBalance; _txtOfficeFinancialInfo.Text = returnValue.OfficeBalance; _txtDepositFinancialInfo.Text = returnValue.DepositBalance; // Sets warning message, if paid disbursements amount less than zero if (!string.IsNullOrEmpty(returnValue.WarningMessage)) { _lblMessage.Text = returnValue.WarningMessage; } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <summary> /// Loads disbursements by project id /// </summary> /// <param name="startRow"></param> /// <param name="pageSize"></param> /// <param name="forceRefresh"></param> /// <returns></returns> public DisbursementSearchItem[] LoadDisbursements(int startRow, int pageSize, bool forceRefresh) { AccountsServiceClient accountsService = null; DisbursementSearchItem[] disbursements = null; try { if (Session[SessionName.ProjectId] != null) { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; DisbursementsSearchReturnValue returnValue = accountsService.GetDisbursementsDetails(logonId, collectionRequest, projectId); if (returnValue.Success) { _disbursementsRowCount = returnValue.Disbursements.TotalRowCount; disbursements = returnValue.Disbursements.Rows; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } return disbursements; }
/// <summary> /// Loads unposted draft bills on page load. /// </summary> /// <param name="startRow">Starting row for draft bills.</param> /// <param name="pageSize">Page size on grid view for unposted draft bills.</param> /// <param name="forceRefresh"></param> /// <returns>Returns all unposted draft bills.</returns> public DraftBillSearchItem[] LoadDraftBills(int startRow, int pageSize, bool forceRefresh) { AccountsServiceClient accountsService = null; DraftBillSearchItem[] draftBills = null; try { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; DraftBillSearchReturnValue returnValue = accountsService.GetUnpostedDraftBills(logonId, collectionRequest); if (returnValue.Success) { _draftBillsRowCount = returnValue.UnpostedDraftBills.TotalRowCount; draftBills = returnValue.UnpostedDraftBills.Rows; } else { throw new Exception(returnValue.Message); //_lblMessage.CssClass = "errorMessage"; //_lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } return(draftBills); }
/// <summary> /// Sets client bank by project id in session /// </summary> /// <param name="projectId">Project id in session sets the client bank.</param> private void SetClientBank(Guid projectId) { AccountsServiceClient accountsService = null; ClientBankIdReturnValue returnValue = null; try { returnValue = new ClientBankIdReturnValue(); //If a value is selected then save it, this prevents the default value from //overriding the selection if (_ddlClientBank.Items.Count > 0) { accountsService = new AccountsServiceClient(); returnValue = accountsService.GetClientBankIdByProjectId(_logonSettings.LogonId, projectId); } if (returnValue.ClientBankId != 0) { if (_ddlClientBank.Items.FindByValue(returnValue.ClientBankId.ToString()) != null) { _ddlClientBank.SelectedValue = returnValue.ClientBankId.ToString(); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <summary> /// Binds office banks on page load /// </summary> private void BindOfficeBank() { try { BankSearchItem[] banks = GetBanks(DataConstants.BankSearchTypes.Office); _ddlBank.DataSource = banks; _ddlBank.DataTextField = "Description"; _ddlBank.DataValueField = "BankId"; _ddlBank.DataBind(); AddDefaultToDropDownList(_ddlBank); if (Session[SessionName.ProjectId] != null) { AccountsServiceClient accountsService = new AccountsServiceClient(); ChequeRequestReturnValue returnValue = accountsService.GetDefaultChequeRequestDetails(_logonSettings.LogonId, new Guid(HttpContext.Current.Session[SessionName.ProjectId].ToString())); if (returnValue.Success) { _ddlBank.SelectedIndex = -1; if (_ddlBank.Items.FindByValue(returnValue.ChequeRequest.BankOfficeId.ToString()) != null) { _ddlBank.Items.FindByValue(returnValue.ChequeRequest.BankOfficeId.ToString()).Selected = true; } } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } }
public void CanAddEditRemoveLocation() { const int acountId = 68; var address = GetNewAddress(); var wcfService = new AccountsServiceClient(); var location = wcfService.AddLocation(address, acountId); location.PostalCode = "4444"; Assert.IsTrue(location != null); var updatedLocation = wcfService.UpdateLocation(location); Assert.IsTrue(updatedLocation.PostalCode == "4444"); var locations = wcfService.GetLocationsByAccountId(updatedLocation.AccountId.Value); Assert.IsTrue(locations.Any()); bool deleted = wcfService.DeleteLocation(updatedLocation.AddressId); Assert.IsTrue(deleted); }
/// <summary> /// Populate Clearance Days /// </summary> private void SetClearanceDays(int clearanceTypeId, bool isCredit) { AccountsServiceClient accountService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); ClearanceTypeSearchCriteria criteria = new ClearanceTypeSearchCriteria(); criteria.IsCredit = isCredit; criteria.IncludeArchived = false; accountService = new AccountsServiceClient(); ClearanceTypeSearchReturnValue returnValue = accountService.ClearanceTypes(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { foreach (ClearanceTypeSearchItem type in returnValue.ClearanceTypes.Rows) { if (clearanceTypeId == type.ClearanceTypeId) { _txtClearanceDaysChq.Text = type.ClearanceTypeChqDays.ToString(); _txtClearanceDaysElec.Text = type.ClearanceTypeElecDays.ToString(); } } } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountService != null) { if (accountService.State != System.ServiceModel.CommunicationState.Faulted) accountService.Close(); } } }
/// <summary> /// Loads client cheque request details by client cheque request id /// </summary> /// <param name="chequeRequestId">Id reuired to populate client cheque request details.</param> private void LoadControls() { Guid projectId = DataConstants.DummyGuid; Guid memberId = DataConstants.DummyGuid; AccountsServiceClient accountsService = null; ChequeRequestReturnValue returnValue = null; if (_hdnClientChequeRequestId.Value.Trim().Length > 0) { accountsService = new AccountsServiceClient(); try { returnValue = new ChequeRequestReturnValue(); returnValue = accountsService.LoadClientChequeRequestDetails(_logonSettings.LogonId, Convert.ToInt32(_hdnClientChequeRequestId.Value)); if (returnValue.Success) { if (returnValue.ChequeRequest != null) { memberId = returnValue.ChequeRequest.MemberId; projectId = returnValue.ChequeRequest.ProjectId; _ccPostDate.DateText = returnValue.ChequeRequest.ChequeRequestDate.ToString("dd/MM/yyyy"); _txtDescription.Text = returnValue.ChequeRequest.ChequeRequestDescription; _txtPayee.Text = returnValue.ChequeRequest.ChequeRequestPayee; _ddlClientBank.SelectedValue = Convert.ToString(returnValue.ChequeRequest.BankId); _txtAmount.Text = returnValue.ChequeRequest.ChequeRequestAmount.ToString(); _chkBxAuthorise.Checked = returnValue.ChequeRequest.IsChequeRequestAuthorised; _txtReference.Text = returnValue.ChequeRequest.ChequeRequestReference; if (_txtReference.Text.Trim().ToLower() == "chq") { _spanPayee.Visible = true; _txtPayee.Visible = true; _lblPayee.Visible = true; _txtPayee.Text = _txtDescription.Text; _rfvPayee.Enabled = true; } _txtClearanceDaysChq.Text = returnValue.ChequeRequest.ClientChequeRequestsClearanceDaysChq.ToString(); _txtClearanceDaysElec.Text = returnValue.ChequeRequest.ClientChequeRequestsClearanceDaysElec.ToString(); if (returnValue.ChequeRequest.ClientChequeRequestsIsCredit) { _ddlClientDebitCredit.SelectedValue = "Credit"; GetClientClearanceTypes(); //SetClearanceDays(int.Parse(_dllClearanceType.SelectedValue), true); } else { _ddlClientDebitCredit.SelectedValue = "Debit"; GetClientClearanceTypes(); //SetClearanceDays(int.Parse(_dllClearanceType.SelectedValue), false); } //Populate DropDownList _dllClearanceType.SelectedValue = returnValue.ChequeRequest.ClearanceTypeId.ToString(); } else { throw new Exception("Load failed."); } } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } try { if (memberId != DataConstants.DummyGuid) { ViewState["MemberId"] = memberId; } else { ViewState["MemberId"] = DataConstants.DummyGuid.ToString(); } if (projectId != DataConstants.DummyGuid) { ViewState["ChequeRequestProjectId"] = projectId; HttpContext.Current.Session[SessionName.ProjectId] = projectId; // Loads client matter details. LoadClientMatterDetails(projectId); } else { _cliMatDetails.LoadData = false; ViewState["ChequeRequestProjectId"] = DataConstants.DummyGuid.ToString(); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } } }
/// <summary> /// Gets list of clearance type /// </summary> /// <returns>Returns clearance types.</returns> private ClearanceTypeSearchItem[] GetClearanceType(bool isCredit) { AccountsServiceClient accountService = null; ClearanceTypeSearchItem[] clearanceType = null; try { CollectionRequest collectionRequest = new CollectionRequest(); ClearanceTypeSearchCriteria criteria = new ClearanceTypeSearchCriteria(); criteria.IsCredit = isCredit; criteria.IncludeArchived = false; accountService = new AccountsServiceClient(); ClearanceTypeSearchReturnValue returnValue = accountService.ClearanceTypes(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { clearanceType = returnValue.ClearanceTypes.Rows; } else { throw new Exception(returnValue.Message); } return clearanceType; } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; return clearanceType; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; return clearanceType; } finally { if (accountService != null) { if (accountService.State != System.ServiceModel.CommunicationState.Faulted) accountService.Close(); } } }
/// <summary> /// Saves client cheque request details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { // Sets error message if posting date is blank if (string.IsNullOrEmpty(_ccPostDate.DateText)) { _lblPostingPeriod.Text = "Invalid"; _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "Posting Date is not within the current financial year"; return; } bool isPostingPeriodValid = SetPostingPeriod(); if (isPostingPeriodValid) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); IRIS.Law.WebServiceInterfaces.Accounts.ChequeRequest clientChequeRequest = GetControlData(); // This flag is used to set the 'ProceedIfOverDrawn' flag on service class // after getting warning for insufficient funds if (ViewState["ProceedIfOverDrawn"] != null) { if (Convert.ToBoolean(ViewState["ProceedIfOverDrawn"])) { clientChequeRequest.ProceedIfOverDrawn = true; } else { clientChequeRequest.ProceedIfOverDrawn = false; } } ChequeRequestReturnValue returnValue = accountsService.SaveClientChequeRequest(_logonSettings.LogonId, clientChequeRequest); if (returnValue.Success) { ViewState["ProceedIfOverDrawn"] = false; // If print checkbox is checked then prints cheque request details // else shows success message on the same page. if (_chkBxPrintChequeRequest.Checked) { // Newly added cheque request id to populate details for printable format. Session[SessionName.ChequeRequestId] = returnValue.ChequeRequest.ChequeRequestId; // To redirect to printable format of cheque request details. Response.Redirect("~/Pages/Accounts/PrintableClientChequeRequest.aspx", true); } else { ResetControls(true); if (returnValue.Message != string.Empty) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "Client Cheque Request Saved Successfully. " + returnValue.Message; } else { _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Client Cheque Request Saved Successfully."; } } } else { _lblMessage.CssClass = "errorMessage"; if (!string.IsNullOrEmpty(returnValue.Message)) { _lblMessage.Text = returnValue.Message; } else if (!string.IsNullOrEmpty(returnValue.WarningMessage)) { ViewState["ProceedIfOverDrawn"] = true; _lblMessage.Text = returnValue.WarningMessage.Replace("Client account will be overdrawn, are you sure you wish to proceed?", "Client account will be overdrawn, press Save if you are sure you wish to proceed?"); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } } } else { return; } }
/// <summary> /// On matter changed event sets client bank id /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _cliMatDetails_MatterChanged(object sender, EventArgs e) { try { if (Session[SessionName.ProjectId] == null) { if (_cliMatDetails.Message != null) { if (_cliMatDetails.Message.Trim().Length > 0) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = _cliMatDetails.Message; return; } } } else { ViewState["ChequeRequestProjectId"] = new Guid(HttpContext.Current.Session[SessionName.ProjectId].ToString()); AccountsServiceClient accountsService = new AccountsServiceClient(); try { ChequeRequestReturnValue returnValue = accountsService.GetDefaultChequeRequestDetails(_logonSettings.LogonId, new Guid(HttpContext.Current.Session[SessionName.ProjectId].ToString())); if (returnValue.Success) { _ddlBank.SelectedIndex = -1; if (_ddlBank.Items.FindByValue(returnValue.ChequeRequest.BankOfficeId.ToString()) != null) { _ddlBank.Items.FindByValue(returnValue.ChequeRequest.BankOfficeId.ToString()).Selected = true; } _ddlVAT.SelectedIndex = -1; if (returnValue.ChequeRequest.OfficeVATTable == IRIS.Law.PmsCommonData.Accounts.AccountsDataConstantsYesNo.Yes) { _ddlVAT.Items.FindByValue("Yes").Selected = true; } else { _ddlVAT.Items.FindByValue("No").Selected = true; } HideUnhideVATDetails(); } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } }
/// <summary> /// Loads financial information about office, client and deposit /// total balance by project id /// </summary> /// <param name="returnValue"></param> private void SetFinancialInfo() { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; FinancialInfoReturnValue returnValue = accountsService.GetFinancialInfoByProjectId(logonId, projectId); if (returnValue.Success) { _txtOffice.Text = returnValue.OfficeBalance; _txtClient.Text = returnValue.ClientBalance; _txtDeposit.Text = returnValue.DepositBalance; // Sets warning message if paid disbursements amount less than zero if (!string.IsNullOrEmpty(returnValue.WarningMessage)) { _lblMessage.Text = returnValue.WarningMessage; } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Loads client cheque request details by client cheque request id /// for printing. /// </summary> /// <param name="chequeRequestId">Client cheque request id to populate client cheque request details</param> private void LoadControls(int chequeRequestId) { AccountsServiceClient accountsService = null; ChequeRequestReturnValue returnValue = null; try { accountsService = new AccountsServiceClient(); returnValue = new ChequeRequestReturnValue(); Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; returnValue = accountsService.LoadClientChequeRequestDetailsForPrinting(logonId, chequeRequestId); if (returnValue.Success) { _lblClientName.Text = returnValue.ChequeRequest.PersonName; _lblAddressLine1.Text = returnValue.ChequeRequest.AddressLine1; _lblAddressLine2.Text = returnValue.ChequeRequest.AddressLine2; _lblAddressLine3.Text = returnValue.ChequeRequest.AddressLine3; _lblAddressTown.Text = returnValue.ChequeRequest.AddressTown; _lblAddressCounty.Text = returnValue.ChequeRequest.AddressCounty; _lblAddressPostcode.Text = returnValue.ChequeRequest.AddressPostcode; _lblMatterDescription.Text = returnValue.ChequeRequest.MatterDescription; _lblMatterReference.Text = returnValue.ChequeRequest.MatterReference; _lblFeeEarner.Text = returnValue.ChequeRequest.FeeEarnerReference; _lblPartner.Text = returnValue.ChequeRequest.PartnerName; _lblUserName.Text = returnValue.ChequeRequest.UserName; _lblClientChequeRequestDate.Text = returnValue.ChequeRequest.ChequeRequestDate.ToShortDateString(); _lblClientChequeRequestDescription.Text = returnValue.ChequeRequest.ChequeRequestDescription; _lblClientChequeRequestPayee.Text = returnValue.ChequeRequest.ChequeRequestPayee; _lblClientChequeRequestBank.Text = returnValue.ChequeRequest.BankName; _lblClientChequeRequestAmount.Text = returnValue.ChequeRequest.ChequeRequestAmount.ToString("0.00"); _chkBxClientChequeRequestAuthorised.Checked = returnValue.ChequeRequest.IsChequeRequestAuthorised; _lblClearanceType.Text = returnValue.ChequeRequest.ClearanceTypeDesc; _lblBranch.Text = returnValue.ChequeRequest.MatBranchRef; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
private void BindTimeTransactions() { AccountsServiceClient accountsService = null; try { Guid logonId = ((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId; accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; DateTime dateTo; if (!DateTime.TryParse(this._ccUnbilledTimeUpto.DateText, out dateTo)) { throw new Exception("Unable to convert unbilled time up to value to a date"); } TimeTransactionReturnValue returnValue = accountsService.GetTimeTransaction(logonId, projectId); if (returnValue.Success) { this._grdUnBilledTime.DataSource = returnValue.Transactions.Rows.Where(transaction => transaction.Date <= dateTo); _grdUnBilledTime.DataBind(); } else { _grdUnBilledTime.DataSource = null; _grdUnBilledTime.DataBind(); throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Sets the vat based on the branch for the project. /// </summary> /// <param name="projectId">The project id.</param> private void SetVat(Guid projectId) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); BranchVatReturnValue returnValue = accountsService.GetBranchVatForProject(_logonSettings.LogonId, projectId); if (returnValue.Success) { if (returnValue.BranchNoVat) { _ddlVATRate.Visible = false; _txtVAT.Visible = false; _txtVAT.Text = "0.00"; } else { _ddlVATRate.Visible = true; _txtVAT.Visible = true; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Deletes unauthorised cheque request for client or office /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnDelete_Click(object sender, EventArgs e) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); List <int> listSelectedChequeRequestIds = new List <int>(); CheckBox checkboxSelect = null; bool isClientChequeRequest = false; foreach (GridViewRow gridViewRow in _grdClientChequeRequestsDebit.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { isClientChequeRequest = true; Label _lblCheckRequestId = ((Label)gridViewRow.FindControl("_lblChequeRequestId")); listSelectedChequeRequestIds.Add(Convert.ToInt32(_lblCheckRequestId.Text)); } } foreach (GridViewRow gridViewRow in _grdClientChequeRequestsCredit.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { isClientChequeRequest = true; Label _lblCheckRequestId = ((Label)gridViewRow.FindControl("_lblChequeRequestId")); listSelectedChequeRequestIds.Add(Convert.ToInt32(_lblCheckRequestId.Text)); } } if (!isClientChequeRequest) { foreach (GridViewRow gridViewRow in _grdOfficeChequeRequests.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { isClientChequeRequest = false; Label _lblCheckRequestId = ((Label)gridViewRow.FindControl("_lblChequeRequestId")); listSelectedChequeRequestIds.Add(Convert.ToInt32(_lblCheckRequestId.Text)); } } } // If there are any selected cheque request ids to be deleted, then call delete method. if (listSelectedChequeRequestIds.Count > 0) { int[] arrSelectedChequeRequestIds = listSelectedChequeRequestIds.ToArray(); Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; ChequeRequestReturnValue returnValue = accountsService.DeleteChequeRequests(logonId, arrSelectedChequeRequestIds, isClientChequeRequest); if (returnValue.Success) { // Disables the buttons after deletion,similar to page load. _btnDelete.Enabled = false; _btnAuthorise.Enabled = false; _hdnRefreshClientChequeRequestCredit.Value = "true"; _hdnRefreshClientChequeRequestDebit.Value = "true"; _hdnRefreshOfficeChequeRequest.Value = "true"; if (isClientChequeRequest) { _grdClientChequeRequestsCredit.PageIndex = 0; _grdClientChequeRequestsCredit.DataSourceID = _odsClientChequeRequestsCredit.ID; _grdClientChequeRequestsDebit.PageIndex = 0; _grdClientChequeRequestsDebit.DataSourceID = _odsClientChequeRequestsDebit.ID; } else { _grdOfficeChequeRequests.PageIndex = 0; _grdOfficeChequeRequests.DataSourceID = _odsOfficeChequeRequests.ID; } _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Cheque Request Deleted"; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <summary> /// Loads office cheque request details in edit mode. /// </summary> private void LoadOfficeChequeRequestDetails() { Guid projectId = DataConstants.DummyGuid; Guid memberId = DataConstants.DummyGuid; if (_hdnOfficeChequeRequestId.Value.Trim().Length > 0) { AccountsServiceClient accountsService = new AccountsServiceClient(); try { ChequeRequestReturnValue accountsReturnValue = new ChequeRequestReturnValue(); accountsReturnValue = accountsService.LoadOfficeChequeRequestDetails(_logonSettings.LogonId, Convert.ToInt32(_hdnOfficeChequeRequestId.Value)); if (accountsReturnValue.Success) { if (accountsReturnValue.ChequeRequest != null) { projectId = accountsReturnValue.ChequeRequest.ProjectId; _ccPostDate.DateText = accountsReturnValue.ChequeRequest.ChequeRequestDate.ToString("dd/MM/yyyy"); _ddlDisbursementType.SelectedIndex = -1; if (_ddlDisbursementType.Items.FindByValue(accountsReturnValue.ChequeRequest.DisbursementTypeId.ToString()) != null) { _ddlDisbursementType.Items.FindByValue(accountsReturnValue.ChequeRequest.DisbursementTypeId.ToString()).Selected = true; } _txtDescription.Text = accountsReturnValue.ChequeRequest.ChequeRequestDescription; _txtReference.Text = "CHQ"; _txtPayee.Text = accountsReturnValue.ChequeRequest.ChequeRequestPayee; _ddlBank.SelectedIndex = -1; if (_ddlBank.Items.FindByValue(accountsReturnValue.ChequeRequest.BankId.ToString()) != null) { _ddlBank.Items.FindByValue(accountsReturnValue.ChequeRequest.BankId.ToString()).Selected = true; } _txtAmount.Text = accountsReturnValue.ChequeRequest.ChequeRequestAmount.ToString("0.00"); _ddlVAT.SelectedIndex = -1; if (accountsReturnValue.ChequeRequest.OfficeVATTable == IRIS.Law.PmsCommonData.Accounts.AccountsDataConstantsYesNo.Yes) { _ddlVAT.Items.FindByValue("Yes").Selected = true; } else { _ddlVAT.Items.FindByValue("No").Selected = true; } _ddlVATRate.SelectedIndex = -1; for (int i = 0; i < _ddlVATRate.Items.Count; i++) { string vatRateId = GetValueOnIndexFromArray(_ddlVATRate.Items[i].Value, 0); if (vatRateId == accountsReturnValue.ChequeRequest.VATRateId.ToString()) { _ddlVATRate.Items[i].Selected = true; } } _txtVATAmount.Text = accountsReturnValue.ChequeRequest.VATAmount.ToString("0.00"); _chkBxAnticipated.Checked = accountsReturnValue.ChequeRequest.IsChequeRequestAnticipated; _chkBxAuthorise.Checked = accountsReturnValue.ChequeRequest.IsChequeRequestAuthorised; memberId = accountsReturnValue.ChequeRequest.MemberId; HideUnhideVATDetails(); } else { throw new Exception("Load failed."); } } else { throw new Exception(accountsReturnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } try { if (memberId != DataConstants.DummyGuid) { ViewState["MemberId"] = memberId; } else { ViewState["MemberId"] = DataConstants.DummyGuid.ToString(); } if (projectId != DataConstants.DummyGuid) { ViewState["ChequeRequestProjectId"] = projectId; HttpContext.Current.Session[SessionName.ProjectId] = projectId; LoadClientMatterDetails(projectId); } else { _cliMatDetails.LoadData = false; ViewState["ChequeRequestProjectId"] = DataConstants.DummyGuid.ToString(); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } } }
/// <summary> /// Saves office cheque request details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { // Sets error message if posting date is blank if (string.IsNullOrEmpty(_ccPostDate.DateText)) { _lblPostingPeriod.Text = "Invalid"; _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "Posting Date is not within the current financial year"; return; } ChequeRequest chequeRequest = GetControlData(); if (chequeRequest != null) { AccountsServiceClient accountsService = null; try { bool isPostingPeriodValid = SetPostingPeriod(); if (isPostingPeriodValid) { accountsService = new AccountsServiceClient(); ChequeRequestReturnValue returnValue = accountsService.SaveOfficeChequeRequest(_logonSettings.LogonId, chequeRequest); if (returnValue.Success) { // If print checkbox is checked then prints cheque request details // else shows success message on the same page. if (_chkBxPrintChequeRequest.Checked) { // Newly added cheque request id to populate details for printable format. Session[SessionName.ChequeRequestId] = returnValue.ChequeRequest.ChequeRequestId; // To redirect to printable format of cheque request details. Response.Redirect("~/Pages/Accounts/PrintableOfficeChequeRequest.aspx", true); } else { ResetControls(true); _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Office Cheque Request Saved Successfully."; } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } } }
/// <summary> /// Sets financial balances info by project id. /// </summary> private void SetFinancialBalances() { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; FinancialBalancesReturnValue returnValue = accountsService.GetFinancialBalances(logonId, projectId); if (returnValue.Success) { _txtAnticipatedBills.Text = returnValue.AnticipatedBills; _txtCostBills.Text = returnValue.CostBills; _txtDisbursements.Text = returnValue.AnticipatedDisbursements; _txtPFClaims.Text = returnValue.AnticipatedPFClaims; _txtTime.Text = returnValue.Time; _txtTimeChargeout.Text = returnValue.TimeChargeOut; _txtTimeCost.Text = returnValue.TimeCost; _txtUnbilledDisbursements.Text = returnValue.CostUnbilledDisbursements; _txtUnpaidbilledDisbursements.Text = returnValue.CostUnpaidBilledDisbursements; _txtWIPChargeout.Text = returnValue.WIPChargeOut; _txtWIPCost.Text = returnValue.WIPCost; _txtWIPTime.Text = returnValue.WIPTime; // Sets movement details if (returnValue.LastBill != DataConstants.BlankDate) { _ccLastBill.DateText = Convert.ToString(returnValue.LastBill); } if (returnValue.LastFinancial != DataConstants.BlankDate) { _ccLastFinancial.DateText = Convert.ToString(returnValue.LastFinancial); } if (returnValue.LastTime != DataConstants.BlankDate) { _ccLastTime.DateText = Convert.ToString(returnValue.LastTime); } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <summary> /// Sets client bank by project id in session /// </summary> /// <param name="projectId">Project id in session sets the client bank.</param> private void SetClientBank(Guid projectId) { AccountsServiceClient accountsService = null; ClientBankIdReturnValue returnValue = null; try { returnValue = new ClientBankIdReturnValue(); //If a value is selected then save it, this prevents the default value from //overriding the selection if (_ddlClientBank.Items.Count > 0) { accountsService = new AccountsServiceClient(); returnValue = accountsService.GetClientBankIdByProjectId(_logonSettings.LogonId, projectId); } if (returnValue.ClientBankId != 0) { if (_ddlClientBank.Items.FindByValue(returnValue.ClientBankId.ToString()) != null) { _ddlClientBank.SelectedValue = returnValue.ClientBankId.ToString(); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Binds VAT rates /// </summary> private void BindVatRates() { AccountsServiceClient accountsService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); VatRateSearchCriteria criteria = new VatRateSearchCriteria(); criteria.IncludeArchived = false; criteria.IncludeNonVatable = false; accountsService = new AccountsServiceClient(); VatRateSearchReturnValue vatReturnValue = accountsService.VatRateSearch(_logonSettings.LogonId, collectionRequest, criteria); if (vatReturnValue.Success) { if (vatReturnValue.VatRates != null) { for (int i = 0; i < vatReturnValue.VatRates.Rows.Length; i++) { ListItem item = new ListItem(vatReturnValue.VatRates.Rows[i].Description, vatReturnValue.VatRates.Rows[i].Id.ToString() + "$" + vatReturnValue.VatRates.Rows[i].Percentage.ToString()); if (vatReturnValue.VatRates.Rows[i].IsDefault) { _ddlVATRate.SelectedIndex = -1; item.Selected = true; } _ddlVATRate.Items.Add(item); } } } else { throw new Exception(vatReturnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Loads time transactions. /// </summary> /// <param name="startRow"></param> /// <param name="pageSize"></param> /// <param name="forceRefresh"></param> /// <returns>Returns time ledger.</returns> public TimeLedgerSearchItem[] LoadTimeLedger(int startRow, int pageSize, bool forceRefresh, string timeFilter) { AccountsServiceClient accountsService = null; TimeLedgerSearchItem[] allTimeTransactions = null; try { if (Session[SessionName.ProjectId] != null) { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; TimeLedgerSearchReturnValue returnValue = accountsService.GetTimeLedger(logonId, collectionRequest, timeFilter, projectId); if (returnValue.Success) { _allTimeTransactionsRowCount = returnValue.TimeTransactions.TotalRowCount; allTimeTransactions = returnValue.TimeTransactions.Rows; if (returnValue.TotalTimeTransactions != null) { // If filter is "All", only then totals for time,cost and charge will be set in session if (timeFilter == "All") { Session[SessionName.TotalTime] = returnValue.TotalTimeTransactions.TotalTimeElapsed; Session[SessionName.TotalCost] = returnValue.TotalTimeTransactions.TotalCost.ToString("0.00"); Session[SessionName.TotalCharge] = returnValue.TotalTimeTransactions.TotalCharge.ToString("0.00"); } Session["FilterCost"] = returnValue.TotalTimeTransactions.FilterCost.ToString(); Session["FilterCharge"] = returnValue.TotalTimeTransactions.FilterCharge.ToString("0.00"); Session["FilterTime"] = Convert.ToString(returnValue.TotalTimeTransactions.FilterTime); } // If the time filter is not "All", and also there are no rows to bind on grid view, // the set sessions to "null" if (_allTimeTransactionsRowCount == 0 && timeFilter != "All") { Session["FilterCost"] = null; Session["FilterCharge"] = null; Session["FilterTime"] = null; } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } return allTimeTransactions; }
/// <summary> /// Submits unposted draft bills to accounts /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnSubmit_Click(object sender, EventArgs e) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); CheckBox checkboxSelect = null; List <int> arrListSelectedDraftBillIds = new List <int>(); foreach (GridViewRow gridViewRow in _grdDraftBills.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { Label _lblDraftBillId = ((Label)gridViewRow.FindControl("_lblDraftBillId")); arrListSelectedDraftBillIds.Add(Convert.ToInt32(_lblDraftBillId.Text)); } } int[] arrSelectedIds = arrListSelectedDraftBillIds.ToArray(); // If there are any selected draft bill ids to be submitted, then call submit method. if (arrListSelectedDraftBillIds.Count > 0) { Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; DraftBillReturnValue returnValue = accountsService.SubmitDraftBill(logonId, arrSelectedIds); if (returnValue.Success) { _hdnRefresh.Value = "true"; // After submission again binds unposted draft bills. BindDraftBills(); } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <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(); } } } }
/// <summary> /// Saves client cheque request details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { // Sets error message if posting date is blank if (string.IsNullOrEmpty(_ccPostDate.DateText)) { _lblPostingPeriod.Text = "Invalid"; _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "Posting Date is not within the current financial year"; return; } bool isPostingPeriodValid = SetPostingPeriod(); if (isPostingPeriodValid) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); IRIS.Law.WebServiceInterfaces.Accounts.ChequeRequest clientChequeRequest = GetControlData(); // This flag is used to set the 'ProceedIfOverDrawn' flag on service class // after getting warning for insufficient funds if (ViewState["ProceedIfOverDrawn"] != null) { if (Convert.ToBoolean(ViewState["ProceedIfOverDrawn"])) { clientChequeRequest.ProceedIfOverDrawn = true; } else { clientChequeRequest.ProceedIfOverDrawn = false; } } ChequeRequestReturnValue returnValue = accountsService.SaveClientChequeRequest(_logonSettings.LogonId, clientChequeRequest); if (returnValue.Success) { ViewState["ProceedIfOverDrawn"] = false; // If print checkbox is checked then prints cheque request details // else shows success message on the same page. if (_chkBxPrintChequeRequest.Checked) { // Newly added cheque request id to populate details for printable format. Session[SessionName.ChequeRequestId] = returnValue.ChequeRequest.ChequeRequestId; // To redirect to printable format of cheque request details. Response.Redirect("~/Pages/Accounts/PrintableClientChequeRequest.aspx", true); } else { ResetControls(true); if (returnValue.Message != string.Empty) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "Client Cheque Request Saved Successfully. " + returnValue.Message; } else { _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Client Cheque Request Saved Successfully."; } } } else { _lblMessage.CssClass = "errorMessage"; if (!string.IsNullOrEmpty(returnValue.Message)) { _lblMessage.Text = returnValue.Message; } else if (!string.IsNullOrEmpty(returnValue.WarningMessage)) { ViewState["ProceedIfOverDrawn"] = true; _lblMessage.Text = returnValue.WarningMessage.Replace("Client account will be overdrawn, are you sure you wish to proceed?", "Client account will be overdrawn, press Save if you are sure you wish to proceed?"); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } } } else { return; } }
private void BindVatableTransactions() { AccountsServiceClient accountsService = null; try { Guid logonId = ((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId; accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; DisbursementLedgerReturnValue returnValue = accountsService.GetDisbursementLedgerVatableTransaction(logonId, projectId); if (returnValue.Success) { _grdUnbilledPaidVatable.DataSource = returnValue.Transactions.Rows; _grdUnbilledPaidVatable.DataBind(); } else { _grdUnbilledPaidVatable.DataSource = null; _grdUnbilledPaidVatable.DataBind(); throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Loads client cheque request details by client cheque request id /// </summary> /// <param name="chequeRequestId">Id reuired to populate client cheque request details.</param> private void LoadControls() { Guid projectId = DataConstants.DummyGuid; Guid memberId = DataConstants.DummyGuid; AccountsServiceClient accountsService = null; ChequeRequestReturnValue returnValue = null; if (_hdnClientChequeRequestId.Value.Trim().Length > 0) { accountsService = new AccountsServiceClient(); try { returnValue = new ChequeRequestReturnValue(); returnValue = accountsService.LoadClientChequeRequestDetails(_logonSettings.LogonId, Convert.ToInt32(_hdnClientChequeRequestId.Value)); if (returnValue.Success) { if (returnValue.ChequeRequest != null) { memberId = returnValue.ChequeRequest.MemberId; projectId = returnValue.ChequeRequest.ProjectId; _ccPostDate.DateText = returnValue.ChequeRequest.ChequeRequestDate.ToString("dd/MM/yyyy"); _txtDescription.Text = returnValue.ChequeRequest.ChequeRequestDescription; _txtPayee.Text = returnValue.ChequeRequest.ChequeRequestPayee; _ddlClientBank.SelectedValue = Convert.ToString(returnValue.ChequeRequest.BankId); _txtAmount.Text = returnValue.ChequeRequest.ChequeRequestAmount.ToString(); _chkBxAuthorise.Checked = returnValue.ChequeRequest.IsChequeRequestAuthorised; _txtReference.Text = returnValue.ChequeRequest.ChequeRequestReference; if (_txtReference.Text.Trim().ToLower() == "chq") { _spanPayee.Visible = true; _txtPayee.Visible = true; _lblPayee.Visible = true; _txtPayee.Text = _txtDescription.Text; _rfvPayee.Enabled = true; } _txtClearanceDaysChq.Text = returnValue.ChequeRequest.ClientChequeRequestsClearanceDaysChq.ToString(); _txtClearanceDaysElec.Text = returnValue.ChequeRequest.ClientChequeRequestsClearanceDaysElec.ToString(); if (returnValue.ChequeRequest.ClientChequeRequestsIsCredit) { _ddlClientDebitCredit.SelectedValue = "Credit"; GetClientClearanceTypes(); //SetClearanceDays(int.Parse(_dllClearanceType.SelectedValue), true); } else { _ddlClientDebitCredit.SelectedValue = "Debit"; GetClientClearanceTypes(); //SetClearanceDays(int.Parse(_dllClearanceType.SelectedValue), false); } //Populate DropDownList _dllClearanceType.SelectedValue = returnValue.ChequeRequest.ClearanceTypeId.ToString(); } else { throw new Exception("Load failed."); } } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } try { if (memberId != DataConstants.DummyGuid) { ViewState["MemberId"] = memberId; } else { ViewState["MemberId"] = DataConstants.DummyGuid.ToString(); } if (projectId != DataConstants.DummyGuid) { ViewState["ChequeRequestProjectId"] = projectId; HttpContext.Current.Session[SessionName.ProjectId] = projectId; // Loads client matter details. LoadClientMatterDetails(projectId); } else { _cliMatDetails.LoadData = false; ViewState["ChequeRequestProjectId"] = DataConstants.DummyGuid.ToString(); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } } }
public FullAccountModel(string accountNo) : this() { myAccount = new AccountsServiceClient().GetAccountByNo(accountNo); }
/// <summary> /// Loads time transactions. /// </summary> /// <param name="startRow"></param> /// <param name="pageSize"></param> /// <param name="forceRefresh"></param> /// <returns>Returns time ledger.</returns> public TimeLedgerSearchItem[] LoadTimeLedger(int startRow, int pageSize, bool forceRefresh, string timeFilter) { AccountsServiceClient accountsService = null; TimeLedgerSearchItem[] allTimeTransactions = null; try { if (Session[SessionName.ProjectId] != null) { accountsService = new AccountsServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; TimeLedgerSearchReturnValue returnValue = accountsService.GetTimeLedger(logonId, collectionRequest, timeFilter, projectId); if (returnValue.Success) { _allTimeTransactionsRowCount = returnValue.TimeTransactions.TotalRowCount; allTimeTransactions = returnValue.TimeTransactions.Rows; if (returnValue.TotalTimeTransactions != null) { // If filter is "All", only then totals for time,cost and charge will be set in session if (timeFilter == "All") { Session[SessionName.TotalTime] = returnValue.TotalTimeTransactions.TotalTimeElapsed; Session[SessionName.TotalCost] = returnValue.TotalTimeTransactions.TotalCost.ToString("0.00"); Session[SessionName.TotalCharge] = returnValue.TotalTimeTransactions.TotalCharge.ToString("0.00"); } Session["FilterCost"] = returnValue.TotalTimeTransactions.FilterCost.ToString(); Session["FilterCharge"] = returnValue.TotalTimeTransactions.FilterCharge.ToString("0.00"); Session["FilterTime"] = Convert.ToString(returnValue.TotalTimeTransactions.FilterTime); } // If the time filter is not "All", and also there are no rows to bind on grid view, // the set sessions to "null" if (_allTimeTransactionsRowCount == 0 && timeFilter != "All") { Session["FilterCost"] = null; Session["FilterCharge"] = null; Session["FilterTime"] = null; } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } return(allTimeTransactions); }
/// <summary> /// Deletes unauthorised cheque request for client or office /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void _btnDelete_Click(object sender, EventArgs e) { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); List<int> listSelectedChequeRequestIds = new List<int>(); CheckBox checkboxSelect = null; bool isClientChequeRequest = false; foreach (GridViewRow gridViewRow in _grdClientChequeRequestsDebit.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { isClientChequeRequest = true; Label _lblCheckRequestId = ((Label)gridViewRow.FindControl("_lblChequeRequestId")); listSelectedChequeRequestIds.Add(Convert.ToInt32(_lblCheckRequestId.Text)); } } foreach (GridViewRow gridViewRow in _grdClientChequeRequestsCredit.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { isClientChequeRequest = true; Label _lblCheckRequestId = ((Label)gridViewRow.FindControl("_lblChequeRequestId")); listSelectedChequeRequestIds.Add(Convert.ToInt32(_lblCheckRequestId.Text)); } } if (!isClientChequeRequest) { foreach (GridViewRow gridViewRow in _grdOfficeChequeRequests.Rows) { checkboxSelect = (CheckBox)gridViewRow.FindControl("_chkBxSelect"); if (checkboxSelect.Checked == true) { isClientChequeRequest = false; Label _lblCheckRequestId = ((Label)gridViewRow.FindControl("_lblChequeRequestId")); listSelectedChequeRequestIds.Add(Convert.ToInt32(_lblCheckRequestId.Text)); } } } // If there are any selected cheque request ids to be deleted, then call delete method. if (listSelectedChequeRequestIds.Count > 0) { int[] arrSelectedChequeRequestIds =listSelectedChequeRequestIds.ToArray(); Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; ChequeRequestReturnValue returnValue = accountsService.DeleteChequeRequests(logonId, arrSelectedChequeRequestIds, isClientChequeRequest); if (returnValue.Success) { // Disables the buttons after deletion,similar to page load. _btnDelete.Enabled = false; _btnAuthorise.Enabled = false; _hdnRefreshClientChequeRequestCredit.Value = "true"; _hdnRefreshClientChequeRequestDebit.Value = "true"; _hdnRefreshOfficeChequeRequest.Value = "true"; if (isClientChequeRequest) { _grdClientChequeRequestsCredit.PageIndex = 0; _grdClientChequeRequestsCredit.DataSourceID = _odsClientChequeRequestsCredit.ID; _grdClientChequeRequestsDebit.PageIndex = 0; _grdClientChequeRequestsDebit.DataSourceID = _odsClientChequeRequestsDebit.ID; } else { _grdOfficeChequeRequests.PageIndex = 0; _grdOfficeChequeRequests.DataSourceID = _odsOfficeChequeRequests.ID; } _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Cheque Request Deleted"; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }
/// <summary> /// Sets financial balances info by project id. /// </summary> private void SetFinancialBalances() { AccountsServiceClient accountsService = null; try { accountsService = new AccountsServiceClient(); Guid projectId = (Guid)Session[SessionName.ProjectId]; Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; FinancialBalancesReturnValue returnValue = accountsService.GetFinancialBalances(logonId, projectId); if (returnValue.Success) { _txtAnticipatedBills.Text = returnValue.AnticipatedBills; _txtCostBills.Text = returnValue.CostBills; _txtDisbursements.Text = returnValue.AnticipatedDisbursements; _txtPFClaims.Text = returnValue.AnticipatedPFClaims; _txtTime.Text = returnValue.Time; _txtTimeChargeout.Text = returnValue.TimeChargeOut; _txtTimeCost.Text = returnValue.TimeCost; _txtUnbilledDisbursements.Text = returnValue.CostUnbilledDisbursements; _txtUnpaidbilledDisbursements.Text = returnValue.CostUnpaidBilledDisbursements; _txtWIPChargeout.Text = returnValue.WIPChargeOut; _txtWIPCost.Text = returnValue.WIPCost; _txtWIPTime.Text = returnValue.WIPTime; // Sets movement details if (returnValue.LastBill != DataConstants.BlankDate) { _ccLastBill.DateText = Convert.ToString(returnValue.LastBill); } if (returnValue.LastFinancial != DataConstants.BlankDate) { _ccLastFinancial.DateText = Convert.ToString(returnValue.LastFinancial); } if (returnValue.LastTime != DataConstants.BlankDate) { _ccLastTime.DateText = Convert.ToString(returnValue.LastTime); } } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }