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();
        }
        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();
        }