/// <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> /// Adds or edits office cheque requests depending on the 'IsClientChequeRequest' property /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="chequeRequest">ChequeRequest properties to add/edit cheque request.</param> /// <returns>Returns cheque request id after adding or editting cheque request.</returns> public ChequeRequestReturnValue SaveOfficeChequeRequest(HostSecurityToken oHostSecurityToken, ChequeRequest chequeRequest) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.SaveOfficeChequeRequest(Functions.GetLogonIdFromToken(oHostSecurityToken), chequeRequest); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <summary> /// Deletes cheque requests for client or office. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="selectedChequeRequests">Collection of cheque requests for client or office for deletion</param> /// <param name="isClientChequeRequest">Flag whether deletion is for client or office</param> /// <returns>Deletes cheque requests for client or office.</returns> public ChequeRequestReturnValue DeleteChequeRequests(HostSecurityToken oHostSecurityToken, List <int> selectedChequeRequestsIds, bool isClientChequeRequest) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.DeleteChequeRequests(Functions.GetLogonIdFromToken(oHostSecurityToken), selectedChequeRequestsIds, isClientChequeRequest); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <summary> /// Loads office cheque request details for printing /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="clientChequeRequestId">Office cheque request id toget cheque request details.</param> /// <returns>Returns office cheque request details by office cheque request id.</returns> public ChequeRequestReturnValue LoadOfficeChequeRequestDetailsForPrinting(HostSecurityToken oHostSecurityToken, int officeChequeRequestId) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.LoadOfficeChequeRequestDetailsForPrinting(Functions.GetLogonIdFromToken(oHostSecurityToken), officeChequeRequestId); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <summary> /// Gets the client bank id by project id /// Get OfficeVattable /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="projectId">Project id to get client bank id</param> public ChequeRequestReturnValue GetDefaultChequeRequestDetails(HostSecurityToken oHostSecurityToken, Guid projectId) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.GetDefaultChequeRequestDetails(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <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; } }
/// <summary> /// Adds or edits office cheque requests depending on the 'IsClientChequeRequest' property /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="chequeRequest">ChequeRequest properties to add/edit cheque request.</param> /// <returns>Returns cheque request id after adding or editting cheque request.</returns> public ChequeRequestReturnValue SaveOfficeChequeRequest(Guid logonId, ChequeRequest chequeRequest) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } //163 - Create Office Cheque Requests //if (!UserSecuritySettings.GetUserSecuitySettings(163)) if (!UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.CreateOfficeChequeRequest)) throw new Exception("You do not have sufficient permissions to carry out this request"); SrvOfficeChequeRequest srvOfficeChequeRequest = new SrvOfficeChequeRequest(); srvOfficeChequeRequest.Id = chequeRequest.ChequeRequestId; srvOfficeChequeRequest.ProjectId = chequeRequest.ProjectId; srvOfficeChequeRequest.Date = chequeRequest.ChequeRequestDate; srvOfficeChequeRequest.DisbursementTypeId = chequeRequest.DisbursementTypeId; srvOfficeChequeRequest.Description = chequeRequest.ChequeRequestDescription; srvOfficeChequeRequest.Payee = chequeRequest.ChequeRequestPayee; srvOfficeChequeRequest.OfficeBankId = chequeRequest.BankId; srvOfficeChequeRequest.Amount = chequeRequest.ChequeRequestAmount; srvOfficeChequeRequest.OfficeVATTable = chequeRequest.OfficeVATTable; srvOfficeChequeRequest.VATRateId = chequeRequest.VATRateId; srvOfficeChequeRequest.VATAmount = chequeRequest.VATAmount; srvOfficeChequeRequest.IsAnticipated = chequeRequest.IsChequeRequestAnticipated; srvOfficeChequeRequest.MemberId = chequeRequest.MemberId; string errorMessage = string.Empty; string caption = string.Empty; bool isSaveSuccessful = srvOfficeChequeRequest.Save(out errorMessage, out caption); if (chequeRequest.ChequeRequestId == 0) { chequeRequest.ChequeRequestId = srvOfficeChequeRequest.Id; } returnValue.ChequeRequest = chequeRequest; returnValue.Success = isSaveSuccessful; if (returnValue.Success) { // if client cheque request is saved then authorises it. if (chequeRequest.IsChequeRequestAuthorised && UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.AuthoriseClientChequeRequest)) { if (UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.AuthoriseChequeRequestHigherAmount)) { SrvOfficeChequeRequestCommon.AddAuthoriseOfficeChequeRequests(srvOfficeChequeRequest.Id, UserInformation.Instance.UserMemberId, DateTime.Now); } else { Decimal officeChequeRequestHigherAmount = Convert.ToDecimal(UserSecuritySettings.GetUserSecuitySettingsFeatureValue((int)AccountsSettings.OfficeChequeRequestHigherAmount)); if (Convert.ToDecimal(srvOfficeChequeRequest.Amount) > officeChequeRequestHigherAmount) { errorMessage = "You are not allowed to Authorise Off Cheque Requests over the value of £" + officeChequeRequestHigherAmount.ToString("0.00") + "."; } else { SrvOfficeChequeRequestCommon.AddAuthoriseOfficeChequeRequests(srvOfficeChequeRequest.Id, UserInformation.Instance.UserMemberId, DateTime.Now); } } } chequeRequest.ChequeRequestId = srvOfficeChequeRequest.Id; returnValue.ChequeRequest = chequeRequest; } returnValue.Message = errorMessage; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception Ex) { returnValue.Success = false; returnValue.Message = Ex.Message; } return returnValue; }
/// <summary> /// Adds or edits client cheque requests depending on the 'IsClientChequeRequest' property /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="chequeRequest">ChequeRequest properties to add/edit cheque request.</param> /// <returns>Returns cheque request id after adding or editting cheque request.</returns> public ChequeRequestReturnValue SaveClientChequeRequest(Guid logonId, ChequeRequest clientChequeRequest) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } //243 = RequestClientCredits //242 = RequestClientDebits if (clientChequeRequest.ClientChequeRequestsIsCredit) if (!UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.RequestClientCredits)) //if (!UserSecuritySettings.GetUserSecuitySettings(243)) throw new Exception("You do not have sufficient permissions to carry out this request"); if (!clientChequeRequest.ClientChequeRequestsIsCredit) if (!UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.RequestClientDebits)) //if (!UserSecuritySettings.GetUserSecuitySettings(242)) throw new Exception("You do not have sufficient permissions to carry out this request"); string errorMessage = string.Empty; string warningMessage = string.Empty; string errorCaption = string.Empty; // Creates object for client cheque request service class SrvClientChequeRequest srvClientChequeRequest = new SrvClientChequeRequest(); // Sets properties srvClientChequeRequest.Id = clientChequeRequest.ChequeRequestId; srvClientChequeRequest.ProjectId = clientChequeRequest.ProjectId; srvClientChequeRequest.Date = clientChequeRequest.ChequeRequestDate; srvClientChequeRequest.ClientBankId = clientChequeRequest.BankId; srvClientChequeRequest.Description = clientChequeRequest.ChequeRequestDescription; srvClientChequeRequest.Payee = clientChequeRequest.ChequeRequestPayee; srvClientChequeRequest.Amount = clientChequeRequest.ChequeRequestAmount; srvClientChequeRequest.Reference = clientChequeRequest.ChequeRequestReference; srvClientChequeRequest.MemberId = clientChequeRequest.MemberId; srvClientChequeRequest.ClearanceDaysChq = clientChequeRequest.ClientChequeRequestsClearanceDaysChq; srvClientChequeRequest.ClearanceDaysElec = clientChequeRequest.ClientChequeRequestsClearanceDaysElec; srvClientChequeRequest.ClearanceTypeId = clientChequeRequest.ClearanceTypeId; srvClientChequeRequest.IsCredit = clientChequeRequest.ClientChequeRequestsIsCredit; if (clientChequeRequest.ProceedIfOverDrawn) { // If the 'ProceedIfOverDrawn' flag is false then it should be true for next // save click event. As its false for warning messages. srvClientChequeRequest.ProceedIfOverDrawn = true; } returnValue.Success = srvClientChequeRequest.Save(out errorMessage, out warningMessage, out errorCaption); if (returnValue.Success) { // if client cheque request is saved then authorises it. if (clientChequeRequest.IsChequeRequestAuthorised && UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.AuthoriseClientChequeRequest)) { if (UserSecuritySettings.GetUserSecuitySettings((int)AccountsSettings.AuthoriseChequeRequestHigherAmount)) { // As Suggested by client to use the overloaded method and requestId property if (srvClientChequeRequest.RequesterId == UserInformation.Instance.DbUid) { SrvClientChequeRequestCommon.AddAuthoriseClientChequeRequests(srvClientChequeRequest.Id, UserInformation.Instance.UserMemberId, DateTime.Now); } else { SrvClientChequeRequestCommon.AddAuthoriseClientChequeRequests(srvClientChequeRequest.Id, UserInformation.Instance.UserMemberId, DateTime.Now, srvClientChequeRequest.RequesterId, srvClientChequeRequest.Description); } } else { Decimal clientChequeRequestHigherAmount = Convert.ToDecimal(UserSecuritySettings.GetUserSecuitySettingsFeatureValue((int)AccountsSettings.ClientChequeRequestHigherAmount)); if (Convert.ToDecimal(srvClientChequeRequest.Amount) > clientChequeRequestHigherAmount) { errorMessage = "You are not allowed to Authorise Client Cheque Requests over the value of £" + clientChequeRequestHigherAmount.ToString("0.00") + "."; } else { SrvClientChequeRequestCommon.AddAuthoriseClientChequeRequests(srvClientChequeRequest.Id, UserInformation.Instance.UserMemberId, DateTime.Now); } } } clientChequeRequest.ChequeRequestId = srvClientChequeRequest.Id; returnValue.ChequeRequest = clientChequeRequest; } returnValue.Message = errorMessage; returnValue.WarningMessage = warningMessage; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Deletes cheque requests for client or office. /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="selectedChequeRequests">Collection of cheque requests for client or office for deletion</param> /// <param name="isClientChequeRequest">Flag whether deletion is for client or office</param> /// <returns>Deletes cheque requests for client or office.</returns> public ChequeRequestReturnValue DeleteChequeRequests(Guid logonId, List<int> selectedChequeRequestsIds, bool isClientChequeRequest) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } if (selectedChequeRequestsIds.Count > 0) { SrvClientChequeRequest srvClientChequeRequest = null; SrvOfficeChequeRequest srvOfficeChequeRequest = null; if (isClientChequeRequest) { srvClientChequeRequest = new SrvClientChequeRequest(); } else { srvOfficeChequeRequest = new SrvOfficeChequeRequest(); } for (int index = 0; index < selectedChequeRequestsIds.Count; index++) { int chequeRequestId = selectedChequeRequestsIds[index]; if (isClientChequeRequest) { srvClientChequeRequest.Delete(chequeRequestId, UserInformation.Instance.UserMemberId, DateTime.Now); } else { srvOfficeChequeRequest.Delete(chequeRequestId, UserInformation.Instance.UserMemberId, DateTime.Now); } } } } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Loads office cheque request details for printing /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="clientChequeRequestId">Office cheque request id toget cheque request details.</param> /// <returns>Returns office cheque request details by office cheque request id.</returns> public ChequeRequestReturnValue LoadOfficeChequeRequestDetailsForPrinting(Guid logonId, int officeChequeRequestId) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } ChequeRequest officeChequeRequest = new ChequeRequest(); DsOfficeChequeRequests dsOfficeChequeRequestsDetails = SrvOfficeChequeRequestLookup.GetOfficeChequeRequestsByOfficeChequeRequestId(officeChequeRequestId); // Gets printable properties from the dataset foreach (DataRow drOfficeChequeRequest in dsOfficeChequeRequestsDetails.OfficeChequeRequests.Rows) { Guid projectId = (Guid)drOfficeChequeRequest["projectId"]; // Gets the matter description by project id SrvMatter srvMatter = new SrvMatter(); srvMatter.Load(projectId); Guid clientId = srvMatter.ClientId; string matterDescription = srvMatter.MatterDescription; string matterReference = srvMatter.MatterReference; bool isMember = srvMatter.IsMember; // Inserts "-" in between matter reference matterReference = matterReference.Insert(6, "-"); string personName = srvMatter.ClientName; // Gets the partner name by partner member id for project id Guid partnerId = srvMatter.MatterPartnerMemberId; string partnerName = SrvEarnerCommon.GetFeeEarnerNameByFeeEarnerId(partnerId); // Gets the fee earner name by fee earner id Guid feeEarnerId = srvMatter.FeeEarnerMemberId; string feeEarnerName = SrvEarnerCommon.GetFeeEarnerNameByFeeEarnerId(feeEarnerId); // This member id is from application settings for accounts. Guid userMemberId = (Guid)drOfficeChequeRequest["memberId"]; DateTime officeChequeRequestDate = (DateTime)drOfficeChequeRequest["OfficeChequeRequestsDate"]; // Gets user name by member id DsSystemUsers dsSystemUsers = SrvUserLookup.GetUser(userMemberId.ToString()); string userName = string.Empty; if (dsSystemUsers.uvw_SystemUsers.Count > 0) { userName = dsSystemUsers.uvw_SystemUsers[0].name; } else { DsPersonDealing dsPersonDealing = SrvMatterLookup.GetPersonDealingLookup(); for (int index = 0; index < dsPersonDealing.uvw_PersonDealingLookup.Count; index++) { if (dsPersonDealing.uvw_PersonDealingLookup[index].MemberID == userMemberId) { userName = dsPersonDealing.uvw_PersonDealingLookup[index].name; } } } int bankId = (int)drOfficeChequeRequest["bankId"]; string officeChequeRequestDescription = (string)drOfficeChequeRequest["OfficeChequeRequestsDesc"]; string officeChequeRequestPayee = (string)drOfficeChequeRequest["OfficeChequeRequestsPayee"]; int officeChequeRequestVATRateId = (int)drOfficeChequeRequest["VatRateId"]; // Gets VAT rate by VAT rate id DsVatRates dsVATRates = SrvVATRateLookup.GetVatRates(officeChequeRequestVATRateId); string officeChequeRequestVATRateReference = (string)dsVATRates.VatRates[0].VatRateRef; // Gets the bank name by bank id string officeChequeRequestBankName = this.GetBankByBankId(bankId); decimal officeChequeRequestAmount = (decimal)drOfficeChequeRequest["OfficeChequeRequestsAmount"]; decimal officeChequeRequestVATAmount = (decimal)drOfficeChequeRequest["OfficeChequeRequestsVATAmount"]; bool isOfficeChequeAuthorised = (bool)drOfficeChequeRequest["OfficeChequeRequestsIsAuthorised"]; bool isOfficeChequeAnticipated = (bool)drOfficeChequeRequest["OfficeChequeRequestIsAnticipated"]; officeChequeRequest.UserName = userName; officeChequeRequest.PersonName = personName; officeChequeRequest.PartnerName = partnerName; officeChequeRequest.FeeEarnerReference = feeEarnerName; officeChequeRequest.BankName = officeChequeRequestBankName; officeChequeRequest.ChequeRequestDate = officeChequeRequestDate; officeChequeRequest.ChequeRequestPayee = officeChequeRequestPayee; officeChequeRequest.VATAmount = officeChequeRequestVATAmount; officeChequeRequest.VATRate = officeChequeRequestVATRateReference; officeChequeRequest.ChequeRequestAmount = officeChequeRequestAmount; officeChequeRequest.MatterDescription = matterDescription; officeChequeRequest.MatterReference = matterReference; officeChequeRequest.IsChequeRequestAuthorised = isOfficeChequeAuthorised; officeChequeRequest.IsChequeRequestAnticipated = isOfficeChequeAnticipated; officeChequeRequest.ChequeRequestDescription = officeChequeRequestDescription; // Gets addressline1,addressline2,addressline3 for client. if (isMember) { DsMemAddress dsMemAddress = SrvAddressLookup.GetMemberAddresses(clientId); if (dsMemAddress.Address.Rows.Count > 0) { officeChequeRequest.AddressLine1 = dsMemAddress.Address[0].AddressLine1.ToString().Trim(); officeChequeRequest.AddressLine2 = dsMemAddress.Address[0].AddressLine2.ToString().Trim(); officeChequeRequest.AddressLine3 = dsMemAddress.Address[0].AddressLine3.ToString().Trim(); officeChequeRequest.AddressTown = dsMemAddress.Address[0].AddressTown.ToString().Trim(); officeChequeRequest.AddressCounty = dsMemAddress.Address[0].AddressCounty.ToString().Trim(); officeChequeRequest.AddressPostcode = dsMemAddress.Address[0].AddressPostCode.ToString().Trim(); } } else // Look for organisation address if the client is not member. { DsOrgAddress dsOrgAddress = SrvAddressLookup.GetOrganisationAddresses(clientId); if (dsOrgAddress.Address.Rows.Count > 0) { officeChequeRequest.AddressLine1 = dsOrgAddress.Address[0].AddressLine1.ToString().Trim(); officeChequeRequest.AddressLine2 = dsOrgAddress.Address[0].AddressLine2.ToString().Trim(); officeChequeRequest.AddressLine3 = dsOrgAddress.Address[0].AddressLine3.ToString().Trim(); officeChequeRequest.AddressTown = dsOrgAddress.Address[0].AddressTown.ToString().Trim(); officeChequeRequest.AddressCounty = dsOrgAddress.Address[0].AddressCounty.ToString().Trim(); officeChequeRequest.AddressPostcode = dsOrgAddress.Address[0].AddressPostCode.ToString().Trim(); } } } returnValue.ChequeRequest = officeChequeRequest; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Loads office cheque request details /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="officeChequeRequestId">Office Cheque Request id to get details</param> /// <returns>Loads office cheque request details</returns> public ChequeRequestReturnValue LoadOfficeChequeRequestDetails(Guid logonId, int officeChequeRequestId) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } SrvOfficeChequeRequest srvOfficeChequeRequest = new SrvOfficeChequeRequest(); srvOfficeChequeRequest.Id = officeChequeRequestId; srvOfficeChequeRequest.Load(); ChequeRequest chequeReq = new ChequeRequest(); chequeReq.ProjectId = srvOfficeChequeRequest.ProjectId; chequeReq.ChequeRequestDate = srvOfficeChequeRequest.Date; chequeReq.DisbursementTypeId = srvOfficeChequeRequest.DisbursementTypeId; chequeReq.ChequeRequestDescription = srvOfficeChequeRequest.Description; chequeReq.ChequeRequestPayee = srvOfficeChequeRequest.Payee; chequeReq.BankId = srvOfficeChequeRequest.OfficeBankId; chequeReq.ChequeRequestAmount = srvOfficeChequeRequest.Amount; chequeReq.OfficeVATTable = srvOfficeChequeRequest.OfficeVATTable; chequeReq.VATRateId = srvOfficeChequeRequest.VATRateId; chequeReq.VATAmount = srvOfficeChequeRequest.VATAmount; chequeReq.IsChequeRequestAuthorised = srvOfficeChequeRequest.IsAuthorised; chequeReq.MemberId = srvOfficeChequeRequest.MemberId; chequeReq.IsChequeRequestAnticipated = srvOfficeChequeRequest.IsAnticipated; returnValue.ChequeRequest = chequeReq; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception Ex) { returnValue.Success = false; returnValue.Message = Ex.Message; } return returnValue; }
/// <summary> /// Loads cheque request details /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="clientChequeRequestId">Client cheque request id toget cheque request details.</param> /// <returns>Returns client cheque request details by client cheque request id.</returns> public ChequeRequestReturnValue LoadClientChequeRequestDetailsForPrinting(Guid logonId, int clientChequeRequestId) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } ChequeRequest clientChequeRequest = new ChequeRequest(); DsClientChequeRequestsDetails dsClientChequeRequestsDetails = SrvClientChequeRequestLookup.GetClientChequeRequestDetails(clientChequeRequestId); // Gets printable properties from the dataset foreach (DataRow drClientChequeRequest in dsClientChequeRequestsDetails.uvw_ClientChequeRequestsDetails.Rows) { Guid projectId = (Guid)drClientChequeRequest["projectId"]; // Gets the matter details by project id SrvMatter srvMatter = new SrvMatter(); srvMatter.Load(projectId); Guid clientId = srvMatter.ClientId; bool isMember = srvMatter.IsMember; string matterDescription = srvMatter.MatterDescription; string matterReference = srvMatter.MatterReference; // Inserts "-" in between matter reference matterReference = matterReference.Insert(6, "-"); string personName = srvMatter.ClientName; // Gets the partner name by partner member id for project id Guid partnerId = srvMatter.MatterPartnerMemberId; string partnerName = SrvEarnerCommon.GetFeeEarnerNameByFeeEarnerId(partnerId); // Client name should be related to project id DateTime clientChequeRequestDate = (DateTime)drClientChequeRequest["ClientChequeRequestsDate"]; string feeEarnerReference = (string)drClientChequeRequest["feeRef"]; string userName = (string)drClientChequeRequest["userName"]; string clientChequeRequestDescription = (string)drClientChequeRequest["ClientChequeRequestsDesc"]; string clientChequeRequestPayee = (string)drClientChequeRequest["ClientChequeRequestsPayee"]; int bankId = (int)drClientChequeRequest["bankId"]; string clientChequeRequestBankName = this.GetBankByBankId(bankId); decimal clientChequeRequestAmount = (decimal)drClientChequeRequest["ClientChequeRequestsAmount"]; bool isClientChequeAuthorised = (bool)drClientChequeRequest["ClientChequeRequestsIsAuthorised"]; string matBranchRef = (string)drClientChequeRequest["matBranchRef"]; string ClearanceTypeDesc = (string)drClientChequeRequest["ClearanceTypeDesc"]; clientChequeRequest.PersonName = personName; clientChequeRequest.IsChequeRequestAuthorised = isClientChequeAuthorised; clientChequeRequest.ChequeRequestDate = clientChequeRequestDate; clientChequeRequest.ChequeRequestDescription = clientChequeRequestDescription; clientChequeRequest.ChequeRequestPayee = clientChequeRequestPayee; clientChequeRequest.BankName = clientChequeRequestBankName; clientChequeRequest.ChequeRequestAmount = clientChequeRequestAmount; clientChequeRequest.UserName = userName; clientChequeRequest.FeeEarnerReference = feeEarnerReference; clientChequeRequest.MatterReference = matterReference; clientChequeRequest.MatterDescription = matterDescription; clientChequeRequest.PartnerName = partnerName; clientChequeRequest.ClearanceTypeDesc = ClearanceTypeDesc; clientChequeRequest.MatBranchRef = matBranchRef; // Gets address details for client if (isMember) { DsMemAddress dsMemAddress = SrvAddressLookup.GetMemberAddresses(clientId); if (dsMemAddress.Address.Rows.Count > 0) { clientChequeRequest.AddressLine1 = dsMemAddress.Address[0].AddressLine1.ToString().Trim(); clientChequeRequest.AddressLine2 = dsMemAddress.Address[0].AddressLine2.ToString().Trim(); clientChequeRequest.AddressLine3 = dsMemAddress.Address[0].AddressLine3.ToString().Trim(); clientChequeRequest.AddressTown = dsMemAddress.Address[0].AddressTown.ToString().Trim(); clientChequeRequest.AddressCounty = dsMemAddress.Address[0].AddressCounty.ToString().Trim(); clientChequeRequest.AddressPostcode = dsMemAddress.Address[0].AddressPostCode.ToString().Trim(); } } else // if a client is not member client look address detail fo organisation client. { DsOrgAddress dsOrgAddress = SrvAddressLookup.GetOrganisationAddresses(clientId); if (dsOrgAddress.Address.Rows.Count > 0) { clientChequeRequest.AddressLine1 = dsOrgAddress.Address[0].AddressLine1.ToString().Trim(); clientChequeRequest.AddressLine2 = dsOrgAddress.Address[0].AddressLine2.ToString().Trim(); clientChequeRequest.AddressLine3 = dsOrgAddress.Address[0].AddressLine3.ToString().Trim(); clientChequeRequest.AddressTown = dsOrgAddress.Address[0].AddressTown.ToString().Trim(); clientChequeRequest.AddressCounty = dsOrgAddress.Address[0].AddressCounty.ToString().Trim(); clientChequeRequest.AddressPostcode = dsOrgAddress.Address[0].AddressPostCode.ToString().Trim(); } } } returnValue.ChequeRequest = clientChequeRequest; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <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> /// 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(); } } }
/// <summary> /// Gets the client bank id by project id /// Get OfficeVattable /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="projectId">Project id to get client bank id</param> public ChequeRequestReturnValue GetDefaultChequeRequestDetails(Guid logonId, Guid projectId) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } ChequeRequest chequeReq = new ChequeRequest(); chequeReq.BankId = SrvMatterCommon.GetClientBankIdByProjectId(projectId); chequeReq.BankOfficeId = SrvMatterCommon.GetOfficeBankIdByProjectId(projectId); Guid matterBranchId = SrvMatterCommon.GetMatterBranchGuid(projectId); if (matterBranchId != PmsCommonData.DataConstants.DummyGuid) { bool branchNoVat = SrvBranchCommon.GetBranchNoVAT(matterBranchId); if (branchNoVat) { chequeReq.OfficeVATTable = IlbCommon.YesNo.No; } } returnValue.ChequeRequest = chequeReq; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Adds or edits office cheque requests depending on the 'IsClientChequeRequest' property /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="chequeRequest">ChequeRequest properties to add/edit cheque request.</param> /// <returns>Returns cheque request id after adding or editting cheque request.</returns> public ChequeRequestReturnValue SaveOfficeChequeRequest(HostSecurityToken oHostSecurityToken, ChequeRequest chequeRequest) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.SaveOfficeChequeRequest(Functions.GetLogonIdFromToken(oHostSecurityToken), chequeRequest); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <summary> /// Loads office cheque request details for printing /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="clientChequeRequestId">Office cheque request id toget cheque request details.</param> /// <returns>Returns office cheque request details by office cheque request id.</returns> public ChequeRequestReturnValue LoadOfficeChequeRequestDetailsForPrinting(HostSecurityToken oHostSecurityToken, int officeChequeRequestId) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.LoadOfficeChequeRequestDetailsForPrinting(Functions.GetLogonIdFromToken(oHostSecurityToken), officeChequeRequestId); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <summary> /// Gets the client bank id by project id /// Get OfficeVattable /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="projectId">Project id to get client bank id</param> public ChequeRequestReturnValue GetDefaultChequeRequestDetails(HostSecurityToken oHostSecurityToken, Guid projectId) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.GetDefaultChequeRequestDetails(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <summary> /// Deletes cheque requests for client or office. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="selectedChequeRequests">Collection of cheque requests for client or office for deletion</param> /// <param name="isClientChequeRequest">Flag whether deletion is for client or office</param> /// <returns>Deletes cheque requests for client or office.</returns> public ChequeRequestReturnValue DeleteChequeRequests(HostSecurityToken oHostSecurityToken, List<int> selectedChequeRequestsIds, bool isClientChequeRequest) { ChequeRequestReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.DeleteChequeRequests(Functions.GetLogonIdFromToken(oHostSecurityToken), selectedChequeRequestsIds, isClientChequeRequest); } else { returnValue = new ChequeRequestReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <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> /// 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 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> /// Loads client cheque request details /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="officeChequeRequestId">Client Cheque Request id to get details</param> /// <returns>Loads client cheque request details</returns> public ChequeRequestReturnValue LoadClientChequeRequestDetails(Guid logonId, int clientChequeRequestId) { ChequeRequestReturnValue returnValue = new ChequeRequestReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } SrvClientChequeRequest srvClientChequeRequest = new SrvClientChequeRequest(); srvClientChequeRequest.Id = clientChequeRequestId; srvClientChequeRequest.Load(); ChequeRequest chequeRequest = new ChequeRequest(); chequeRequest.ProjectId = srvClientChequeRequest.ProjectId; chequeRequest.ChequeRequestReference = srvClientChequeRequest.Reference; chequeRequest.ChequeRequestDate = srvClientChequeRequest.Date; chequeRequest.ChequeRequestDescription = srvClientChequeRequest.Description; chequeRequest.ChequeRequestPayee = srvClientChequeRequest.Payee; chequeRequest.BankId = srvClientChequeRequest.ClientBankId; chequeRequest.ChequeRequestAmount = srvClientChequeRequest.Amount; chequeRequest.IsChequeRequestAuthorised = srvClientChequeRequest.IsAuthorised; chequeRequest.MemberId = srvClientChequeRequest.MemberId; chequeRequest.ClientChequeRequestsIsCredit = srvClientChequeRequest.IsCredit; chequeRequest.ClientChequeRequestsClearanceDaysElec = srvClientChequeRequest.ClearanceDaysElec; chequeRequest.ClientChequeRequestsClearanceDaysChq = srvClientChequeRequest.ClearanceDaysChq; chequeRequest.ClearanceTypeId = srvClientChequeRequest.ClearanceTypeId; returnValue.ChequeRequest = chequeRequest; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception Ex) { returnValue.Success = false; returnValue.Message = Ex.Message; } return returnValue; }
/// <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> /// 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(); } } } }