static void DisplayTutors() { DateTime currentDayTime = DateTime.Now; createdImages.Clear(); var query = from tutor in tutorTable.AsEnumerable() join schedule in scheduleTable on tutor.Field <int>("ID") equals schedule.Field <int>("ID") where (schedule.Field <int>("Day") == (int)currentDayTime.DayOfWeek + 1) && TimeBetween(currentDayTime, schedule.Field <DateTime>("Start").TimeOfDay, schedule.Field <DateTime>("End").TimeOfDay) && (schedule.Field <string>("Campus") == currentCampus || schedule.Field <string>("Campus") == "Online" || currentCampus == "All") select new { TutorID = tutor.Field <int>("ID"), Name = tutor.Field <string>("FirstName") + " " + tutor.Field <string>("LastName") }; int i = objSlides.Count + 1; if (query.Any()) { foreach (var q in query) { SlideRange slide = CreateSlide(tutorsSlide); WriteToTextbox(slide, "TutorName", q.Name); GetSubject(q.TutorID, slide); GetTimes(q.TutorID, slide); string imageName = i.ToString(CultureInfo.CurrentCulture) + "_" + DateTime.Now.ToString("HH-mm-ss") + ".jpg"; slide.Export(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strImagePath, imageName), "JPG"); i++; createdImages.Add(imageName); } } else { SlideRange slide = CreateSlide(noTutorsSlide); string imageName = DateTime.Now.ToString("HH-mm-ss") + "_" + i.ToString("D2", CultureInfo.CurrentCulture) + ".jpg"; slide.Export(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strImagePath, imageName), "JPG"); createdImages.Add(imageName); } }
static void DisplayTutors() { DateTime currentDayTime = DateTime.Now; var query = from tutor in tutorTable.AsEnumerable() join schedule in scheduleTable on tutor.Field <int>("ID") equals schedule.Field <int>("ID") where schedule.Field <int>("Day") == (int)currentDayTime.DayOfWeek + 1 && schedule.Field <DateTime>("Start").TimeOfDay <= currentDayTime.TimeOfDay && schedule.Field <DateTime>("End").TimeOfDay >= currentDayTime.TimeOfDay select new { TutorID = tutor.Field <int>("ID"), Name = tutor.Field <string>("FirstName") + " " + tutor.Field <string>("LastName") }; int i = 0; foreach (var q in query) { SlideRange slide = CreateSlide(tutorsSlide); WriteToTextbox(slide, "TutorName", q.Name + i); i++; slide.Export(AppDomain.CurrentDomain.BaseDirectory + "\\Images\\" + (i + 23).ToString(CultureInfo.CurrentCulture), "JPG"); } }