Exemplo n.º 1
0
        public AnticipatedDisbursementLedgerReturnValue GetAnticipatedDisbursementLedgerNonVatableTransaction(HostSecurityToken oHostSecurityToken, Guid projectId)
        {
            AnticipatedDisbursementLedgerReturnValue returnValue = null;

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

            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
                    DataListCreator<AnticipatedDisbursementLedgerTransaction> dataListCreator = new DataListCreator<AnticipatedDisbursementLedgerTransaction>();

                    Collection<SrvAntiDisbsLedgerTransaction> transactions =
                            SrvDraftBillCommon.GetAntiDisbLedgerVatableTransactions(projectId);

                    returnValue.Transactions = dataListCreator.Create<SrvAntiDisbsLedgerTransaction>(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("UnBilled", "UnBilled"),
                            new ImportMapping("PostingId", "PostingId"),
                            new ImportMapping("VatRateId", "VatRateId"),
                            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 AnticipatedDisbursementLedgerReturnValue GetAnticipatedDisbursementLedgerVatableTransaction(HostSecurityToken oHostSecurityToken, Guid projectId)
 {
     AnticipatedDisbursementLedgerReturnValue returnValue = null;
     if (Functions.ValidateIWSToken(oHostSecurityToken))
     {
         oAccountService = new AccountsService();
         returnValue = oAccountService.GetAnticipatedDisbursementLedgerVatableTransaction(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId);
     }
     else
     {
         returnValue = new AnticipatedDisbursementLedgerReturnValue();
         returnValue.Success = false;
         returnValue.Message = "Invalid Token";
     }
     return returnValue;
 }