示例#1
0
        public DisbursementLedgerReturnValue GetDisbursementLedgerNonVatableTransaction(HostSecurityToken oHostSecurityToken, Guid projectId)
        {
            DisbursementLedgerReturnValue returnValue = null;

            if (Functions.ValidateIWSToken(oHostSecurityToken))
            {
                oAccountService = new AccountsService();
                returnValue     = oAccountService.GetDisbursementLedgerNonVatableTransaction(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId);
            }
            else
            {
                returnValue         = new DisbursementLedgerReturnValue();
                returnValue.Success = false;
                returnValue.Message = "Invalid Token";
            }
            return(returnValue);
        }
        public DisbursementLedgerReturnValue GetDisbursementLedgerVatableTransaction(Guid logonId, Guid projectId)
        {
            DisbursementLedgerReturnValue returnValue = new DisbursementLedgerReturnValue();

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

                    Collection<SrvDisbsLedgerTransactions> transactions =
                        SrvDraftBillCommon.GetDisbsLedgerVatableTransactions(projectId);

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

                    returnValue.Transactions = dataListCreator.Create<SrvDisbsLedgerTransactions>(transactions,
                        new ImportMapping[] {
                            new ImportMapping("Date", "PostingDetailsDate"),
                            new ImportMapping("Reference", "PostingDetailsReference"),
                            new ImportMapping("Description", "PostingDetailsDescription"),
                            new ImportMapping("Amount", "Amount"),
                            new ImportMapping("Billed", "Billed"),
                            new ImportMapping("VatRateId", "VatRateId"),
                            new ImportMapping("BillDisbursementAllocationAmount", "BillDisbursementAllocationAmount"),
                            new ImportMapping("PostingId", "PostingId"),
                            new ImportMapping("UnBilled", "UnBilled"),
                            new ImportMapping("IsBilled", "IsBilled")
                    });
                }
                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;
        }
 public DisbursementLedgerReturnValue GetDisbursementLedgerVatableTransaction(HostSecurityToken oHostSecurityToken, Guid projectId)
 {
     DisbursementLedgerReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oAccountService = new AccountsService();
         returnValue = oAccountService.GetDisbursementLedgerVatableTransaction(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId);
     }
     else
     {
         returnValue = new DisbursementLedgerReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }