예제 #1
0
        /// <summary>
        /// Displays Reservation Details to Student
        /// </summary>
        /// <param name="ID">Reservation ID</param>
        /// <returns>ActionResult</returns>
        public ActionResult Reservation(int ID)
        {
            tblReservation Reservation = _ODB.tblReservations.Where(e => e.ID == ID).SingleOrDefault();

            if (Reservation.tblInvitation.ENumber == Current.User.ENumber || Current.User.IsAdmin || Current.User.IsStaff)
            {
                ViewBag.MaxNumberGuests = Reservation.tblEventDate.MaxNumberGuests;
                Logging.Log(Logging.LogType.Audit, string.Format("User {1} with ENumber {0} is viewing Student Reservation with ID {2} for event '{3}'", Current.User.ENumber, Current.User.Username, ID, Reservation.tblInvitation.tblEvent.Name));
                BannerDB Banner     = new BannerDB();
                bool     IsBannerUp = Banner.Ping();
                if (IsBannerUp)
                {
                    ViewBag.IsBannerUp = IsBannerUp;
                    ViewBag.HasSelectiveServiceHold = Banner.HasSelectiveServiceHold(Reservation.tblInvitation.ENumber);
                    ViewBag.MustVerifyCitizenship   = Banner.MustVerifyCitizenship(Reservation.tblInvitation.ENumber);
                    ViewBag.FinAidRequirements      = Banner.GetFinAidChecklistRequirements(Reservation.tblInvitation.ENumber);
                    ViewBag.FAFSAAidYear            = Banner.GetFAFSAAidYear(Reservation.tblInvitation.ENumber);
                    ViewBag.ImmunizationList        = Banner.GetImmunizationsChecklist(Reservation.tblInvitation.ENumber);
                    List <TestScore> TestScores = Banner.GetTestScores(Reservation.tblInvitation.ENumber).AsEnumerable().Select(e => new TestScore(e)).ToList();
                    TestScore        DSPR       = TestScores.Where(e => e.Code == "DSPR").OrderByDescending(e => e.Date).FirstOrDefault();
                    TestScore        DSPW       = TestScores.Where(e => e.Code == "DSPW").OrderByDescending(e => e.Date).FirstOrDefault();
                    TestScore        DSPM       = TestScores.Where(e => e.Code == "DSPM").OrderByDescending(e => e.Date).FirstOrDefault();
                    if (DSPR == null || DSPW == null || DSPM == null || DSPR.Score.Trim() != "4" || DSPW.Score.Trim() != "4" || DSPM.Score.Trim() != "4")
                    {
                        ViewBag.HasLearningSupportRequirements = true;
                    }
                    else
                    {
                        ViewBag.HasLearningSupportRequirements = false;
                    }
                }
                return(View(Reservation));
            }
            else
            {
                this.ShowPageError("You do not have permission to access that Reservation");
                return(this.RedirectToAction <StudentController>(c => c.Index()));
            }
        }
예제 #2
0
        /// <summary>
        /// Confirms selected reservation if no payments are due
        /// </summary>
        /// <param name="ID">Reservation ID</param>
        /// <returns>ActionResult</returns>
        public ActionResult ConfirmReservation(int ID)
        {
            tblReservation Reservation = _ODB.tblReservations.Where(e => e.ID == ID).SingleOrDefault();

            if (Reservation != null)
            {
                bool HasExistingPayments = Reservation.tblPayments.Where(e => e.Amount > 0).Count() > 0;
                bool IsStudentPayment    = Reservation.tblInvitation.ENumber == Current.User.ENumber;
                if (Reservation.tblInvitation.ENumber == Current.User.ENumber || Current.User.IsAdmin || Current.User.IsStaff)
                {
                    if (Reservation.CurrentAmountDue <= 0)
                    {
                        if (Reservation.tblEventDate.HasOpenSlots)
                        {
                            Reservation.IsConfirmed   = true;                              // mark reservation as confirmed
                            Reservation.DateConfirmed = DateTime.Now;
                            Reservation.tblGuests.ToList().ForEach(e => e.HasPaid = true); // mark current guests as paid
                            _ODB.SaveChanges();

                            if (Reservation.tblEventDate.AutomaticallyClearSOHolds)
                            {
                                BannerDB Banner = new BannerDB();
                                if (Banner.Ping())
                                {
                                    Banner.ReleaseHold(Reservation.tblInvitation.ENumber, DataConstants.HoldTypes.StudentOrientation);
                                    Logging.Log(Logging.LogType.Audit, string.Format("User {0} Released Hold Code '{1}' for Student {2}", Current.User.Username, DataConstants.HoldTypes.StudentOrientation, Reservation.tblInvitation.ENumber));
                                }
                                else
                                {
                                    Logging.Log(Logging.LogType.Audit, String.Format("Could not connect to Banner to release SO Hold for student {0} for Reservation {1}", Reservation.tblInvitation.ENumber, Reservation.ID), "Holds", Logging.Severity.Warning);
                                }
                            }

                            if (Reservation.tblEventDate.UpdateSGBSTDN_ORSN)
                            {
                                try {
                                    (new BannerDB()).UpdateSGBSTDN_ORSN_Code(Reservation.tblInvitation.ENumber, Reservation.tblEventDate.EventDateType);
                                    Logging.Log(Logging.LogType.Audit, string.Format("Successfully updated SGBSTDN ORSN code '{0}' for Reservation ID {1}. Student E-Number {2}", Reservation.tblEventDate.EventDateType, Reservation.ID, Reservation.tblInvitation.ENumber));
                                }
                                catch (Exception ex) {
                                    Logging.LogException(Logging.LogType.Audit, string.Format("StudentController->ConfirmReservation(): An exception occurred while trying to update SGBSTDN ORSN code '{0}' for Reservation ID {1}. Student E-Number {2}", Reservation.tblEventDate.EventDateType, Reservation.ID, Reservation.tblInvitation.ENumber), ex);
                                }
                            }

                            // try to insert row for IDCard Extract
                            try {
                                (new BannerDB()).INSERT_IDCARD_FLAG(Reservation.tblInvitation.Pidm, Reservation.tblInvitation.tblEvent.Term, "Y");
                                Logging.Log(Logging.LogType.Audit, string.Format("Successfully inserted IDCard Extract Flag for Reservation ID {0}. Student E-Number {1}", Reservation.ID, Reservation.tblInvitation.ENumber));
                            }
                            catch (Exception ex) {
                                Logging.LogException(Logging.LogType.Audit, string.Format("StudentController->ConfirmReservation(): An exception occurred while trying to insert IDCard Extract Flag for Reservation ID {0}. Student E-Number {1}", Reservation.ID, Reservation.tblInvitation.ENumber), ex);
                            }

                            this.ShowPageMessage("Your Reservation has been confirmed");
                        }
                        else
                        {
                            this.ShowPageError(string.Format("The selected event date '{0}' no longer has an open slot for event '{1}'. Please select another event date.", Reservation.tblEventDate.DateOfEvent.ToShortDateString(), Reservation.tblEventDate.tblEvent.Name));
                        }
                    }
                    else
                    {
                        this.ShowPageError(String.Format("You must pay fees due before confirming registration. The Current Amount Due is {0}", Reservation.CurrentAmountDue));
                    }

                    return(this.RedirectToAction <StudentController>(c => c.Reservation(ID)));
                }
                else
                {
                    this.ShowPageError("You are not authorized to confirm this Reservation");
                }
            }
            else
            {
                this.ShowPageError("Could not find a reservation for the given ID");
            }

            return(this.RedirectToAction <StudentController>(c => c.Index()));
        }