예제 #1
0
        protected void SetupReferenceData()
        {
            foreach (var employer in StepDefinitionsContext.ReferenceDataContext.Employers)
            {
                AccountDataHelper.CreateAccount(employer.AccountId, employer.AccountId.ToString(), 0.00m, EnvironmentVariables);
            }

            AccountDataHelper.UpdateAudit(EnvironmentVariables);

            foreach (var provider in StepDefinitionsContext.Providers)
            {
                foreach (var learner in provider.Learners)
                {
                    AddLearnerCommitment(provider.Ukprn, learner, provider.Name);
                }
            }

            CommitmentDataHelper.UpdateEventStreamPointer(EnvironmentVariables);
        }
예제 #2
0
        protected void SetupPeriodReferenceData(DateTime date)
        {
            AccountDataHelper.ClearAccounts(EnvironmentVariables);
            CommitmentDataHelper.ClearCommitments(EnvironmentVariables);

            var period = date.GetPeriod();

            if (StepDefinitionsContext.DasScenario)
            {
                foreach (var employer in StepDefinitionsContext.ReferenceDataContext.Employers)
                {
                    AccountDataHelper.CreateAccount(
                        employer.AccountId,
                        employer.AccountId.ToString(),
                        employer.GetBalanceForMonth(period),
                        EnvironmentVariables);
                }

                AccountDataHelper.UpdateAudit(EnvironmentVariables);
            }

            foreach (var provider in StepDefinitionsContext.Providers)
            {
                foreach (var learner in provider.Learners)
                {
                    if (learner.LearningDelivery.LearnerType == LearnerType.ProgrammeOnlyNonDas)
                    {
                        continue;
                    }

                    AddLearnerCommitmentsForPeriod(date, provider.Ukprn, learner, provider.Name);
                }
            }

            CommitmentDataHelper.UpdateEventStreamPointer(EnvironmentVariables);
        }
예제 #3
0
        private void SetupCommitments(Table table)
        {
            StepDefinitionsContext.ReferenceDataContext.SetDefaultEmployer(
                new Dictionary <string, decimal>
            {
                { "All", int.MaxValue }
            });

            var employer = StepDefinitionsContext.ReferenceDataContext.Employers[0];

            AccountDataHelper.CreateAccount(employer.AccountId, employer.AccountId.ToString(), 0.00m, EnvironmentVariables);

            foreach (var row in table.Rows)
            {
                var ukprn     = long.Parse(row["UKPRN"]);
                var startDate = DateTime.Parse(row["start date"]);


                var frameworkCode = table.Header.Contains("framework code")
                    ? int.Parse(row["framework code"])
                    : IlrBuilder.Defaults.FrameworkCode;
                var programmeType = table.Header.Contains("programme type")
                    ? int.Parse(row["programme type"])
                    : IlrBuilder.Defaults.ProgrammeType;
                var pathwayCode = table.Header.Contains("pathway code")
                    ? int.Parse(row["pathway code"])
                    : IlrBuilder.Defaults.PathwayCode;

                var standardCode = table.Header.Contains("standard code")
                    ? int.Parse(row["standard code"])
                    : IlrBuilder.Defaults.StandardCode;

                if (frameworkCode > 0 && programmeType > 0 && pathwayCode > 0)
                {
                    standardCode = 0;
                }

                var status = row.ContainsKey("status")
                    ? GetCommitmentStatusOrThrow(row["status"])
                    : CommitmentPaymentStatus.Active;

                StepDefinitionsContext.AddProvider("provider", ukprn);

                CommitmentDataHelper.CreateCommitment(
                    new CommitmentEntity
                {
                    CommitmentId             = long.Parse(IdentifierGenerator.GenerateIdentifier(6, false)),
                    Ukprn                    = ukprn,
                    Uln                      = long.Parse(row["ULN"]),
                    AccountId                = employer.AccountId.ToString(),
                    StartDate                = startDate,
                    EndDate                  = startDate.AddMonths(12),
                    AgreedCost               = decimal.Parse(row["agreed price"]),
                    StandardCode             = standardCode,
                    FrameworkCode            = frameworkCode,
                    ProgrammeType            = programmeType,
                    PathwayCode              = pathwayCode,
                    Priority                 = 1,
                    VersionId                = 1,
                    PaymentStatus            = (int)status,
                    PaymentStatusDescription = status.ToString(),
                    EffectiveFrom            = startDate
                },
                    EnvironmentVariables);
            }
        }