public List <ReconciliationEgmTotals> GetWorkflowJobs()
        {
            // get workflows
            WorkflowService workflowService = new WorkflowService();
            List <Workflow> workflows       = workflowService.ListWorkflows();

            var HomeRIDs = workflows.AsEnumerable()
                           .Select(w => w.RefObjRID).Distinct().ToList();

            // get sapphire egm totals by HomeRIDs
            var sapphireEgmJobTotals = GetCompanyByJobNumber(GetSapphireEgmJobTotals(HomeRIDs));

            if (!(sapphireEgmJobTotals is null) && sapphireEgmJobTotals.AsEnumerable().Any())
            {
                // Get pervasive egm totals by Job
                PurchaseOrderHeaderRepository purchaseOrderHeaderRepository = new PurchaseOrderHeaderRepository();
                DataTable pervasiveEgmJobTotals = purchaseOrderHeaderRepository.GetPervasiveRecords("JobCstActs_EGM");

                if (!(pervasiveEgmJobTotals is null) && pervasiveEgmJobTotals.AsEnumerable().Any())
                {
                    var egmJobTotalsAudit = AuditEgmJobTotals(sapphireEgmJobTotals, pervasiveEgmJobTotals);
                    return(egmJobTotalsAudit.ToList());
                }
            }
            return(null);
        }
        public ReconciliationEgmTotals GetEgmAmounts(string jobNumber)
        {
            SapphireRepository sapphireRepository   = new SapphireRepository();
            DataTable          sapphireEgmJobTotals = sapphireRepository.GetSapphireRecords("JobCstActs_EGM", jobNumber);

            if (!(sapphireEgmJobTotals is null))
            {
                // Get pervasive egm totals by Job
                PurchaseOrderHeaderRepository purchaseOrderHeaderRepository = new PurchaseOrderHeaderRepository();
                DataTable pervasiveEgmJobTotals = purchaseOrderHeaderRepository.GetPervasiveRecords("JobCstActs_EGM", jobNumber);

                if (!(pervasiveEgmJobTotals is null) && pervasiveEgmJobTotals.AsEnumerable().Any())
                {
                    var egmJobTotalsAudit = AuditEgmJobTotals(sapphireEgmJobTotals, pervasiveEgmJobTotals);

                    ReconciliationEgmTotals egmTotals = new ReconciliationEgmTotals();
                    egmTotals.JobNumber            = jobNumber;
                    egmTotals.SapphireEgmTotal     = Convert.ToDecimal(egmJobTotalsAudit.ToList()[0].SapphireEgmTotal);
                    egmTotals.PervasiveEgmTotal    = Convert.ToDecimal(egmJobTotalsAudit.ToList()[0].PervasiveEgmTotal);
                    egmTotals.EstimateApprovalDate = egmJobTotalsAudit.ToList()[0].EstimateApprovalDate;

                    return(egmTotals);
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        public async Task Insert_GivenNewPurchaseOrderHeaderModel_ReturnsModelWithId()
        {
            var context = this.BuildContext();
            var repo    = new PurchaseOrderHeaderRepository(context);

            PurchaseOrderHeaderModel[] result = (await repo.Insert(new PurchaseOrderHeaderModel())).ToArray();

            Assert.NotNull(result);
            Assert.Single(result);
            Assert.Equal(1, result[0].PurchaseOrderId);
        }
Exemplo n.º 4
0
        public async Task TestProfileMapping(TestCase <PurchaseOrderHeaderModel> testCase)
        {
            var context = this.BuildContext(new[] { (PurchaseOrderHeader)testCase.Data });
            var repo    = new PurchaseOrderHeaderRepository(context);

            var testResult = await repo.FindAsync(1);

            Assert.NotNull(testResult);
            Assert.Equal(testResult.PurchaseOrderId, testCase.Expected.PurchaseOrderId);
            Assert.Equal(testResult.RevisionNumber, testCase.Expected.RevisionNumber);
            Assert.Equal(testResult.Status, testCase.Expected.Status);
            Assert.Equal(testResult.EmployeeId, testCase.Expected.EmployeeId);
            Assert.Equal(testResult.VendorId, testCase.Expected.VendorId);
            Assert.Equal(testResult.ShipMethodId, testCase.Expected.ShipMethodId);
            Assert.Equal(testResult.OrderDate, testCase.Expected.OrderDate);
            Assert.Equal(testResult.ShipDate, testCase.Expected.ShipDate);
            Assert.Equal(testResult.SubTotal, testCase.Expected.SubTotal);
            Assert.Equal(testResult.TaxAmt, testCase.Expected.TaxAmt);
            Assert.Equal(testResult.Freight, testCase.Expected.Freight);
            Assert.Equal(testResult.TotalDue, testCase.Expected.TotalDue);
            Assert.Equal(testResult.VendorDisplayName, testCase.Expected.VendorDisplayName);
            Assert.Equal(testResult.ShipMethodDisplayName, testCase.Expected.ShipMethodDisplayName);
        }
 public PurchasingService(AdventureWorksContext context)
 {
     this._repo = new PurchaseOrderHeaderRepository(context);
 }