/// <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(); } } } }
/// <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(); } } }