// To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(int?id, int?OrderStatus, bool?PracticeTestBooked, bool?PracticeMaterialsSent)
        {
            if (id != null)
            {
                IELTSOrder = await _context.IELTSOrder
                             .FirstOrDefaultAsync(m => m.BarclaysPaymentID == id);
            }

            if (OrderStatus != null)
            {
                IELTSOrder.OrderStatusID = OrderStatus;
            }

            if (PracticeTestBooked != null)
            {
                IELTSOrder.PracticeTestBooked = (bool)PracticeTestBooked;
            }

            if (PracticeMaterialsSent != null)
            {
                IELTSOrder.PracticeMaterialsSent = (bool)PracticeMaterialsSent;
            }

            ModelState.Remove("IELTSOrder.IELTSTestDate");

            //if (!ModelState.IsValid)
            //{
            //    return Page();
            //}

            _context.Attach(IELTSOrder).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IELTSOrderExists(IELTSOrder.IELTSOrderID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            IELTSOrder = await _context.IELTSOrder.FindAsync(id);

            if (IELTSOrder != null)
            {
                _context.IELTSOrder.Remove(IELTSOrder);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            IELTSOrder = await _context.IELTSOrder
                         .Include(i => i.BarclaysPayment)
                         .Include(i => i.OrderStatus).FirstOrDefaultAsync(m => m.IELTSOrderID == id);

            if (IELTSOrder == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(int?id, int?OrderStatus, bool?PracticeTestBooked, bool?PracticeMaterialsSent)
        {
            if (id == null)
            {
                return(NotFound());
            }

            IELTSOrder = await _context.IELTSOrder
                         .Include(i => i.BarclaysPayment)
                         .Include(i => i.OrderStatus)
                         //.FirstOrDefaultAsync(m => m.IELTSOrderID == id);
                         .FirstOrDefaultAsync(m => m.BarclaysPaymentID == id);

            if (OrderStatus != null)
            {
                IELTSOrder.OrderStatusID = OrderStatus;
            }

            if (PracticeTestBooked != null)
            {
                IELTSOrder.PracticeTestBooked = (bool)PracticeTestBooked;
            }

            if (PracticeMaterialsSent != null)
            {
                IELTSOrder.PracticeMaterialsSent = (bool)PracticeMaterialsSent;
            }

            if (IELTSOrder == null)
            {
                return(NotFound());
            }
            ViewData["BarclaysPaymentID"] = new SelectList(_context.BarclaysPayment, "BarclaysPaymentID", "CN");
            ViewData["OrderStatusID"]     = new SelectList(_context.OrderStatus, "OrderStatusID", "OrderStatusID");
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(
            string ielts,
            string TestType,
            string reffname,
            string refsname,
            string ref1,
            string ref2,
            string confirmref1,
            string confirmref2,
            string email,
            string email2,
            decimal tpymt,
            DateTime TestDate,
            string dep,
            bool mockexam1,
            bool refbooks,
            bool DuplicateCertificate,
            bool TransferFees,
            bool EnquiryOnResult,
            int formId,
            string oid
            )
        {
            FormSubmitted = false;

            SHAPassphrase = _configuration.GetSection("SystemSettings")["SHAPassphrase"];
            string paymentSystem = _configuration.GetSection("SystemSettings")["PaymentSystem"];

            string paymentURL = null;

            if (paymentSystem == "LIVE")
            {
                FormDestinationID = _configuration.GetSection("SystemSettings")["PaymentURLLive"];
            }
            else
            {
                FormDestinationID = _configuration.GetSection("SystemSettings")["PaymentURLTest"];
            }

            string userID = "IELTS";

            if (User.Identity.Name != null)
            {
                userID = User.Identity.Name.Split('\\').Last();
            }

            BarclaysPayment = new BarclaysPayment
            {
                UniquePaymentRef = Guid.NewGuid(),
                PaymentURL       = paymentURL,
                PSPID            = _configuration.GetSection("SystemSettings")["PSPID"],
                ORDERID          = oid,
                PaymentReasonID  = "IELTS",
                AMOUNT           = tpymt,
                CURRENCY         = _configuration.GetSection("SystemSettings")["Currency"],
                LANGUAGE         = "en_GB",
                CN    = reffname + " " + refsname,
                EMAIL = email,
                //OWNERZIP = "W14 9BL",
                //OWNERADDRESS = "West London College",
                //OWNERCTY = "Hammersmith",
                //OWNERTOWN = "London",
                //OWNERTELNO = "07712345678",
                SHASIGN        = "",
                TITLE          = _configuration.GetSection("SystemSettings")["BarclaysTitle"],
                BGCOLOR        = "",
                TXTCOLOR       = "",
                TBLBGCOLOR     = "",
                TBLTXTCOLOR    = "",
                BUTTONBGCOLOR  = "",
                BUTTONTXTCOLOR = "",
                LOGO           = "https://apps.wlc.ac.uk/BarclaysPayments/images/CollegeLogo.png",
                FONTTYPE       = "",
                ACCEPTURL      = "https://www.wlc.ac.uk",
                DECLINEURL     = "https://www.wlc.ac.uk",
                EXCEPTIONURL   = "https://www.wlc.ac.uk",
                CANCELURL      = "https://www.wlc.ac.uk",
                CreatedDate    = DateTime.Now,
                CreatedBy      = userID
            };

            _context.BarclaysPayment.Add(BarclaysPayment);
            await _context.SaveChangesAsync();

            IELTSOrder = new IELTSOrder
            {
                BarclaysPaymentID = BarclaysPayment.BarclaysPaymentID,
                IELTSTestDate     = TestDate,
                TestType          = TestType,
                OrderStatusID     = 1 //To-Do
            };

            if (ielts == "ieltsexam")
            {
                IELTSTestAmount = await _context.IELTSPrice
                                  .Where(p => p.Code == "ieltsexam")
                                  .FirstOrDefaultAsync();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }
            else if (ielts == "ieltsexam2")
            {
                IELTSTestAmount = await _context.IELTSPrice
                                  .Where(p => p.Code == "ieltsexam2")
                                  .FirstOrDefaultAsync();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }
            else if (ielts == "ieltsexam3")
            {
                IELTSTestAmount = await _context.IELTSPrice
                                  .Where(p => p.Code == "ieltsexam3")
                                  .FirstOrDefaultAsync();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }
            else if (ielts == "ieltsexamTFL")
            {
                IELTSTestAmount = await _context.IELTSPrice
                                  .Where(p => p.Code == "ieltsexamTFL")
                                  .FirstOrDefaultAsync();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }

            if (mockexam1 == true)
            {
                PracticeTestAmount = await _context.IELTSPrice
                                     .Where(p => p.Code == "mockexam1")
                                     .FirstOrDefaultAsync();

                IELTSOrder.PracticeTestAmount = PracticeTestAmount.Price;
                PracticeTestAmountValue       = PracticeTestAmount.Price;
            }

            if (mockexam1 == true)
            {
                PracticeMaterialsAmount = await _context.IELTSPrice
                                          .Where(p => p.Code == "refbooks")
                                          .FirstOrDefaultAsync();

                IELTSOrder.PracticeMaterialsAmount = PracticeMaterialsAmount.Price;
                PracticeMaterialsAmountValue       = PracticeMaterialsAmount.Price;
            }

            _context.IELTSOrder.Add(IELTSOrder);
            await _context.SaveChangesAsync();

            PracticeTestDate = TestDate;

            UniquePaymentRef = BarclaysPayment.UniquePaymentRef;

            //Update Payment Reference
            BarclaysPayment.ORDERID = IELTSOrder.IELTSOrderID + "-" + IELTSOrder.TestType + "-" + BarclaysPayment.ORDERID;
            await _context.SaveChangesAsync();

            return(Page());
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(
            BarclaysPayment model,
            string ielts,
            DateTime TestDate,
            string TestType,
            bool mockexam1,
            bool ieltsexam,
            bool ieltsexam2
            )
        {
            FormSubmitted = true;
            FormSaved     = true;

            //if (!ModelState.IsValid)
            //{
            //    FormSaved = false;
            //    FormErrors = string.Join("; ", ModelState.Values
            //                            .SelectMany(x => x.Errors)
            //                            .Select(x => x.ErrorMessage));
            //}

            string userID = "IELTS";

            if (User.Identity.Name != null)
            {
                userID = User.Identity.Name.Split('\\').Last();
            }

            BarclaysPayment.UniquePaymentRef = Guid.NewGuid();
            BarclaysPayment.PSPID            = _configuration.GetSection("SystemSettings")["PSPID"];
            BarclaysPayment.CURRENCY         = _configuration.GetSection("SystemSettings")["Currency"];
            BarclaysPayment.LANGUAGE         = "en_GB";
            BarclaysPayment.TITLE            = _configuration.GetSection("SystemSettings")["BarclaysTitle"];
            BarclaysPayment.BGCOLOR          = "";
            BarclaysPayment.TXTCOLOR         = "";
            BarclaysPayment.TBLBGCOLOR       = "";
            BarclaysPayment.TBLTXTCOLOR      = "";
            BarclaysPayment.BUTTONBGCOLOR    = "";
            BarclaysPayment.BUTTONTXTCOLOR   = "";
            BarclaysPayment.LOGO             = "https://apps.wlc.ac.uk/BarclaysPayments/images/CollegeLogo.png";
            BarclaysPayment.FONTTYPE         = "";
            BarclaysPayment.ACCEPTURL        = "https://www.wlc.ac.uk";
            BarclaysPayment.DECLINEURL       = "https://www.wlc.ac.uk";
            BarclaysPayment.EXCEPTIONURL     = "https://www.wlc.ac.uk";
            BarclaysPayment.CANCELURL        = "https://www.wlc.ac.uk";
            BarclaysPayment.CreatedDate      = DateTime.Now;
            //BarclaysPayment.CreatedBy = User.Identity.Name.Split('\\').Last();
            BarclaysPayment.CreatedBy = userID;

            _context.BarclaysPayment.Add(BarclaysPayment);
            await _context.SaveChangesAsync();



            IELTSOrder = new IELTSOrder
            {
                BarclaysPaymentID = BarclaysPayment.BarclaysPaymentID,
                IELTSTestDate     = TestDate,
                TestType          = TestType
            };

            if (ielts == "ieltsexam" || ieltsexam == true)
            {
                IELTSTestAmount = IELTSPrice
                                  .Where(p => p.Code == "ieltsexam")
                                  .FirstOrDefault();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }
            else if (ielts == "ieltsexam2" || ieltsexam2 == true)
            {
                IELTSTestAmount = IELTSPrice
                                  .Where(p => p.Code == "ieltsexam2")
                                  .FirstOrDefault();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }
            else if (ielts == "ieltsexamTFL")
            {
                IELTSTestAmount = IELTSPrice
                                  .Where(p => p.Code == "ieltsexamTFL")
                                  .FirstOrDefault();

                IELTSOrder.IELTSTestAmount = IELTSTestAmount.Price;
                IELTSTestAmountValue       = IELTSTestAmount.Price;
            }

            if (mockexam1 == true)
            {
                PracticeTestAmount = IELTSPrice
                                     .Where(p => p.Code == "mockexam1")
                                     .FirstOrDefault();

                IELTSOrder.PracticeTestAmount = PracticeTestAmount.Price;
                PracticeTestAmountValue       = PracticeTestAmount.Price;
            }

            if (mockexam1 == true)
            {
                PracticeMaterialsAmount = IELTSPrice
                                          .Where(p => p.Code == "refbooks")
                                          .FirstOrDefault();

                IELTSOrder.PracticeMaterialsAmount = PracticeMaterialsAmount.Price;
                PracticeMaterialsAmountValue       = PracticeMaterialsAmount.Price;
            }

            _context.IELTSOrder.Add(IELTSOrder);
            await _context.SaveChangesAsync();

            PracticeTestDate = TestDate;

            UniquePaymentRef = BarclaysPayment.UniquePaymentRef;

            //Update Payment Reference
            BarclaysPayment.ORDERID = IELTSOrder.IELTSOrderID + "-" + IELTSOrder.TestType + "-" + BarclaysPayment.ORDERID;

            return(Page());
        }