Пример #1
0
        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);
        }
Пример #2
0
        /// <summary>
        /// Gets unauthorised office cheque requests
        /// </summary>
        /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param>
        /// <param name="collectionRequest">List of unauthorised client cheque requests</param>
        /// <param name="searchCriteria">IsAuthorised and IsPosted flags should be false to get list of
        /// unauthorised office cheque requests</param>
        /// <returns>Returns list of unauthorised office cheque requests</returns>
        public ChequeAuthorisationReturnValue GetUnauthorisedOfficeChequeRequests(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, ChequeAuthorisationSearchCriteria searchCriteria)
        {
            ChequeAuthorisationReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oAccountService = new AccountsService();
                returnValue     = oAccountService.GetUnauthorisedClientChequeRequests(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, searchCriteria);
            }
            else
            {
                returnValue         = new ChequeAuthorisationReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
        /// <summary>
        /// Gets unauthorised office cheque requests
        /// </summary>Function.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid)
        /// <param name="logonId">Logon id obtained when logging on to the logon service</param>
        /// <param name="collectionRequest">List of unauthorised client cheque requests</param>
        /// <param name="searchCriteria">IsAuthorised and IsPosted flags should be false to get list of 
        /// unauthorised office cheque requests</param>
        /// <returns>Returns list of unauthorised office cheque requests</returns>
        public ChequeAuthorisationReturnValue GetUnauthorisedOfficeChequeRequests(Guid logonId, CollectionRequest collectionRequest, ChequeAuthorisationSearchCriteria searchCriteria)
        {
            ChequeAuthorisationReturnValue returnValue = new ChequeAuthorisationReturnValue();

            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");
                    }

                    // Create a data list creator for a list of bills
                    DataListCreator<ChequeAuthorisationSearchItem> dataListCreator = new DataListCreator<ChequeAuthorisationSearchItem>();

                    // Declare an inline event (annonymous delegate) to read the
                    // dataset if it is required
                    dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e)
                    {
                        DsOfficeChequeRequestsDetails dsOfficeChequeRequestsDetails = SrvOfficeChequeRequestLookup.GetOfficeChequeRequestDetails(searchCriteria.IsAuthorised, searchCriteria.IsPosted);

                        DataSet dsUnauthorisedOfficeChequeRequests = new DataSet();
                        dsUnauthorisedOfficeChequeRequests.Tables.Add("UnauthorisedOfficeChequeRequests");
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("OfficeChequeRequestId", typeof(int));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("ProjectId", typeof(Guid));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("OfficeChequeRequestDate", typeof(DateTime));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("UserName", typeof(string));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("MatterReference", typeof(string));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("FeeEarnerReference", typeof(string));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("OfficeChequeRequestDescription", typeof(string));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("OfficeChequeRequestAmount", typeof(decimal));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("VATRateReferernce", typeof(string));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("VATRateAmount", typeof(decimal));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("OfficeChequeRequestBank", typeof(string));
                        dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Columns.Add("IsOfficeChequeRequestAnticipated", typeof(bool));

                        foreach (DataRow unauthorisedClientChequeRequestRow in dsOfficeChequeRequestsDetails.uvw_OfficeChequeRequestsDetails.Rows)
                        {
                            int officeChequeRequestId = Convert.ToInt32(unauthorisedClientChequeRequestRow["OfficeChequeRequestsId"].ToString());
                            DateTime officeChequeRequestDate = (DateTime)unauthorisedClientChequeRequestRow["OfficeChequeRequestsDate"];
                            string userName = (string)unauthorisedClientChequeRequestRow["userName"];
                            Guid projectId = (Guid)unauthorisedClientChequeRequestRow["ProjectId"];
                            string matterReference = (string)unauthorisedClientChequeRequestRow["matRef"];
                            string feeEarnerReference = (string)unauthorisedClientChequeRequestRow["feeRef"];
                            string officeChequeRequestDescription = (string)unauthorisedClientChequeRequestRow["OfficeChequeRequestsDesc"];
                            decimal officeChequeRequestAmount = (decimal)unauthorisedClientChequeRequestRow["OfficeChequeRequestsAmount"];
                            bool isOfficeChequeRequestAnticipated = (bool)unauthorisedClientChequeRequestRow["OfficeChequeRequestIsAnticipated"];
                            string vatRateReference = (string)unauthorisedClientChequeRequestRow["VATRateRef"];
                            decimal vatRateAmount = (decimal)unauthorisedClientChequeRequestRow["OfficeChequeRequestsVATAmount"];

                            officeChequeRequestAmount = Decimal.Round(officeChequeRequestAmount, 2);
                            vatRateAmount = Decimal.Round(vatRateAmount, 2);

                            // Gets the bank name by bank id
                            int bankId = Convert.ToInt32(unauthorisedClientChequeRequestRow["BankId"]);
                            string clientChequeRequestBankName = this.GetBankByBankId(bankId);

                            // Adds unauthorised office cheque requests after manipulating dataset.
                            dsUnauthorisedOfficeChequeRequests.Tables["UnauthorisedOfficeChequeRequests"].Rows.Add(officeChequeRequestId,
                                                                                                                    projectId,
                                                                                                                    officeChequeRequestDate,
                                                                                                                    userName,
                                                                                                                    matterReference,
                                                                                                                    feeEarnerReference,
                                                                                                                    officeChequeRequestDescription,
                                                                                                                    officeChequeRequestAmount.ToString(),
                                                                                                                    vatRateReference,
                                                                                                                    vatRateAmount.ToString(),
                                                                                                                    clientChequeRequestBankName,
                                                                                                                    isOfficeChequeRequestAnticipated);
                        }

                        e.DataSet = dsUnauthorisedOfficeChequeRequests;
                    };

                    // Create the data list
                    returnValue.ChequeRequests = dataListCreator.Create(logonId,
                        // Give the query a name so it can be cached
                        "GetUnauthorisedOfficeChequeRequests",
                        // Tell it the query criteria used so if the cache is accessed
                        // again it knows if it is the same query
                        searchCriteria.ToString(),
                        collectionRequest,
                        // Import mappings to map the dataset row fields to the data
                        // list entity properties
                        new ImportMapping[] {
                                            new ImportMapping("UserName", "UserName"),
                                            new ImportMapping("ProjectId", "ProjectId"),
                                            new ImportMapping("MatterReference","MatterReference"),
                                            new ImportMapping("FeeEarnerReference","FeeEarnerReference"),
                                            new ImportMapping("ChequeRequestId", "OfficeChequeRequestId"),
                                            new ImportMapping("BankName","OfficeChequeRequestBank"),
                                            new ImportMapping("ChequeRequestDate", "OfficeChequeRequestDate"),
                                            new ImportMapping("ChequeRequestAmount","OfficeChequeRequestAmount"),
                                            new ImportMapping("VATRate", "VATRateReferernce"),
                                            new ImportMapping("VATAmount","VATRateAmount"),
                                            new ImportMapping("ChequeRequestDescription","OfficeChequeRequestDescription"),
                                            new ImportMapping("IsChequeRequestAnticipated","IsOfficeChequeRequestAnticipated")
                            }
                        );
                }
                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>
        /// Gets unauthorised office cheque requests
        /// </summary>
        /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param>
        /// <param name="collectionRequest">List of unauthorised client cheque requests</param>
        /// <param name="searchCriteria">IsAuthorised and IsPosted flags should be false to get list of 
        /// unauthorised office cheque requests</param>
        /// <returns>Returns list of unauthorised office cheque requests</returns>
        public ChequeAuthorisationReturnValue GetUnauthorisedOfficeChequeRequests(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, ChequeAuthorisationSearchCriteria searchCriteria)
        {
            ChequeAuthorisationReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oAccountService = new AccountsService();
                returnValue = oAccountService.GetUnauthorisedClientChequeRequests(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, searchCriteria);
            }
            else
            {
                returnValue = new ChequeAuthorisationReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return returnValue;
        }