Exemplo n.º 1
0
        //
        // GET: /Register/Complete/RegUID
        public ActionResult Complete(string RegUID, FormCollection values)
        {
            if (RegUID == null)
            {
                ViewBag.Found = false;
                return View();
            }

            if (values.Count == 0)
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

                if (FoundRegID != 0)
                {
                    ViewBag.Found = true;
                    ViewBag.Scholarship = false;
                    ViewBag.TotalPrice = FoundEntry.RegTotalPrice(FoundRegID);
                    ViewBag.RegID = FoundRegID;
                    ViewBag.RegUID = RegUID;

                    return View();
                }
                else
                {
                    ViewBag.Found = false;
                    ViewBag.MessageEn = "Invalid Registration Key";
                    ViewBag.MessageCh = "没有找到登记";
                    return View();
                }
            }

            ViewBag.Found = false;
            return View();
        }
Exemplo n.º 2
0
        public ActionResult Complete(string RegUID, PaymentEntry values)
        {
            if (RegUID == null)
            {
                ViewBag.Found = false;
                return View();
            }

            RegistrationEntry FoundEntry = new RegistrationEntry();
            int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

            if (values.RegID == 0 && values.PaymentAmt == (decimal)0)
            {
                ViewBag.Found = true;
                ViewBag.Scholarship = true;
                ViewBag.TotalPrice = FoundEntry.RegTotalPrice(FoundRegID);
                ViewBag.RegID = FoundRegID;
                ViewBag.RegUID = RegUID;
                values.RegID = (int)FoundRegID;
                values.PaymentDate = DateTime.Now;
                values.PmtTypeID = (int)1;
                values.PmtStatusID = (int)1;

                return View(values);
            }

            if (values.RegID == FoundRegID && values.PaymentAmt <= (decimal)0)
            {
                ViewBag.Found = true;
                ViewBag.Scholarship = true;
                ViewBag.TotalPrice = FoundEntry.RegTotalPrice(FoundRegID);
                ViewBag.RegID = FoundRegID;
                ViewBag.RegUID = RegUID;
                ViewBag.MessageEn = "Please enter an Amount greater then 0";
                ViewBag.MessageCh = "请输入一个数目大于0";
                values.RegID = (int)FoundRegID;
                values.PaymentDate = DateTime.Now;
                values.PmtTypeID = (int)1;
                values.PmtStatusID = (int)1;

                return View(values);
            }

            if (values.RegID == FoundRegID && values.PaymentAmt > (decimal)0)
            {
                values.RegID = (int)FoundRegID;
                values.PaymentDate = DateTime.Now;
                values.PmtTypeID = (int)1;
                values.PmtStatusID = (int)1;

                _db.PaymentEntries.Add(values);
                _db.SaveChanges();

                EventHistory NewEvent = new EventHistory();
                NewEvent.AddHistory(values.RegID, "Scholarship Request Entered", values.PaymentID);

                return RedirectToAction("Modify", "Register", new { RegUID = RegUID });
            }

            ViewBag.Found = true;
            ViewBag.Scholarship = false;
            ViewBag.TotalPrice = FoundEntry.RegTotalPrice(FoundRegID);
            ViewBag.RegID = FoundRegID;

            return View();
        }
Exemplo n.º 3
0
        public ActionResult Create(PaymentEntry paymententry)
        {
            if (paymententry.RegID != 0)
            {

                RegistrationEntry RegLookup = new RegistrationEntry();

                RegLookup.RegistrationUID = RegLookup.RegIDtoUID(paymententry.RegID);

                if (RegLookup.RegistrationUID != null)
                {

                    if (paymententry.PmtStatusID == 0)
                    {
                        ViewBag.isEmpty = false;
                        ViewBag.RegID = paymententry.RegID;
                        ViewBag.RegAmtOwes = RegLookup.RegTotalPrice(paymententry.RegID);

                        paymententry.PaymentDate = DateTime.Now;
                        paymententry.PmtStatusID = (int)1;

                        //ViewBag.PmtStatusID = new SelectList(db.PmtStatuses, "PmtStatusID", "Name");
                        ViewBag.PmtTypeID = new SelectList(db.PmtTypes, "PmtTypeID", "Name");
                        return View(paymententry);
                    }

                    if (paymententry.PmtStatusID == 1 && paymententry.PmtTypeID == 0)
                    {
                        ViewBag.isEmpty = false;
                        ViewBag.RegID = paymententry.RegID;
                        ViewBag.RegAmtOwes = RegLookup.RegTotalPrice(paymententry.RegID);
                        ViewBag.Message = "Please select a payment type";

                        paymententry.PaymentDate = DateTime.Now;
                        paymententry.PmtStatusID = (int)1;

                        ViewBag.PmtTypeID = new SelectList(db.PmtTypes, "PmtTypeID", "Name");
                        return View(paymententry);
                    }

                    if (paymententry.PmtStatusID == 1 && paymententry.PaymentAmt <= (decimal)0)
                    {
                        ViewBag.isEmpty = false;
                        ViewBag.RegID = paymententry.RegID;
                        ViewBag.RegAmtOwes = RegLookup.RegTotalPrice(paymententry.RegID);
                        ViewBag.Message = "Payment Amount has to be greater then 0";

                        paymententry.PaymentDate = DateTime.Now;
                        paymententry.PmtStatusID = (int)1;

                        ViewBag.PmtTypeID = new SelectList(db.PmtTypes, "PmtTypeID", "Name", paymententry.PmtTypeID);
                        return View(paymententry);
                    }

                    if (paymententry.PmtStatusID == 1 && ModelState.IsValid)
                    {
                        db.PaymentEntries.Add(paymententry);
                        db.SaveChanges();

                        EventHistory NewEvent = new EventHistory();
                        NewEvent.AddHistory(paymententry.RegID, "Payment Entered", paymententry.PaymentID);

                        return RedirectToAction("Index");
                    }
                }
                else
                {
                    ViewBag.Message = "Registration ID not found";
                    ViewBag.isEmpty = true;
                    return View();
                }
            }

            ViewBag.Message = "Error";
            ViewBag.isEmpty = true;
            return View();
        }