public ActionResult MyEvent(Guid?memberID, DateTime?startDate, DateTime?endDate) // MyLocalRetreatEvent { if (startDate == null) { startDate = new DateTime(2011, 7, 1); } if (memberID == null) { MembershipUser user = Membership.GetUser(); memberID = ((Guid)(user.ProviderUserKey)); } var eventSignatures = from r in _entities.EventRegistrations where r.MemberInfo.MemberID == memberID && r.Event.EventTypeID == 1 && //r.SignTime != null && (startDate == null || r.Event.StartDateTime >= startDate.Value) && (endDate == null || r.Event.EndDateTime <= endDate.Value) orderby r.Event.StartDateTime select r; List <EventRegistrationViewModel> eventRegistrationList = new List <EventRegistrationViewModel>(); ViewData["LocalRetreatRegistrationCount"] = eventSignatures.Count(); EventRegistrationController erc = new EventRegistrationController(); foreach (var eventSignature in eventSignatures) { int id = eventSignature.ID; List <string> vLabels = new List <string>(); List <string> vValues = new List <string>(); List <string> mLabels = new List <string>(); List <string> mValues = new List <string>(); erc.GetEventVolunteerJobBooking(id, vLabels, vValues, "name"); erc.GetEventMealBooking(id, mValues, mLabels); var viewModel = new EventRegistrationViewModel { EventRegistration = eventSignature, LocalRetreatMealBookingLabels = mLabels, LocalRetreatMealBookingValues = mValues, EventVolunteerJobBookingLabels = vLabels, EventVolunteerJobBookingValues = vValues, }; eventRegistrationList.Add(viewModel); } return(View(eventRegistrationList)); }
public ActionResult Table(int localRetreatID) { //return View(_entities.EventVolunteerJobBookings); ViewData["LocalRetreatID"] = localRetreatID; List <EventVolunteerJobBooking> localRetreatVolunteerJobBookings = (from r in _entities.EventVolunteerJobBookings where r.EventRegistration.EventID == localRetreatID orderby r.EventVolunteerJob.VolunteerJobTypeID, r.EventVolunteerJob.EventSchedule.DateTimeFrom select r).ToList(); List <string> volunteerJobNames = new List <string>(); List <string> volunteerJobTimes = new List <string>(); List <string> PersonInCharges = new List <string>(); EventRegistrationController erc = new EventRegistrationController(); erc.RetrieveEventVolunteerJobBooking(localRetreatVolunteerJobBookings, volunteerJobNames, volunteerJobTimes, "Remark", PersonInCharges); List <EventVolunteerJobBookingViewModel> viewModelList = new List <EventVolunteerJobBookingViewModel> (); EventVolunteerJobBookingViewModel viewModel; for (int i = 0; i < volunteerJobNames.Count; i++) { viewModel = new EventVolunteerJobBookingViewModel(); viewModel.VolunteerJobName = volunteerJobNames[i]; viewModel.VolunteerJobTime = volunteerJobTimes[i]; viewModel.PersonInCharge = PersonInCharges[i]; viewModelList.Add(viewModel); } ViewData["LocalRetreat"] = _entities.Events.Single(a => a.ID == localRetreatID); ViewData["VolunteerJobTypes"] = _entities.VolunteerJobTypes.ToList(); if (viewModelList.Count() > 0) { return(View(viewModelList)); } else { ViewData["Message"] = "There is no local retreat Volunteer Job Booked record in database."; return(View()); } }