public ActionResult CheckUserIn(int intUserID) { GetDAL get = new GetDAL(); get.OpenConnection(); Users u = get.GetUserByID(intUserID); get.CloseConnection(); get.OpenConnection(); List <AttendancePlanned> apList = get.GetAttendancePlannedByRehearsalPart(ChosenRehearsalPart); // join query here get.CloseConnection(); InsertDAL insert = new InsertDAL(); insert.OpenConnection(); foreach (AttendancePlanned ap in apList) { if (u.Equals(ap.User)) { insert.InsertAttendanceActual(new AttendanceActual(DateTime.Now, true, ap)); UsersNotCurrentlyAtRehearsal.Remove(u); } } get.CloseConnection(); insert.CloseConnection(); return(RedirectToAction("Index")); }
////add text to GenerateReport.cshtml public ActionResult MakeReport(ReportsHomeVM vm) { ReportsHomeVM model = new ReportsHomeVM(); if (vm.ChosenRehearsal == null) { vm.ChosenRehearsal = new Rehearsal(Globals.rID); } GetDAL get = new GetDAL(); get.OpenConnection(); Rehearsal r = get.GetRehearsalByID(vm.ChosenRehearsal.IntRehearsalID); Globals.rID = r.IntRehearsalID; //Rehearsal r = vm.ChosenRehearsal; List <RehearsalPart> rehearsalPartsForToday = get.GetRehearsalPartsByRehearsal(r); model.EventName = r.Event.StrName;; model.GroupName = r.Event.Group.StrName; model.Location = r.StrLocation; model.StartTime = r.DtmStartDateTime.ToString(); model.EndTime = r.DtmEndDateTime.ToString(); model.RehearsalDate = r.DtmStartDateTime.Date.ToString(); foreach (RehearsalPart rp in rehearsalPartsForToday) { rp.AttendancePlanned = get.GetAttendancePlannedByRehearsalPart(rp); rp.AttendanceActual = new List <AttendanceActual>(); foreach (AttendancePlanned ap in rp.AttendancePlanned) { rp.AttendanceActual = rp.AttendanceActual.Concat(get.GetAttendanceActualByPlanned(ap)).ToList(); } } model.Notes = r.StrNotes; model.LstAllRehearsalParts = rehearsalPartsForToday; get.CloseConnection(); Globals.PDF = model; return(View("GenerateReport", model)); }