public ActionResult <ScheduledCourseSectionViewModel> SearchCourseSectionForStudentAttendance(ScheduledCourseSectionViewModel scheduledCourseSectionViewModel) { ScheduledCourseSectionViewModel scheduledCourseSectionView = new ScheduledCourseSectionViewModel(); try { scheduledCourseSectionView = _studentAttendanceService.SearchCourseSectionForStudentAttendance(scheduledCourseSectionViewModel); } catch (Exception ex) { scheduledCourseSectionView._message = ex.Message; scheduledCourseSectionView._failure = true; } return(scheduledCourseSectionView); }
public ActionResult <ScheduledCourseSectionViewModel> GetAllScheduledCourseSectionForStaff(ScheduledCourseSectionViewModel scheduledCourseSectionViewModel) { ScheduledCourseSectionViewModel scheduledCourseSectionView = new ScheduledCourseSectionViewModel(); try { scheduledCourseSectionView = _staffScheduleService.GetAllScheduledCourseSectionForStaff(scheduledCourseSectionViewModel); } catch (Exception es) { scheduledCourseSectionView._message = es.Message; scheduledCourseSectionView._failure = true; } return(scheduledCourseSectionView); }
public ScheduledCourseSectionViewModel SearchCourseSectionForStudentAttendance(ScheduledCourseSectionViewModel scheduledCourseSectionViewModel) { ScheduledCourseSectionViewModel scheduledCourseSectionView = new ScheduledCourseSectionViewModel(); if (TokenManager.CheckToken(scheduledCourseSectionViewModel._tenantName + scheduledCourseSectionViewModel._userName, scheduledCourseSectionViewModel._token)) { scheduledCourseSectionView = this.studentAttendanceRepository.SearchCourseSectionForStudentAttendance(scheduledCourseSectionViewModel); } else { scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = TOKENINVALID; } return(scheduledCourseSectionView); }
public ScheduledCourseSectionViewModel MissingAttendanceListForCourseSection(PageResult pageResult) { ScheduledCourseSectionViewModel missingAttendanceView = new ScheduledCourseSectionViewModel(); try { if (TokenManager.CheckToken(pageResult._tenantName + pageResult._userName, pageResult._token)) { missingAttendanceView = this.staffPortalRepository.MissingAttendanceListForCourseSection(pageResult); } else { missingAttendanceView._failure = true; missingAttendanceView._message = TOKENINVALID; } } catch (Exception es) { missingAttendanceView._failure = true; missingAttendanceView._message = es.Message; } return(missingAttendanceView); }
/// <summary> /// Get All Scheduled CourseSection For Staff /// </summary> /// <param name="scheduledCourseSectionViewModel"></param> /// <returns></returns> public ScheduledCourseSectionViewModel GetAllScheduledCourseSectionForStaff(ScheduledCourseSectionViewModel scheduledCourseSectionViewModel) { ScheduledCourseSectionViewModel scheduledCourseSectionView = new ScheduledCourseSectionViewModel(); try { if (TokenManager.CheckToken(scheduledCourseSectionViewModel._tenantName + scheduledCourseSectionViewModel._userName, scheduledCourseSectionViewModel._token)) { scheduledCourseSectionView = this.staffScheduleRepository.GetAllScheduledCourseSectionForStaff(scheduledCourseSectionViewModel); } else { scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = TOKENINVALID; } } catch (Exception es) { scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = es.Message; } return(scheduledCourseSectionView); }
public ScheduledCourseSectionViewModel SearchCourseSectionForStudentAttendance(ScheduledCourseSectionViewModel scheduledCourseSectionViewModel) { ScheduledCourseSectionViewModel scheduledCourseSectionView = new ScheduledCourseSectionViewModel(); try { scheduledCourseSectionView.TenantId = scheduledCourseSectionViewModel.TenantId; scheduledCourseSectionView._tenantName = scheduledCourseSectionViewModel._tenantName; scheduledCourseSectionView.SchoolId = scheduledCourseSectionViewModel.SchoolId; scheduledCourseSectionView.StaffId = scheduledCourseSectionViewModel.StaffId; scheduledCourseSectionView._token = scheduledCourseSectionViewModel._token; var scheduledCourseSectionData = this.context?.StaffCoursesectionSchedule.Include(s => s.StaffMaster).Include(x => x.CourseSection).Include(x => x.CourseSection.Course).Include(x => x.CourseSection.SchoolCalendars).Where(x => x.TenantId == scheduledCourseSectionViewModel.TenantId && x.SchoolId == scheduledCourseSectionViewModel.SchoolId && x.StaffId == scheduledCourseSectionViewModel.StaffId && x.IsDropped != true).ToList(); if (scheduledCourseSectionData.Count() > 0) { foreach (var scheduledCourseSection in scheduledCourseSectionData) { CourseSectionViewList CourseSections = new CourseSectionViewList(); if (scheduledCourseSection.CourseSection.ScheduleType == "Fixed Schedule (1)") { CourseSections.ScheduleType = "Fixed Schedule"; var courseFixedScheduleData = this.context?.CourseFixedSchedule.Include(c => c.BlockPeriod).FirstOrDefault(x => x.TenantId == scheduledCourseSection.TenantId && x.SchoolId == scheduledCourseSection.SchoolId && x.CourseSectionId == scheduledCourseSection.CourseSectionId); if (courseFixedScheduleData != null) { courseFixedScheduleData.BlockPeriod.CourseFixedSchedule = null; courseFixedScheduleData.BlockPeriod.CourseVariableSchedule = null; courseFixedScheduleData.BlockPeriod.CourseCalendarSchedule = null; courseFixedScheduleData.BlockPeriod.CourseBlockSchedule = null; CourseSections.courseFixedSchedule = courseFixedScheduleData; } } if (scheduledCourseSection.CourseSection.ScheduleType == "Variable Schedule (2)") { CourseSections.ScheduleType = "Variable Schedule"; var courseVariableScheduleData = this.context?.CourseVariableSchedule.Include(c => c.BlockPeriod).Where(x => x.TenantId == scheduledCourseSection.TenantId && x.SchoolId == scheduledCourseSection.SchoolId && x.CourseSectionId == scheduledCourseSection.CourseSectionId).ToList(); if (courseVariableScheduleData.Count > 0) { courseVariableScheduleData.ForEach(x => { x.BlockPeriod.CourseFixedSchedule = null; x.BlockPeriod.CourseVariableSchedule = null; x.BlockPeriod.CourseCalendarSchedule = null; x.BlockPeriod.CourseBlockSchedule = null; }); CourseSections.courseVariableSchedule = courseVariableScheduleData; } } if (scheduledCourseSection.CourseSection.ScheduleType == "Calendar Schedule (3)") { CourseSections.ScheduleType = "Calendar Schedule"; var courseCalenderScheduleData = this.context?.CourseCalendarSchedule.Include(c => c.BlockPeriod).Where(x => x.TenantId == scheduledCourseSection.TenantId && x.SchoolId == scheduledCourseSection.SchoolId && x.CourseSectionId == scheduledCourseSection.CourseSectionId).ToList(); if (courseCalenderScheduleData.Count > 0) { courseCalenderScheduleData.ForEach(x => { x.BlockPeriod.CourseFixedSchedule = null; x.BlockPeriod.CourseVariableSchedule = null; x.BlockPeriod.CourseCalendarSchedule = null; x.BlockPeriod.CourseBlockSchedule = null; }); CourseSections.courseCalendarSchedule = courseCalenderScheduleData; } } if (scheduledCourseSection.CourseSection.ScheduleType == "Block Schedule (4)") { CourseSections.ScheduleType = "Block Schedule"; var courseBlockScheduleData = this.context?.CourseBlockSchedule.Include(c => c.BlockPeriod).Where(x => x.TenantId == scheduledCourseSection.TenantId && x.SchoolId == scheduledCourseSection.SchoolId && x.CourseSectionId == scheduledCourseSection.CourseSectionId).ToList(); if (courseBlockScheduleData.Count > 0) { courseBlockScheduleData.ForEach(x => { x.BlockPeriod.CourseFixedSchedule = null; x.BlockPeriod.CourseVariableSchedule = null; x.BlockPeriod.CourseCalendarSchedule = null; x.BlockPeriod.CourseBlockSchedule = null; }); CourseSections.courseBlockSchedule = courseBlockScheduleData; } } CourseSections.CourseId = scheduledCourseSection.CourseId; CourseSections.CourseSectionId = scheduledCourseSection.CourseSectionId; CourseSections.CourseSectionName = scheduledCourseSection.CourseSectionName; CourseSections.YrMarkingPeriodId = scheduledCourseSection.YrMarkingPeriodId; CourseSections.SmstrMarkingPeriodId = scheduledCourseSection.SmstrMarkingPeriodId; CourseSections.QtrMarkingPeriodId = scheduledCourseSection.QtrMarkingPeriodId; CourseSections.DurationStartDate = scheduledCourseSection.DurationStartDate; CourseSections.DurationEndDate = scheduledCourseSection.DurationEndDate; CourseSections.MeetingDays = scheduledCourseSection.MeetingDays; CourseSections.AttendanceCategoryId = scheduledCourseSection.CourseSection.AttendanceCategoryId; scheduledCourseSectionView.courseSectionViewList.Add(CourseSections); } } else { scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = NORECORDFOUND; } } catch (Exception es) { scheduledCourseSectionView.courseSectionViewList = null; scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = es.Message; } return(scheduledCourseSectionView); }
public ScheduledCourseSectionViewModel GetAllScheduledCourseSectionForStaff(ScheduledCourseSectionViewModel scheduledCourseSectionViewModel) { ScheduledCourseSectionViewModel scheduledCourseSectionView = new ScheduledCourseSectionViewModel(); try { scheduledCourseSectionView.TenantId = scheduledCourseSectionViewModel.TenantId; scheduledCourseSectionView._tenantName = scheduledCourseSectionViewModel._tenantName; scheduledCourseSectionView.SchoolId = scheduledCourseSectionViewModel.SchoolId; scheduledCourseSectionView.StaffId = scheduledCourseSectionViewModel.StaffId; scheduledCourseSectionView._token = scheduledCourseSectionViewModel._token; var scheduledCourseSectionData = this.context?.StaffCoursesectionSchedule.Include(s => s.StaffMaster).Include(x => x.CourseSection).Include(x => x.CourseSection.Course).Include(x => x.CourseSection.SchoolCalendars).Where(x => x.TenantId == scheduledCourseSectionViewModel.TenantId && x.SchoolId == scheduledCourseSectionViewModel.SchoolId && x.StaffId == scheduledCourseSectionViewModel.StaffId && x.IsDropped != true).ToList(); if (scheduledCourseSectionData.Count() > 0) { List <int> csIds = new List <int> { }; csIds = scheduledCourseSectionData.Select(x => x.CourseSectionId).ToList(); var scheduledStaffDataForCourseSection = this.context?.StaffCoursesectionSchedule.Include(x => x.StaffMaster).Where(x => x.TenantId == scheduledCourseSectionViewModel.TenantId && x.SchoolId == scheduledCourseSectionViewModel.SchoolId && x.StaffId != scheduledCourseSectionViewModel.StaffId && (csIds == null || (csIds.Contains(x.CourseSectionId))) && x.IsDropped != true).ToList(); foreach (var scheduledCourseSection in scheduledCourseSectionData) { CourseSectionViewList CourseSections = new CourseSectionViewList(); //var scheduledStaffData = this.context?.StaffCoursesectionSchedule.Include(x => x.StaffMaster).Where(x => x.TenantId == scheduledCourseSectionViewModel.TenantId && x.SchoolId == scheduledCourseSectionViewModel.SchoolId && x.StaffId != scheduledCourseSection.StaffId&& x.CourseSectionId== scheduledCourseSection.CourseSectionId && x.IsDropped != true).ToList(); var scheduledStaffData = scheduledStaffDataForCourseSection.Where(x => x.TenantId == scheduledCourseSectionViewModel.TenantId && x.SchoolId == scheduledCourseSectionViewModel.SchoolId && x.CourseSectionId == scheduledCourseSection.CourseSectionId).ToList(); if (scheduledStaffData.Count() > 0) { foreach (var scheduledStaff in scheduledStaffData) { var staffName = scheduledStaff.StaffMaster.FirstGivenName + " " + scheduledStaff.StaffMaster.MiddleName + " " + scheduledStaff.StaffMaster.LastFamilyName; CourseSections.ScheduledStaff = CourseSections.ScheduledStaff != null ? CourseSections.ScheduledStaff + "|" + staffName : staffName; } } CourseSections.WeekDays = scheduledCourseSection.CourseSection.SchoolCalendars.Days; CourseSections.CourseTitle = scheduledCourseSection.CourseSection.Course.CourseTitle; if (scheduledCourseSection.CourseSection.ScheduleType == "Fixed Schedule (1)") { CourseSections.ScheduleType = "Fixed Schedule"; } if (scheduledCourseSection.CourseSection.ScheduleType == "Variable Schedule (2)") { CourseSections.ScheduleType = "Variable Schedule"; } if (scheduledCourseSection.CourseSection.ScheduleType == "Calendar Schedule (3)") { CourseSections.ScheduleType = "Calendar Schedule"; } if (scheduledCourseSection.CourseSection.ScheduleType == "Block Schedule (4)") { CourseSections.ScheduleType = "Block Schedule"; } CourseSections.CourseId = scheduledCourseSection.CourseId; CourseSections.CourseSectionId = scheduledCourseSection.CourseSectionId; CourseSections.CourseSectionName = scheduledCourseSection.CourseSectionName; CourseSections.YrMarkingPeriodId = scheduledCourseSection.YrMarkingPeriodId; CourseSections.SmstrMarkingPeriodId = scheduledCourseSection.SmstrMarkingPeriodId; CourseSections.QtrMarkingPeriodId = scheduledCourseSection.QtrMarkingPeriodId; CourseSections.DurationStartDate = scheduledCourseSection.DurationStartDate; CourseSections.DurationEndDate = scheduledCourseSection.DurationEndDate; CourseSections.MeetingDays = scheduledCourseSection.MeetingDays; scheduledCourseSectionView.courseSectionViewList.Add(CourseSections); } } else { scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = NORECORDFOUND; } } catch (Exception es) { scheduledCourseSectionView.courseSectionViewList = null; scheduledCourseSectionView._failure = true; scheduledCourseSectionView._message = es.Message; } return(scheduledCourseSectionView); }