// // 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(ParticipantEntry participantentry) { if (ModelState.IsValid) { db.ParticipantEntries.Add(participantentry); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RegistrationID = new SelectList(db.RegEntries, "RegistrationID", "RegistrationUID", participantentry.RegistrationID); 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 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 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); }
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(); }
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); } } }