コード例 #1
0
        public MemberPaymentViewModel CreatePaymentSummaryView(IEnumerable<InvoiceMaster> invoices, MemberPaymentViewModel viewModel)
        {
            foreach (InvoiceMaster invoice in invoices)
            {
                viewModel.Invoices.Add(_repo.GetInvoiceMasterById(invoice.IdInvoiceMaster));
            }

            viewModel.Member = _repo.GetMemberById(viewModel.IdMember);

            return viewModel;
        }
コード例 #2
0
        public void CreatePayment(IEnumerable<InvoiceMaster> invoices, MemberPaymentViewModel model, string user)
        {
            PaymentMaster payment = new PaymentMaster();
            PaymentDetail paymentDetail = new PaymentDetail();
            var member = _repo.GetMemberById(model.IdMember);

            payment.NumPayment = "1";
            payment.DatePayment = DateTime.Now;
            payment.IsPosted = true;

            payment.AmtPayment = model.AmtPayment;

            payment.NameAccount = model.NameAccount;
            payment.NumAccount = model.NumAccount;
            payment.MonthExpires = _repo.GetMonthById(model.IdMonth).MonthValue;
            payment.YearExpires = _repo.GetYearById(model.IdYear).YearValue;
            payment.NumICVerify = model.NumICVerify;
            payment.IsICVerify = model.IsICVerify;
            payment.NumCheck = model.NumCheck;
            payment.AccountNumber = model.AccountNumber;
            payment.RoutingNumber = model.RoutingNumber;
            payment.DateCreated = DateTime.Now;
            payment.DateModified = DateTime.Now;
            payment.CreatedByLogin = user;
            payment.ModifiedByLogin = user;
            payment.IdPaymentType = model.IdPaymentType;
            payment.IdMember = model.IdMember;
            payment.IdChartOfAccount = model.IdChartOfAccount;
            member.TotalAmountDue -= model.AmtPayment;

            paymentDetail.Invoices = invoices;

            foreach (InvoiceMaster invoice in invoices)
            {
                InvoiceMaster inv = _repo.GetInvoiceMasterById(invoice.IdInvoiceMaster);
                inv.State = false;

                _repo.Update(inv);
            }

            _repo.Add(payment);
            member.Payments.Add(payment);
            _repo.Update(member);
        }
コード例 #3
0
        public ActionResult Create(MemberPaymentViewModel paymentmaster)
        {
            var member = _repo.GetMemberById(paymentmaster.IdMember);
            member.TotalAmountDue -= paymentmaster.AmtPayment;
            //member.Payments.Add(paymentmaster);

            //paymentmaster.PaymentDetail.IdPaymentDetail = paymentmaster.IdPaymentMaster;

            if (ModelState.IsValid)
            {
                //_repo.Add(paymentmaster);
                _repo.Update(member);
                return RedirectToAction("Index");
            }

            ViewBag.IdMember = new SelectList(_repo.Members, "IdMember", "MemberNumber", paymentmaster.IdMember);
            ViewBag.IdPaymentType = new SelectList(_repo.PaymentTypes, "IdPaymentType", "NamePaymentType", paymentmaster.IdPaymentType);
            //ViewBag.IdChartOfAccount = new SelectList(_repo.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount", paymentmaster.IdChartOfAccount);
            return View(paymentmaster);
        }
コード例 #4
0
        public ActionResult PaymentProcess(MemberPaymentViewModel paymentView)
        {
            if (_service.ProcessPayment(paymentView))
            {
                _service.CreatePayment(paymentView.Invoices, paymentView, User.Identity.Name);

                return RedirectToAction("Index", "PaymentMaster");
            }
            return View(paymentView);
        }
コード例 #5
0
        public MemberPaymentViewModel CreatePaymentView(IEnumerable<InvoiceMaster> invoicesView, Member memberView)
        {
            double amount = 0;
            List<InvoiceMaster> invoices = new List<InvoiceMaster>();

            var member = _repo.GetMemberById(memberView.IdMember);

            foreach (InvoiceMaster invoice in invoicesView)
            {
                if (invoice.IsChecked == true)
                {
                    invoices.Add(_repo.GetInvoiceMasterById(invoice.IdInvoiceMaster));
                    amount += _repo.GetInvoiceMasterById(invoice.IdInvoiceMaster).InvoiceDetail.Price;
                }
            }

            MemberPaymentViewModel paymentModel = new MemberPaymentViewModel();

            paymentModel.IdMember = member.IdMember;
            paymentModel.Member = member;

            //Just added the Invoices property to the MemerPaymentViewModel so that each chosen Invoice can be modified later on in the payment process.
            paymentModel.Invoices = invoices;

            paymentModel.AmtPayment = amount;

            return paymentModel;
        }
コード例 #6
0
        public bool ProcessPayment(MemberPaymentViewModel viewModel)
        {
            //Code to process payment with merchant (i.e. Cybersource).

            return true;
        }