コード例 #1
0
        public void TestFileHeaderReplace()
        {
            string fileName           = TAppSettingsManager.GetValue("Server.PathTemp") + Path.DirectorySeparatorChar + "TestGenHOSAFileHeaderReplace.csv";
            int    PeriodNumber       = 4;
            string StandardCostCentre = "4300";
            string CostCentre         = "78";
            string Currency           = "USD";

            StreamWriter sw = new StreamWriter(fileName);

            sw.WriteLine("/** Header **,4,4300,78,18/01/2013,USD");
            sw.Close();

            TVerificationResultCollection VerificationResults = new TVerificationResultCollection();

            string TableForExportHeader = "/** Header **" + "," +
                                          PeriodNumber.ToString() + "," +
                                          StandardCostCentre + "," +
                                          CostCentre + "," +
                                          DateTime.Today.ToShortDateString() + "," +
                                          Currency;

            TGenHOSAFilesReportsWebConnector.ReplaceHeaderInFile(fileName, TableForExportHeader, ref VerificationResults);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResults,
                                                                                "Header Replacement in File Failed!");

            File.Delete(fileName);
        }
コード例 #2
0
        public void TestGenerateHOSAFiles()
        {
            int    LedgerNumber   = FLedgerNumber;
            int    PeriodNumber   = 4;
            int    IchNumber      = 1;
            string CostCentre     = "73";
            String CurrencySelect = MFinanceConstants.CURRENCY_BASE;
            string FileName       = TAppSettingsManager.GetValue("Server.PathTemp") + Path.DirectorySeparatorChar + "TestGenHOSAFile.csv";
            TVerificationResultCollection VerificationResults;

            TGenHOSAFilesReportsWebConnector.GenerateHOSAFiles(LedgerNumber,
                                                               PeriodNumber,
                                                               IchNumber,
                                                               CostCentre,
                                                               CurrencySelect,
                                                               FileName,
                                                               out VerificationResults);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResults,
                                                                                "HOSA File Generation Failed!");

            Assert.IsTrue(File.Exists(FileName),
                          "HOSA File did not create!");

            File.Delete(FileName);
        }
コード例 #3
0
        public void TestGenerateHOSAReports()
        {
            int    LedgerNumber = FLedgerNumber;
            int    PeriodNumber = 4;
            int    IchNumber    = 1;
            string Currency     = "USD";
            TVerificationResultCollection VerificationResults;

            TGenHOSAFilesReportsWebConnector.GenerateHOSAReports(LedgerNumber, PeriodNumber, IchNumber, Currency, out VerificationResults);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResults,
                                                                                "Performing HOSA Report Generation Failed!");
        }
コード例 #4
0
        public void TestExportGifts()
        {
            int       LedgerNumber    = FLedgerNumber;
            string    CostCentre      = "7300";
            string    AcctCode        = "0200";
            string    MonthName       = "January";
            int       PeriodNumber    = 1;
            DateTime  PeriodStartDate = new DateTime(DateTime.Today.Year, 1, 1);
            DateTime  PeriodEndDate   = new DateTime(DateTime.Today.Year, 1, 31);
            string    Base            = MFinanceConstants.CURRENCY_BASE;
            int       IchNumber       = 0;
            DataTable TableForExport  = new DataTable();

            bool NewTransaction = false;

            // otherwise period 1 might have been closed already
            CommonNUnitFunctions.ResetDatabase();

            // need to create gifts first
            TStewardshipCalculationTest.ImportAndPostGiftBatch(PeriodEndDate);

            //Perform stewardship calculation
            TVerificationResultCollection VerificationResults;

            TStewardshipCalculationWebConnector.PerformStewardshipCalculation(FLedgerNumber,
                                                                              PeriodNumber, out VerificationResults);

            VerificationResults = new TVerificationResultCollection();

            //Create DataTable to receive exported transactions
            TableForExport.Columns.Add("CostCentre", typeof(string));
            TableForExport.Columns.Add("Account", typeof(string));
            TableForExport.Columns.Add("LedgerMonth", typeof(string));
            TableForExport.Columns.Add("ICHPeriod", typeof(string));
            TableForExport.Columns.Add("Date", typeof(DateTime));
            TableForExport.Columns.Add("IndividualDebitTotal", typeof(decimal));
            TableForExport.Columns.Add("IndividualCreditTotal", typeof(decimal));

            TGenHOSAFilesReportsWebConnector.ExportGifts(LedgerNumber,
                                                         CostCentre,
                                                         AcctCode,
                                                         MonthName,
                                                         PeriodNumber,
                                                         PeriodStartDate,
                                                         PeriodEndDate,
                                                         Base,
                                                         IchNumber,
                                                         TableForExport,
                                                         VerificationResults);

            TableForExport.AcceptChanges();

            DataRow[] DR = TableForExport.Select();

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResults,
                                                                                "HOSA - Performing Export of gifts Failed!");

            Assert.IsTrue((DR.Length > 0),
                          "HOSA - Performing Export of gifts Failed to return any rows!");

            if (NewTransaction)
            {
                DBAccess.GDBAccessObj.RollbackTransaction();
            }
        }