// // GET: /SearchRegistration/Detail/id public ActionResult Detail(int Id = 0) { if (Id == 0) { ViewBag.Found = false; ViewBag.Message = "No Registration number"; return View(); } else { EventHistory NewEvent = new EventHistory(); NewEvent.AddHistory(Id, "Admin Registration Opened", 0); ViewBag.Found = true; ViewBag.RegID = Id; return View(); } }
public void AddHistory(int RegHistID = 0, string Event = "No Event Given", int EventHistID = 0) { if (RegHistID != 0) { SCRegistrationContext db = new SCRegistrationContext(); EventHistory NewHistory = new EventHistory(); NewHistory.HistoryDate = DateTime.Now; NewHistory.RegHistID = RegHistID; NewHistory.HistoryEvent = Event; NewHistory.EventHistID = EventHistID; db.EventHistory.Add(NewHistory); db.SaveChanges(); } else { } }
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); }
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 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(); }
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(); }
// // 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(); } } }
// // GET: /Building/PartAssign/5 public ActionResult PartAssign(int roomid = 0, int partid =0) { if (roomid == 0) { return RedirectToAction("Index"); } if (partid == 0) { return RedirectToAction("Index"); } var foundParticipant = db.ParticipantEntries.FirstOrDefault(b => b.ParticipantID.Equals(partid)); if (foundParticipant == null) { return RedirectToAction("Index"); } RoomAssignment newAssignment = new RoomAssignment(); newAssignment.PartID = partid; newAssignment.RoomID = roomid; newAssignment.IsDeleted = false; if (ModelState.IsValid) { db.RoomAssignments.Add(newAssignment); db.SaveChanges(); EventHistory newEvent = new EventHistory(); newEvent.AddHistory(foundParticipant.RegistrationID, "Room Assigned", newAssignment.RoomAssignmentID); return RedirectToAction("RoomAssign", new {id = roomid}); } return RedirectToAction("Index"); }
// // GET: /Building/PartUnassign/5 public ActionResult PartUnassign(int partid = 0) { if (partid == 0) { return RedirectToAction("Index"); } var foundParticipant = db.ParticipantEntries.FirstOrDefault(b => b.ParticipantID.Equals(partid)); if (foundParticipant == null) { return RedirectToAction("Index"); } var foundAssignment = db.RoomAssignments .Where(b => b.IsDeleted.Equals(false)) .FirstOrDefault(b => b.PartID.Equals(partid)); if (foundAssignment == null) { return RedirectToAction("Index"); } foundAssignment.IsDeleted = true; if (ModelState.IsValid) { db.Entry(foundAssignment).State = EntityState.Modified; db.SaveChanges(); EventHistory newEvent = new EventHistory(); newEvent.AddHistory(foundParticipant.RegistrationID, "Room UnAssigned", foundAssignment.RoomAssignmentID); return RedirectToAction("RoomAssign", new {id = foundAssignment.RoomID}); } return RedirectToAction("Index"); }
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); } } }
// // 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()); } }
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"); } } }
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 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 }); } }
public ActionResult Edit(int id, SmallGroup smallgroup) { if (ModelState.IsValid) { //SmallGroup SGCheck = db.SmallGroups.Find(id); if (smallgroup == null) { return HttpNotFound(); } ParticipantEntry participant = db.ParticipantEntries.Find(smallgroup.PartID); if (participant == null) { return HttpNotFound(); } //if (participant.ParticipantID != SGCheck.PartID) //{ // return HttpNotFound(); //} smallgroup.SmallGroupID = id; db.Entry(smallgroup).State = EntityState.Modified; db.SaveChanges(); EventHistory NewEvent = new EventHistory(); NewEvent.AddHistory(participant.RegistrationID, "Small Group Modified", smallgroup.SmallGroupID); return RedirectToAction("Index", "AdminCongregation", new { SerID = smallgroup.ServiceID }); } ViewBag.ServiceID = new SelectList(db.Services, "ServiceID", "Name", smallgroup.ServiceID); return View(smallgroup); }
// // 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(); } } }
public ActionResult Create(int id, SmallGroup smallgroup) { if (id == 0) { ViewBag.isFound = false; return View(); } ParticipantEntry participant = db.ParticipantEntries.Find(id); if (participant == null) { return HttpNotFound(); } var SGCheck = from m in db.SmallGroups.Where(p => p.PartID.Equals(id)) select m; SmallGroup sgcheck = SGCheck.FirstOrDefault(); if (sgcheck != null && sgcheck.PartID == id) { return RedirectToAction("Edit", new { id =sgcheck.SmallGroupID }); } if (participant.ParticipantID == smallgroup.PartID) { smallgroup.PartID = id; smallgroup.ServiceID = participant.ServiceID; db.SmallGroups.Add(smallgroup); db.SaveChanges(); EventHistory NewEvent = new EventHistory(); NewEvent.AddHistory(participant.RegistrationID, "Small Group Assigned", smallgroup.SmallGroupID); return RedirectToAction("Index", "AdminCongregation", new { SerID = smallgroup.ServiceID }); } var SGLIst = new[] { "Small Group 1", "Small Group 2", "Small Group 3", "Small Group 4", "Small Group 5", "Small Group 6", "Small Group 7", "Small Group 8", "Small Group 9" }; ViewBag.SmallGroupName = new SelectList(SGLIst, smallgroup.SmallGroupName); ViewBag.isFound = true; ViewBag.PartID = participant.ParticipantID; return View(smallgroup); }
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 Edit(int id, PaymentEntry paymententry) { if (ModelState.IsValid) { paymententry.PaymentID = id; db.Entry(paymententry).State = EntityState.Modified; db.SaveChanges(); EventHistory NewEvent = new EventHistory(); NewEvent.AddHistory(paymententry.RegID, "Payment Entry Modified", id); return RedirectToAction("Index"); } ViewBag.PmtStatusID = new SelectList(db.PmtStatuses, "PmtStatusID", "Name", paymententry.PmtStatusID); ViewBag.PmtTypeID = new SelectList(db.PmtTypes, "PmtTypeID", "Name", paymententry.PmtTypeID); return View(paymententry); }