Ejemplo n.º 1
0
        public ActionResult Payments(FormCollection form)
        {
            int churchID = Convert.ToInt32(form["churchID"]);

            //SELECT TOP 50 stat.PaymentStatusName, pay.HouseholdID, pay.IndividualID, pay.Amount, rea.ReasonCode, rea.Description FROM Payment pay WITH (NOLOCK)
            //INNER JOIN ProviderRequest req WITH (NOLOCK)
            //ON pay.PaymentID = req.PaymentID
            //INNER JOIN PaymentReason rea WITH (NOLOCK)
            //ON rea.PaymentReasonID = req.PaymentReasonID
            //INNER JOIN PaymentStatus stat WITH (NOLOCK)
            //ON pay.PaymentStatusID = stat.PaymentStatusID
            //WHERE pay.ChurchID = 15 ORDER BY pay.CreatedDate DESC

            var dataContext = new PaymentsDataContext(Common.FetchDBConnectionString(form["dataSource"]));
            var payments    = from pay in dataContext.Payments.Where(c => c.ChurchID == churchID).OrderByDescending(c => c.CreatedDate).Take(20)
                              join req in dataContext.ProviderRequests on pay.PaymentID equals req.PaymentID
                              join rea in dataContext.PaymentReasons on req.PaymentReasonID equals rea.PaymentReasonID// into payData
                              join stat in dataContext.PaymentStatus on pay.PaymentStatusID equals stat.PaymentStatusID into payData
                              from final in payData
                              select new QAUtil.Models.Payments {
                CreatedDate       = pay.CreatedDate.ToString(),
                PaymentStatusName = final.PaymentStatusName,
                HouseholdID       = pay.HouseholdID,
                IndividualID      = pay.IndividualID,
                Amount            = string.Format("{0:c}", pay.Amount),
                ReasonCode        = rea.ReasonCode,
                Description       = rea.Description,
                ClientApplication = pay.ClientApplication
            };

            return(View(payments));
        }
Ejemplo n.º 2
0
        public TestRepository()
        {
            var applicationSettings = TestConfiguration.TestApplicationSettings;

            if (string.IsNullOrWhiteSpace(applicationSettings.MatchedLearnerConnectionString))
            {
                throw new InvalidOperationException("MatchedLearnerAcceptanceTestConnectionString is null");
            }

            var matchedLearnerOptions = new DbContextOptionsBuilder()
                                        .UseSqlServer(applicationSettings.MatchedLearnerConnectionString)
                                        .Options;

            _matchedLearnerDataContext = new MatchedLearnerDataContext(matchedLearnerOptions);

            if (string.IsNullOrWhiteSpace(applicationSettings.PaymentsConnectionString))
            {
                throw new InvalidOperationException("PaymentsAcceptanceTestConnectionString is null");
            }

            var paymentsOptions = new DbContextOptionsBuilder()
                                  .UseSqlServer(applicationSettings.PaymentsConnectionString)
                                  .Options;

            _paymentsDataContext = new PaymentsDataContext(paymentsOptions);
        }
        public void SetUp()
        {
            mocker = AutoMock.GetLoose();
            mocker.Mock <IPaymentLogger>();

            accountApiWrapper = mocker.Mock <IDasLevyAccountApiWrapper>();

            telemetry = mocker.Mock <ITelemetry>();

            var levyAccountsValidator         = new LevyAccountValidator(telemetry.Object);
            var combinedLevyAccountsValidator = new CombinedLevyAccountValidator(telemetry.Object, levyAccountsValidator);

            var contextBuilder = new DbContextOptionsBuilder <PaymentsDataContext>()
                                 .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                 .Options;

            paymentsDataContext = new PaymentsDataContext(contextBuilder);
            paymentsDataContext.LevyAccount.AddRange(levyAccountBuilder.Build(1));
            paymentsDataContext.SaveChanges();

            sut = mocker.Create <LevyAccountValidationService>(
                new NamedParameter("validator", combinedLevyAccountsValidator),
                new NamedParameter("paymentsDataContext", paymentsDataContext));
        }
Ejemplo n.º 4
0
 public PaymentsRepository(PaymentsDataContext paymentsDataContext)
 {
     _paymentsDataContext = paymentsDataContext ?? throw new ArgumentNullException(nameof(paymentsDataContext));
 }