Пример #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();
        }
        //
        // GET: /Participant/HeadsetRequest/5?RegUID=xxx
        public ActionResult HeadsetRequest(string RegUID, int id = 0)
        {
            if (RegUID == null || id == 0)
            {
                ViewBag.Found = false;
                ViewBag.PartMessage = "Missing Necessary Parameters";
                return View();

            }
            else
            {
                var participantentry = from m in db.ParticipantEntries.Include(p => p.RegistrationEntries).
                    Include(p => p.Statuses).Include(p => p.Services).Include(p => p.AgeRanges).
                    Include(p => p.Genders).Include(p => p.RegTypes).Include(p => p.Fellowships).Include(p => p.RoomTypes).
                    Where(p => p.ParticipantID.Equals(id))
                                       select m;

                if (participantentry == null)
                {
                    ViewBag.Found = false;
                    ViewBag.PartMessage = "Participant not found";
                    return View();
                }
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int RegID = FoundEntry.RegUIDtoID(RegUID);

                if (RegID == 0)
                {
                    ViewBag.Found = false;
                    ViewBag.PartMessage = "Registration not found";
                    return View();
                }

                ParticipantEntry FoundPartEntry = new ParticipantEntry();
                FoundPartEntry = participantentry.FirstOrDefault();

                if (FoundPartEntry == null)
                {
                    return HttpNotFound();
                }

                if (FoundPartEntry.RegistrationID != RegID)
                {
                    ViewBag.Found = false;
                    ViewBag.PartMessage = "Participant not found";
                    return View();
                }

                ViewBag.Found = true;
                ViewBag.RegUID = RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ParticipantID = FoundPartEntry.ParticipantID;

                return View(FoundPartEntry);
            }
        }
        public ActionResult Create(RegistrationEntry registrationentry)
        {
            if (ModelState.IsValid)
            {
                db.RegEntries.Add(registrationentry);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(registrationentry);
        }
        //
        // GET: /SearchRegistration/EditParticipant/5?RegUID
        public ActionResult EditParticipant(string RegUID, int id = 0)
        {
            if (RegUID == null || id == 0)
            {
                return RedirectToAction("Index", "Home");
            }

            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int RegID = FoundEntry.RegUIDtoID(RegUID);

                var participantentry = from m in db.ParticipantEntries.Include(p => p.RegistrationEntries).
                    Include(p => p.Statuses).Include(p => p.Services).Include(p => p.AgeRanges).
                    Include(p => p.Genders).Include(p => p.RegTypes).Include(p => p.Fellowships).Include(p => p.RoomTypes).
                    Where(p => p.ParticipantID.Equals(id))
                                       select m;

                if (participantentry == null || RegID == 0 || participantentry.FirstOrDefault().RegistrationID != RegID)
                {
                    return RedirectToAction("Index", "Home");
                }

                ViewBag.RegUID = RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ParticipantID = participantentry.FirstOrDefault().ParticipantID;

                ViewBag.StatusID = new SelectList(db.Statuses, "StatusID", "Name", participantentry.FirstOrDefault().StatusID);
                ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name", participantentry.FirstOrDefault().ServiceID);
                ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name", participantentry.FirstOrDefault().AgeRangeID);
                ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name", participantentry.FirstOrDefault().GenderID);
                ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name", participantentry.FirstOrDefault().RegTypeID);
                ViewBag.FellowshipID = new SelectList(db.Fellowships, "FellowshipID", "Name", participantentry.FirstOrDefault().FellowshipID);
                ViewBag.RoomTypeID = new SelectList(db.RoomTypes, "RoomTypeID", "Name", participantentry.FirstOrDefault().RoomTypeID);

                //ViewBag.ServiceID = new SelectList(db.Services.Where(p => p.ServiceID.Equals(participantentry.FirstOrDefault().ServiceID)), "ServiceID", "Name", participantentry.FirstOrDefault().ServiceID);
                //ViewBag.AgeRangeID = new SelectList(db.AgeRanges.Where(p => p.AgeRangeID.Equals(participantentry.FirstOrDefault().AgeRangeID)), "AgeRangeID", "Name", participantentry.FirstOrDefault().AgeRangeID);
                //ViewBag.GenderID = new SelectList(db.Genders.Where(p => p.GenderID.Equals(participantentry.FirstOrDefault().GenderID)), "GenderID", "Name", participantentry.FirstOrDefault().GenderID);
                //ViewBag.RegTypeID = new SelectList(db.RegTypes.Where(p => p.RegTypeID.Equals(participantentry.FirstOrDefault().RegTypeID)), "RegTypeID", "Name", participantentry.FirstOrDefault().RegTypeID);
                //ViewBag.FellowshipID = new SelectList(db.Fellowships.Where(p => p.ServiceID.Equals(participantentry.FirstOrDefault().ServiceID)), "FellowshipID", "Name", participantentry.FirstOrDefault().FellowshipID);
                //ViewBag.RoomTypeID = new SelectList(db.RoomTypes.Where(p => p.RegTypeID.Equals(participantentry.FirstOrDefault().RegTypeID)), "RoomTypeID", "Name", participantentry.FirstOrDefault().RoomTypeID);
                //ViewBag.PartPrice = participantentry.FirstOrDefault().PartPrice;

                EventHistory NewEvent = new EventHistory();
                NewEvent.AddHistory(RegID, "Admin Participant Opened", participantentry.FirstOrDefault().ParticipantID);

                return View(participantentry.FirstOrDefault());
            }
        }
Пример #5
0
        public ActionResult Edit(string RegUID, RegistrationEntry RegEntry)
        {
            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = RegUID;
                return View();
            }
            else
            {

                RegEntry.Email = RegEntry.Email.ToLower();
                RegEntry.Phone = new string(RegEntry.Phone.Where(c => char.IsDigit(c)).ToArray());

                var registrationentry = from m in _db.RegEntries.Where(p => p.RegistrationUID.Equals(RegUID))
                                        select m;

                RegistrationEntry FoundEntry = registrationentry.FirstOrDefault();

                var searchemail = from m in _db.RegEntries.Where(p => p.Email.Equals(RegEntry.Email))
                                  select m;

                RegistrationEntry SearchEmail = searchemail.FirstOrDefault();

                var searchphone = from m in _db.RegEntries.Where(p => p.Phone.Equals(RegEntry.Phone))
                                  select m;

                RegistrationEntry SearchPhone = searchphone.FirstOrDefault();

                if (FoundEntry != null && SearchEmail != null)
                {
                    if (FoundEntry.RegistrationID != SearchEmail.RegistrationID)
                    {
                        ViewBag.Found = true;
                        ViewBag.RegUID = FoundEntry.RegistrationUID;
                        ViewBag.MessageEn = "Email already exist";
                        ViewBag.MessageCh = "电子邮件已经存在";
                        return View(RegEntry);
                    }
                }

                if (FoundEntry != null && SearchPhone != null)
                {
                    if (FoundEntry.RegistrationID != SearchPhone.RegistrationID)
                    {
                        ViewBag.Found = true;
                        ViewBag.RegUID = FoundEntry.RegistrationUID;
                        ViewBag.MessageEn = "Phone Number already exist";
                        ViewBag.MessageCh = "电话号码已经存在";
                        return View(RegEntry);
                    }
                }

                FoundEntry.Email = RegEntry.Email;
                FoundEntry.Phone = RegEntry.Phone;

                _db.Entry(FoundEntry).State = EntityState.Modified;
                _db.SaveChanges();

                EventHistory NewEvent = new EventHistory();
                NewEvent.AddHistory(FoundEntry.RegistrationID, "Registration LogIn Changed", 0);

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

            }
        }
Пример #6
0
        public ActionResult Create(FormCollection values)
        {
            var order = new RegistrationEntry();

            TryUpdateModel(order);

            try
            {
                order.Email = order.Email.ToLower();
                order.Phone = new string(order.Phone.Where(c => char.IsDigit(c)).ToArray());

                if (_db.RegEntries.Any(e => e.Email == order.Email))
                {
                    ViewBag.MessageEn = "Email or Phone Number already exist";
                    ViewBag.MessageCh = "电子邮件或电话号码已经存在";
                    ViewBag.RegIsAllowed = true;
                    return View(order);
                }
                else if (_db.RegEntries.Any(e => e.Phone == order.Phone))
                {
                    ViewBag.MessageEn = "Email or Phone Number already exist";
                    ViewBag.MessageCh = "电子邮件或电话号码已经存在";
                    ViewBag.RegIsAllowed = true;
                    return View(order);
                }
                else
                {
                    ViewBag.Message = null;

                    Guid NewKey = System.Guid.NewGuid();

                    order.RegistrationUID = NewKey.ToString();

                    order.DateCreated = DateTime.Now;
                    order.IsConfirmed = false;

                    _db.RegEntries.Add(order);
                    _db.SaveChanges();

                    EventHistory NewEvent = new EventHistory();
                    NewEvent.AddHistory(order.RegUIDtoID(order.RegistrationUID), "New Registration Created", 0);

                    return RedirectToAction("Modify", "Participant", new { RegUID = order.RegistrationUID, isPage2 = false, id = 0 });
                    //return RedirectToAction("Index");
                }
            }
            catch
            {
                return View(order);
            }
        }
        public ActionResult RoomNoteAdd(string RegUID, bool isPage2, bool? isAdmin, int ID, RoomNote roomNote)
        {
            if (isAdmin == null)
            {
                isAdmin = false;
            }

            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View(roomNote);
            }

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

            if (RegID == 0)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View(roomNote);
            }

            var findRoomNote = from m in db.RoomNotes.Where(p => p.PartID.Equals(ID))
                select m;

            if (findRoomNote.FirstOrDefault() == null)
            {

                roomNote.PartID = ID;

                db.RoomNotes.Add(roomNote);
                db.SaveChanges();

                EventHistory NewEvent = new EventHistory();
                NewEvent.AddHistory(RegID, "RoomNote Add", roomNote.RoomNoteID);

                return RedirectToAction("Modify", new { RegUID = RegUID, isPage2 = isPage2, id = ID });
            }
            else
            {
                RoomNote newRoomNote = findRoomNote.FirstOrDefault();

                newRoomNote.Note = roomNote.Note;

                db.Entry(newRoomNote).State = EntityState.Modified;
                db.SaveChanges();

                EventHistory NewEvent = new EventHistory();
                NewEvent.AddHistory(RegID, "RoomNote Add", newRoomNote.RoomNoteID);

                return RedirectToAction("Modify", new { RegUID = RegUID, isPage2 = isPage2, id = ID });
            }

            ViewBag.Found = false;
            ViewBag.Message = "Catchall Error";
            return View(roomNote);
        }
        //
        // GET: /SearchRegistration/EditRegistration/RegUID
        public ActionResult EditRegistration(string RegUID)
        {
            if (RegUID == null)
            {
                return RedirectToAction("Index", "Home");
            }
            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

                if (FoundRegID != 0)
                {

                    var registrationentry = from m in db.RegEntries.Where(p => p.RegistrationID.Equals(FoundRegID))
                                            select m;
                    ViewBag.Message = "Edit Registration Detail";

                    return View(registrationentry.FirstOrDefault());
                }
                else
                {
                    ViewBag.Message = "Invalid Registration Key";
                    return View();
                }
            }
        }
Пример #9
0
        //
        // POST: /Register/Unlock/RegUID
        public ActionResult Unlock(string RegUID, bool isAdmin = false)
        {
            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = RegUID;
                return View();
            }
            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

                if (FoundRegID != 0)
                {
                    var registrationentry = from m in _db.RegEntries.Where(p => p.RegistrationID.Equals(FoundRegID))
                                            select m;

                    ViewBag.Found = true;

                    FoundEntry = registrationentry.SingleOrDefault();
                    FoundEntry.IsConfirmed = false;

                    _db.Entry(FoundEntry).State = EntityState.Modified;

                    var PartEntry = from m in _db.ParticipantEntries.Include(p => p.RegistrationEntries).
                                   Include(p => p.Statuses).Include(p => p.Services).Include(p => p.AgeRanges).
                                   Include(p => p.Genders).Include(p => p.RegTypes).Include(p => p.Fellowships).Include(p => p.RoomTypes).
                                   Where(p => p.RegistrationID.Equals(FoundEntry.RegistrationID)).Where(p => !p.StatusID.Equals((int)4))
                                    select m;

                    foreach (ParticipantEntry FoundPart in PartEntry)
                    {
                        FoundPart.StatusID = (int)2;
                        _db.Entry(FoundPart).State = EntityState.Modified;
                    }
                    _db.SaveChanges();

                    if (isAdmin)
                    {
                        EventHistory NewEvent = new EventHistory();
                        NewEvent.AddHistory(FoundRegID, "Admin Registration Unlocked", 0);

                        return RedirectToAction("Detail", "SearchRegistration", new { Id = FoundRegID });
                    }
                    else
                    {
                        EventHistory NewEvent = new EventHistory();
                        NewEvent.AddHistory(FoundRegID, "General Registration Unlocked", 0);

                        return RedirectToAction("Modify", "Register", new { RegUID = RegUID });
                    }
                }
                else
                {
                    ViewBag.Found = false;
                    ViewBag.MessageEn = "Invalid Registration Key";
                    ViewBag.MessageCh = "没有找到登记";
                    return View();
                }
            }
        }
Пример #10
0
        //
        // GET: /Register/Modify/RegUID
        public ActionResult Modify(string RegUID)
        {
            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = RegUID;
                return RedirectToAction("Index", "Register");
            }
            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

                if (FoundRegID != 0)
                {
                    EventHistory NewEvent = new EventHistory();
                    NewEvent.AddHistory(FoundRegID, "General Registration Opened", 0);

                    ViewBag.Found = true;
                    ViewBag.RegID = FoundRegID;
                    return View();
                }
                else
                {
                    ViewBag.Found = false;
                    ViewBag.MessageEn = "Invalid Registration Key";
                    ViewBag.MessageCh = "没有找到登记";
                    return View();
                }
            }
        }
Пример #11
0
        public ActionResult Modify(string RegUID, bool isPage2, bool? isAdmin, int Id, ParticipantEntry participantentry)
        {
            if (isAdmin == null)
            {
                isAdmin = false;
            }

            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

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

            if (RegID == 0)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

            if (RegID != 0 && Id == 0)
            {
                if (ModelState.IsValid)
                {

                    participantentry.RegistrationID = RegID;
                    participantentry.StatusID = (int)1;
                    participantentry.FellowshipID = participantentry.ServiceID;
                    participantentry.RoomTypeID = participantentry.RegTypeID;

                    RegPrice FoundPrice = new RegPrice();
                    participantentry.PartPrice = FoundPrice.PriceReturn(participantentry.AgeRangeID, participantentry.RegTypeID);

                    db.ParticipantEntries.Add(participantentry);
                    db.SaveChanges();

                    EventHistory NewEvent = new EventHistory();
                    NewEvent.AddHistory(RegID, "New Participant Created", participantentry.ParticipantID);

                    return RedirectToAction("Modify", new { RegUID = RegUID, isPage2 = true, id = participantentry.ParticipantID });
                }

                ViewBag.Found = true;
                ViewBag.isNew = true;
                ViewBag.isPage2 = isPage2;
                ViewBag.RegUID = (string)RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name");
                ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name");
                ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name");
                ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name");

                return View();
            }

            if (RegID != 0 && Id != 0)
            {

                if (isPage2)
                {
                    if (ModelState.IsValid && RegID != 0)
                    {
                        participantentry.RegistrationID = RegID;
                        participantentry.ParticipantID = Id;
                        participantentry.StatusID = (int)2;

                        RegPrice FoundPrice = new RegPrice();
                        participantentry.PartPrice = FoundPrice.PriceReturn(participantentry.AgeRangeID, participantentry.RegTypeID);

                        db.Entry(participantentry).State = EntityState.Modified;
                        db.SaveChanges();

                        EventHistory NewEvent = new EventHistory();
                        NewEvent.AddHistory(RegID, "Participant Confirmed", participantentry.ParticipantID);

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

                        if (participantentry.ServiceID == (int) 2 || participantentry.ServiceID == (int) 4)
                        {
                            return RedirectToAction("HeadsetRequest", "Participant",
                                             new {RegUID = RegUID, id = participantentry.ParticipantID});
                        }
                        else
                        {
                            return RedirectToAction("Modify", "Register", new { RegUID = RegUID });
                        }
                    }

                    ViewBag.ServiceID = new SelectList(db.Services.Where(p => p.ServiceID.Equals(participantentry.ServiceID)), "ServiceID", "Name", participantentry.ServiceID);
                    ViewBag.AgeRangeID = new SelectList(db.AgeRanges.Where(p => p.AgeRangeID.Equals(participantentry.AgeRangeID)), "AgeRangeID", "Name", participantentry.AgeRangeID);
                    ViewBag.GenderID = new SelectList(db.Genders.Where(p => p.GenderID.Equals(participantentry.GenderID)), "GenderID", "Name", participantentry.GenderID);
                    ViewBag.RegTypeID = new SelectList(db.RegTypes.Where(p => p.RegTypeID.Equals(participantentry.RegTypeID)), "RegTypeID", "Name", participantentry.RegTypeID);
                    ViewBag.FellowshipID = new SelectList(db.Fellowships.Where(p => p.ServiceID.Equals(participantentry.ServiceID)), "FellowshipID", "Name", participantentry.FellowshipID);
                    ViewBag.RoomTypeID = new SelectList(db.RoomTypes.Where(p => p.RegTypeID.Equals(participantentry.RegTypeID)), "RoomTypeID", "Name", participantentry.RoomTypeID);
                    ViewBag.PartPrice = participantentry.PartPrice;
                }
                else
                {
                    if (ModelState.IsValid)
                    {
                        participantentry.RegistrationID = RegID;
                        participantentry.ParticipantID = Id;
                        participantentry.StatusID = (int)1;

                        var partFellowshipList = from m in db.Fellowships.Where(p => p.FellowshipID.Equals(participantentry.FellowshipID))
                                                 select m;
                        Fellowship partFellowship = partFellowshipList.FirstOrDefault();

                        try
                        {
                            if (partFellowship.ServiceID != participantentry.ServiceID)
                            {
                                participantentry.FellowshipID = participantentry.ServiceID;
                            }
                        }
                        catch
                        {
                        }

                        var partRoomTypeList = from m in db.RoomTypes.Where(p => p.RoomTypeID.Equals(participantentry.RoomTypeID))
                                               select m;
                        RoomType partRoomType = partRoomTypeList.FirstOrDefault();

                        try
                        {
                            if (partRoomType.RegTypeID != participantentry.RegTypeID)
                            {
                                participantentry.RoomTypeID = participantentry.RegTypeID;
                            }
                        }
                        catch
                        {
                        }

                        RegPrice FoundPrice = new RegPrice();
                        participantentry.PartPrice = FoundPrice.PriceReturn(participantentry.AgeRangeID, participantentry.RegTypeID);

                        db.Entry(participantentry).State = EntityState.Modified;
                        db.SaveChanges();

                        EventHistory NewEvent = new EventHistory();
                        NewEvent.AddHistory(RegID, "Participant Edited", participantentry.ParticipantID);

                        return RedirectToAction("Modify", new { RegUID = RegUID, isPage2 = true, id = participantentry.ParticipantID });
                    }

                    ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name", participantentry.ServiceID);
                    ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name", participantentry.AgeRangeID);
                    ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name", participantentry.GenderID);
                    ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name", participantentry.RegTypeID);
                }

                ViewBag.Found = true;
                ViewBag.isNew = false;
                ViewBag.isPage2 = isPage2;
                ViewBag.isAdmin = isAdmin;
                ViewBag.RegUID = RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ParticipantID = participantentry.ParticipantID;

                return View(participantentry);
            }

            ViewBag.Found = false;
            ViewBag.Message = "Catchall Error";
            return View();
        }
Пример #12
0
        //
        // GET: /Participant/Modify/RegUID
        public ActionResult Modify(string RegUID, bool isPage2 = false, bool? isAdmin = false, int Id = 0)
        {
            if (isAdmin == null)
            {
                isAdmin = false;
            }

            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

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

            if (RegID == 0)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

            if (RegID != 0 && Id == 0)
            {
                ViewBag.Found = true;
                ViewBag.isNew = true;
                ViewBag.isPage2 = isPage2;
                ViewBag.RegUID = (string)RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name");
                ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name");
                ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name");
                ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name");

                return View();
            }

            if (RegID != 0 && Id != 0)
            {
                 var participantentry = from m in db.ParticipantEntries.Include(p => p.RegistrationEntries).
                    Include(p => p.Statuses).Include(p => p.Services).Include(p => p.AgeRanges).
                    Include(p => p.Genders).Include(p => p.RegTypes).Include(p => p.Fellowships).Include(p => p.RoomTypes).
                    Where(p => p.ParticipantID.Equals(Id))
                                       select m;

                if (participantentry == null || RegID == 0 || participantentry.FirstOrDefault().RegistrationID != RegID)
                {
                    ViewBag.Found = false;
                    ViewBag.Message = "Participant not Found!";
                    return View();
                }

                ViewBag.Found = true;
                ViewBag.isNew = false;
                ViewBag.isPage2 = isPage2;
                ViewBag.isAdmin = isAdmin;
                ViewBag.RegUID = RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ParticipantID = participantentry.FirstOrDefault().ParticipantID;

                if (isPage2)
                {
                    ViewBag.ServiceID = new SelectList(db.Services.Where(p => p.ServiceID.Equals(participantentry.FirstOrDefault().ServiceID)), "ServiceID", "Name", participantentry.FirstOrDefault().ServiceID);
                    ViewBag.AgeRangeID = new SelectList(db.AgeRanges.Where(p => p.AgeRangeID.Equals(participantentry.FirstOrDefault().AgeRangeID)), "AgeRangeID", "Name", participantentry.FirstOrDefault().AgeRangeID);
                    ViewBag.GenderID = new SelectList(db.Genders.Where(p => p.GenderID.Equals(participantentry.FirstOrDefault().GenderID)), "GenderID", "Name", participantentry.FirstOrDefault().GenderID);
                    ViewBag.RegTypeID = new SelectList(db.RegTypes.Where(p => p.RegTypeID.Equals(participantentry.FirstOrDefault().RegTypeID)), "RegTypeID", "Name", participantentry.FirstOrDefault().RegTypeID);
                    ViewBag.FellowshipID = new SelectList(db.Fellowships.Where(p => p.ServiceID.Equals(participantentry.FirstOrDefault().ServiceID)), "FellowshipID", "Name", participantentry.FirstOrDefault().FellowshipID);
                    ViewBag.RoomTypeID = new SelectList(db.RoomTypes.Where(p => p.RegTypeID.Equals(participantentry.FirstOrDefault().RegTypeID)), "RoomTypeID", "Name", participantentry.FirstOrDefault().RoomTypeID);
                    ViewBag.PartPrice = participantentry.FirstOrDefault().PartPrice;
                }
                else
                {
                    ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name", participantentry.FirstOrDefault().ServiceID);
                    ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name", participantentry.FirstOrDefault().AgeRangeID);
                    ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name", participantentry.FirstOrDefault().GenderID);
                    ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name", participantentry.FirstOrDefault().RegTypeID);
                }

                return View(participantentry.FirstOrDefault());
            }

            ViewBag.Found = false;
            ViewBag.Message = "Catchall Error";
            return View();
        }
Пример #13
0
        public ActionResult Index(int Id = 0 , bool isAdmin=false)
        {
            if (Id == 0)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Participant not found";
                return PartialView();
            }
            else
            {
                var PartEntry = from m in db.ParticipantEntries.Include(p => p.RegistrationEntries).
                                    Include(p => p.Statuses).Include(p => p.Services).Include(p => p.AgeRanges).
                                    Include(p => p.Genders).Include(p => p.RegTypes).Include(p => p.Fellowships).Include(p=> p.RoomTypes).
                                    Where(p => p.RegistrationID.Equals(Id))
                                select m;

                RegistrationEntry Registration = new RegistrationEntry();

                ViewBag.Found = true;
                ViewBag.isAdmin = isAdmin;
                ViewBag.RegID = Id;
                ViewBag.RegUID = Registration.RegIDtoUID(Id);
                ViewBag.RegIsConfirm = Registration.RegIsConfirm(Id);
                ViewBag.RegIsComplete = Registration.RegIsComplete(Id);

                if (isAdmin)
                {
                    return PartialView(PartEntry.ToList());
                }
                else
                {
                    return PartialView(PartEntry.Where(p => !p.StatusID.Equals((int)4)).ToList());
                }
            }
        }
Пример #14
0
        public ActionResult HeadsetRequest(ParticipantEntry participantEntry)
        {
            var foundEntry = from m in db.ParticipantEntries
                                 .Where(p => p.RegistrationID.Equals(participantEntry.RegistrationID))
                                 .Where(p => p.FirstName.Equals(participantEntry.FirstName))
                                   select m;

            var regUID = new RegistrationEntry().RegIDtoUID(foundEntry.FirstOrDefault().RegistrationID);

            var headset = new Headset();

            headset.ParticipantID = foundEntry.FirstOrDefault().ParticipantID;

            var foundHeadset = from m in db.Headsets
                                 .Where(p => p.ParticipantID.Equals(headset.ParticipantID))
                             select m;

            try
            {
                if (foundHeadset.FirstOrDefault().ParticipantID == headset.ParticipantID)
                {
                    return RedirectToAction("Modify", "Register", new { RegUID = regUID });
                }

            }
            catch (Exception)
            {
                if (ModelState.IsValid)
                {
                    db.Headsets.Add(headset);
                    db.SaveChanges();

                    EventHistory NewEvent = new EventHistory();
                    NewEvent.AddHistory(foundEntry.FirstOrDefault().RegistrationID, "Headset Requested", foundEntry.FirstOrDefault().ParticipantID);

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

            return View(participantEntry);
        }
        public ActionResult EditParticipant(string RegUID, int id, ParticipantEntry participantEntry)
        {
            if (RegUID == null)
            {
                return RedirectToAction("Index", "Home");
            }
            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

                if (FoundRegID != 0 && ModelState.IsValid)
                {

                    //participantEntry.RegistrationID = FoundRegID;

                    //var foundPartEntry = from m in db.ParticipantEntries.Include(p => p.RegistrationEntries).
                    //                                  Include(p => p.Statuses)
                    //                                 .Include(p => p.Services)
                    //                                 .Include(p => p.AgeRanges)
                    //                                 .
                    //                                  Include(p => p.Genders)
                    //                                 .Include(p => p.RegTypes)
                    //                                 .Include(p => p.Fellowships)
                    //                                 .Include(p => p.RoomTypes)
                    //                                 .
                    //                                  Where(p => p.RegistrationID.Equals(FoundRegID)).
                    //                                  Where(p => p.FirstName.Equals(participantEntry.FirstName)).
                    //                                  Where(p => p.LastName.Equals(participantEntry.LastName))
                    //                     select m;

                    //participantEntry.ParticipantID = foundPartEntry.FirstOrDefault().ParticipantID;
                    //foundPartEntry = null;

                    participantEntry.ParticipantID = id;
                    participantEntry.RegistrationID = FoundRegID;

                    db.Entry(participantEntry).State = EntityState.Modified;
                    db.SaveChanges();

                    EventHistory NewEvent = new EventHistory();
                    NewEvent.AddHistory(participantEntry.RegistrationID, "Admin Registration Edited", 0);

                    return RedirectToAction("Detail", "SearchRegistration", new { id = participantEntry.RegistrationID });
                }
                else
                {
                    ViewBag.RegUID = RegUID;
                    ViewBag.RegistrationID = participantEntry.RegistrationID;
                    ViewBag.ParticipantID = participantEntry.ParticipantID;

                    ViewBag.StatusID = new SelectList(db.Statuses, "StatusID", "Name", participantEntry.StatusID);
                    ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name", participantEntry.ServiceID);
                    ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name", participantEntry.AgeRangeID);
                    ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name", participantEntry.GenderID);
                    ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name", participantEntry.RegTypeID);
                    ViewBag.FellowshipID = new SelectList(db.Fellowships, "FellowshipID", "Name", participantEntry.FellowshipID);
                    ViewBag.RoomTypeID = new SelectList(db.RoomTypes, "RoomTypeID", "Name", participantEntry.RoomTypeID);
                    return View(participantEntry);
                }
            }
        }
        public ActionResult EditRegistration(string RegUID, RegistrationEntry registrationentry)
        {
            if (RegUID == null)
            {
                return RedirectToAction("Index", "Home");
            }
            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                int FoundRegID = FoundEntry.RegUIDtoID(RegUID);

                if (FoundRegID != 0 && ModelState.IsValid)
                {

                    registrationentry.RegistrationID = FoundRegID;

                    db.Entry(registrationentry).State = EntityState.Modified;
                    db.SaveChanges();

                    EventHistory NewEvent = new EventHistory();
                    NewEvent.AddHistory(registrationentry.RegistrationID, "Admin Registration Edited", 0);

                    return RedirectToAction("Detail", "SearchRegistration", new { RegUID = registrationentry.RegistrationUID });
                }
                else
                {
                    return RedirectToAction("Index", "Home");
                }
            }
        }
Пример #17
0
        //
        // GET: /Register/
        public ActionResult Index()
        {
            var order = new RegistrationEntry();
            ViewBag.RegIsAllowed = order.RegIsAllowed();

            if (Equals(ViewBag.RegIsAllowed, false))
            {
                ViewBag.MessageEn = "Registration is currently Closed. Registration starts on Sunday 4/28th";
                ViewBag.MessageCh = "目前注册关闭. 四月二十八日(星期日)开始登记.";
            }

            var test = HttpContext.User.Identity.IsAuthenticated;

            if (test)
            {
                ViewBag.RegIsAllowed = true;
            }

            return View();
        }
Пример #18
0
        public ActionResult Remove(string RegUID, int id, ParticipantEntry participantentry)
        {
            int RegID = (int)0;

            if (RegUID == null)
            {
                ViewBag.PartMessage = "Participant not found";
                return RedirectToAction("Index", "Home");
            }
            else
            {
                RegistrationEntry FoundEntry = new RegistrationEntry();
                RegID = FoundEntry.RegUIDtoID(RegUID);
            }

            if (ModelState.IsValid && RegID != 0)
            {
                participantentry.RegistrationID = RegID;
                participantentry.ParticipantID = id;
                participantentry.StatusID = (int)4;

                participantentry.PartPrice = (decimal)0;

                db.Entry(participantentry).State = EntityState.Modified;
                db.SaveChanges();

                EventHistory NewEvent = new EventHistory();
                NewEvent.AddHistory(RegID, "Participant Deleted", participantentry.ParticipantID);

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

            ViewBag.RegUID = RegUID;
            ViewBag.RegistrationID = RegID;
            ViewBag.ParticipantID = participantentry.ParticipantID;
            ViewBag.ServiceID = new SelectList(db.Services.Where(p => p.ServiceID.Equals(participantentry.ServiceID)), "ServiceID", "Name", participantentry.ServiceID);
            ViewBag.AgeRangeID = new SelectList(db.AgeRanges.Where(p => p.AgeRangeID.Equals(participantentry.AgeRangeID)), "AgeRangeID", "Name", participantentry.AgeRangeID);
            ViewBag.GenderID = new SelectList(db.Genders.Where(p => p.GenderID.Equals(participantentry.GenderID)), "GenderID", "Name", participantentry.GenderID);
            ViewBag.RegTypeID = new SelectList(db.RegTypes.Where(p => p.RegTypeID.Equals(participantentry.RegTypeID)), "RegTypeID", "Name", participantentry.RegTypeID);
            ViewBag.FellowshipID = new SelectList(db.Fellowships.Where(p => p.ServiceID.Equals(participantentry.ServiceID)), "FellowshipID", "Name", participantentry.FellowshipID);
            ViewBag.RoomTypeID = new SelectList(db.RoomTypes.Where(p => p.RegTypeID.Equals(participantentry.RegTypeID)), "RoomTypeID", "Name", participantentry.RoomTypeID);
            ViewBag.PartPrice = participantentry.PartPrice;

            return View(participantentry);
        }
Пример #19
0
        public ActionResult Search(FormCollection values)
        {
            var order = new RegistrationEntry();

            TryUpdateModel(order);

            try
            {
                order.Email = order.Email.ToLower();
                order.Phone = new string(order.Phone.Where(c => char.IsDigit(c)).ToArray());

                if (order.Email != null && order.Phone != null)
                {
                    var registers = from m in _db.RegEntries
                                    select m;

                    registers = registers.Where(s => s.Email.Equals(order.Email) && s.Phone.Equals(order.Phone));

                    RegistrationEntry FoundReg = registers.FirstOrDefault();
                    if (FoundReg == null)
                    {
                        ViewBag.MessageEn = "Registration Not Found";
                        ViewBag.MessageCh = "没有找到登记";
                        ViewBag.RegIsAllowed = true;
                        return View();
                    }
                    else
                    {
                        string RegKey = FoundReg.RegistrationUID;

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

                else
                {
                    return View();
                }
            }
            catch
            {
                return View(order);
            }
        }
Пример #20
0
        public ActionResult RoomNote(string RegUID, bool isPage2, bool? isAdmin, int Id, ParticipantEntry participantentry)
        {
            if (isAdmin == null)
            {
                isAdmin = false;
            }

            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

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

            if (RegID == 0)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

            if (RegID != 0 && Id == 0)
            {

                ViewBag.Found = false;
                ViewBag.Message = "Invalid Participant ID";
                return View();
            }

            if (RegID != 0 && Id != 0)
            {
                if (isPage2)
                {
                    if (ModelState.IsValid && RegID != 0)
                    {
                        participantentry.RegistrationID = RegID;
                        participantentry.ParticipantID = Id;
                        participantentry.StatusID = (int)1;

                        RegPrice FoundPrice = new RegPrice();
                        participantentry.PartPrice = FoundPrice.PriceReturn(participantentry.AgeRangeID, participantentry.RegTypeID);

                        db.Entry(participantentry).State = EntityState.Modified;
                        db.SaveChanges();

                        EventHistory NewEvent = new EventHistory();
                        NewEvent.AddHistory(RegID, "RoomNote Add Page", participantentry.ParticipantID);

                        return RedirectToAction("RoomNoteAdd", new { RegUID = RegUID, isPage2 = true, id = participantentry.ParticipantID });
                    }

                    ViewBag.ServiceID = new SelectList(db.Services.Where(p => p.ServiceID.Equals(participantentry.ServiceID)), "ServiceID", "Name", participantentry.ServiceID);
                    ViewBag.AgeRangeID = new SelectList(db.AgeRanges.Where(p => p.AgeRangeID.Equals(participantentry.AgeRangeID)), "AgeRangeID", "Name", participantentry.AgeRangeID);
                    ViewBag.GenderID = new SelectList(db.Genders.Where(p => p.GenderID.Equals(participantentry.GenderID)), "GenderID", "Name", participantentry.GenderID);
                    ViewBag.RegTypeID = new SelectList(db.RegTypes.Where(p => p.RegTypeID.Equals(participantentry.RegTypeID)), "RegTypeID", "Name", participantentry.RegTypeID);
                    ViewBag.FellowshipID = new SelectList(db.Fellowships.Where(p => p.ServiceID.Equals(participantentry.ServiceID)), "FellowshipID", "Name", participantentry.FellowshipID);
                    ViewBag.RoomTypeID = new SelectList(db.RoomTypes.Where(p => p.RegTypeID.Equals(participantentry.RegTypeID)), "RoomTypeID", "Name", participantentry.RoomTypeID);
                    ViewBag.PartPrice = participantentry.PartPrice;
                }
                else
                {
                    ViewBag.Found = false;
                    ViewBag.Message = "Invalid Participant ID";
                    return View();
                }

                ViewBag.Found = false;
                ViewBag.Message = "Invalid Participant ID";
                return View();

            }

            ViewBag.Found = false;
            ViewBag.Message = "Catchall Error";
            return View();
        }
Пример #21
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();
        }
Пример #22
0
        //
        // GET: /Participant/RoomNoteAdd/UID
        public ActionResult RoomNoteAdd(string RegUID, bool isPage2 = false, bool? isAdmin = false, int Id = 0)
        {
            if (isAdmin == null)
            {
                isAdmin = false;
            }

            if (RegUID == null)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

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

            if (RegID == 0)
            {
                ViewBag.Found = false;
                ViewBag.Message = "Invalid Registration Key";
                return View();
            }

            if (RegID != 0 && Id == 0)
            {
                ViewBag.Found = true;
                ViewBag.isNew = true;
                ViewBag.isPage2 = isPage2;
                ViewBag.RegUID = (string)RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name");
                ViewBag.AgeRangeID = new SelectList(db.AgeRanges, "AgeRangeID", "Name");
                ViewBag.GenderID = new SelectList(db.Genders, "GenderID", "Name");
                ViewBag.RegTypeID = new SelectList(db.RegTypes, "RegTypeID", "Name");

                return View();
            }

            if (RegID != 0 && Id != 0)
            {
                var participantentry = from m in db.ParticipantEntries.Include(p => p.RegistrationEntries).
                   Include(p => p.Statuses).Include(p => p.Services).Include(p => p.AgeRanges).
                   Include(p => p.Genders).Include(p => p.RegTypes).Include(p => p.Fellowships).Include(p => p.RoomTypes).
                   Where(p => p.ParticipantID.Equals(Id))
                                       select m;

                var roomNote = from m in db.RoomNotes.Where(p => p.PartID.Equals(Id))
                               select m;

                if (roomNote == null || RegID == 0)
                {
                    ViewBag.Found = false;
                    ViewBag.isNew = false;
                    ViewBag.isPage2 = isPage2;
                    ViewBag.isAdmin = isAdmin;
                    ViewBag.RegUID = RegUID;
                    ViewBag.RegistrationID = RegID;
                    ViewBag.ParticipantID = Id;

                    RoomNote returnRoomNote = new RoomNote();
                    returnRoomNote.Note = null;
                    returnRoomNote.PartID = Id;

                    return View(returnRoomNote);
                }

                ViewBag.Found = true;
                ViewBag.isNew = false;
                ViewBag.isPage2 = isPage2;
                ViewBag.isAdmin = isAdmin;
                ViewBag.RegUID = RegUID;
                ViewBag.RegistrationID = RegID;
                ViewBag.ParticipantID = Id;

                return View(roomNote.FirstOrDefault());
            }

            ViewBag.Found = false;
            ViewBag.Message = "Catchall Error";
            return View();
        }
 public ActionResult Edit(RegistrationEntry registrationentry)
 {
     if (ModelState.IsValid)
     {
         db.Entry(registrationentry).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(registrationentry);
 }
Пример #24
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();
        }