/// <summary>
        /// Method for fetching the list off holidays by selected academic year
        /// </summary>
        /// <param name="academicYearId"></param>
        /// <returns></returns>
        public async Task <List <InstituteHolidayAc> > GetHolidaysByAcademicYearIdAsync(int academicYearId, ApplicationUser currentUser)
        {
            int currentUserInstituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(currentUser.Id, true);

            List <Holiday> holidaysList = await _imsDbContext.Holidays.Where(x => x.InstitutionId == currentUserInstituteId && x.AcademicYearId == academicYearId).ToListAsync();

            List <InstituteHolidayAc> holidaysListAc = new List <InstituteHolidayAc>();

            foreach (Holiday holiday in holidaysList)
            {
                holidaysListAc.Add(new InstituteHolidayAc
                {
                    Id                  = holiday.Id,
                    AcademicYearId      = holiday.AcademicYearId,
                    InstitutionId       = holiday.InstitutionId,
                    HolidayDate         = holiday.HolidayDate,
                    HolidayToDate       = holiday.HolidayToDate,
                    Description         = holiday.Description,
                    OccuranceType       = holiday.OccuranceType,
                    OccuranceTypeString = EnumHelperService.GetDescription(holiday.OccuranceType)
                });
            }

            return(holidaysListAc);
        }
        public async Task <IActionResult> GetStudentAttendanceForStudentDashboardAsync([FromBody] GetStudentAttendanceForStudentDashboardAc attendance)
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var user = await _userManager.FindByNameAsync(User.Identity.Name);

            var student = await _iMSDbContext.StudentBasicInformation.FirstOrDefaultAsync(x => x.UserId == user.Id && x.InstituteId == instituteId);

            List <StudentAttendance> attendances = new List <StudentAttendance>();

            if (student != null)
            {
                var academicYear = await _iMSDbContext.InstituteAcademicYears.FirstOrDefaultAsync(x => x.InstituteId == instituteId && x.IsActive);

                attendances = await _iMSDbContext.StudentAttendances.Where(x => x.StudentId == student.Id && x.AttendanceDate >= attendance.FromDate &&
                                                                           x.AttendanceDate <= attendance.EndDate && x.PeriodOrderId == 0).ToListAsync();

                if (academicYear != null)
                {
                    attendances = attendances.Where(x => x.AcademicYearId == academicYear.Id).ToList();
                }
                attendances.ForEach(x => x.AttendanceTypeDescription = EnumHelperService.GetDescription(x.AttendanceType));
            }
            return(Ok(attendances));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Method to get all fee receipt - SS
        /// </summary>
        /// <param name="instituteId">institue id</param>
        /// <returns>list of fee receipts</returns>
        public async Task <List <FeeReceipt> > GetAllFeeReceiptsAsync(int instituteId)
        {
            var list = await _iMSDbContext.FeeReceipts.Include(s => s.Student).Where(x => x.Student.InstituteId == instituteId).ToListAsync();

            list.ForEach(x => x.ReceiptTypeDescription = EnumHelperService.GetDescription(x.ReceiptType));
            return(list);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method for fetching the list of all chart of accounts - RS
        /// </summary>
        /// <param name="currentUserInstituteId"></param>
        /// <returns></returns>
        public async Task <List <ChartOfAccountsListViewAC> > GetChartOfAccountsListAsync(int currentUserInstituteId)
        {
            List <ChartOfAccountTypeEnum> chartOfAccountTypeEnumDetailsList = EnumHelperService.GetEnumValuesList <ChartOfAccountTypeEnum>();
            List <FinanceChartOfAccounts> chartsOfAccountsList = await _imsDbContext.FinanceChartOfAccounts
                                                                 .Where(x => x.InstituteId == currentUserInstituteId)
                                                                 .Include(x => x.Institute)
                                                                 .ToListAsync();

            List <ChartOfAccountsListViewAC> chartOfAccountsListView = new List <ChartOfAccountsListViewAC>();

            foreach (ChartOfAccountTypeEnum chartOfAccountTypeEnum in chartOfAccountTypeEnumDetailsList)
            {
                // Set account types and parent accounts
                ChartOfAccountsListViewAC chartOfAccountsListViewAc = new ChartOfAccountsListViewAC
                {
                    ChartOfAccountTypeEnum       = chartOfAccountTypeEnum,
                    ChartOfAccountTypeEnumString = EnumHelperService.GetDescription(chartOfAccountTypeEnum),
                    ParentChartOfAccounts        = MapChartOfAccountToApplicationClassList(chartsOfAccountsList.FindAll(x => x.AccountType == chartOfAccountTypeEnum && x.IsParent))
                };

                // Set child accounts
                foreach (ChartOfAccountsAC parentChartOfAccount in chartOfAccountsListViewAc.ParentChartOfAccounts)
                {
                    parentChartOfAccount.ChildChartOfAccounts = MapChartOfAccountToApplicationClassList(
                        chartsOfAccountsList.FindAll(x => x.AccountType == chartOfAccountTypeEnum && !x.IsParent && x.ParentGroupId == parentChartOfAccount.Id));
                }

                chartOfAccountsListView.Add(chartOfAccountsListViewAc);
            }

            return(chartOfAccountsListView);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Method to get list of leave types - SS
        /// </summary>
        /// <param name="instituteId">institute id</param>
        /// <returns>list of leave types</returns>
        public async Task <List <LeaveType> > GetLeaveTypesAsync(int instituteId)
        {
            var list = await _iMSDbContext.LeaveTypes.Where(x => x.InstituteId == instituteId).ToListAsync();

            list.ForEach(x => x.LeaveAssignedTypeEnumDescription = EnumHelperService.GetDescription(x.LeaveAssignedTypeEnum));
            return(list);
        }
        /// <summary>
        /// Method for fetching the list of all circular/notice - RS
        /// </summary>
        /// <param name="currentUserInstituteId"></param>
        /// <returns></returns>
        public async Task <List <CircularNoticeAc> > GetAllCircularNoticeAsync(int currentUserInstituteId)
        {
            List <CircularNotice> circularNoticeList = await _imsDbContext.CircularNotices
                                                       .Where(x => x.InstituteId == currentUserInstituteId)
                                                       .Include(x => x.CircularNoticeRecipients)
                                                       .ToListAsync();

            List <CircularNoticeAc> circularNoticeAcList = new List <CircularNoticeAc>();

            foreach (CircularNotice circularNotice in circularNoticeList)
            {
                circularNoticeAcList.Add(new CircularNoticeAc
                {
                    Id               = circularNotice.Id,
                    Description      = circularNotice.Description,
                    Message          = circularNotice.Message,
                    NoticeDate       = circularNotice.NoticeDate,
                    NoticeTo         = circularNotice.NoticeTo,
                    NoticeToString   = EnumHelperService.GetDescription(circularNotice.NoticeTo),
                    NoticeType       = circularNotice.NoticeType,
                    NoticeTypeString = EnumHelperService.GetDescription(circularNotice.NoticeType)
                });
            }

            return(circularNoticeAcList);
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> GetInitialDataForReportsAsync()
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var classes = await _iMSDbContext.InstituteClasses.Where(x => x.InstituteId == instituteId).ToListAsync();

            var religions = await _iMSDbContext.Religions.Where(x => x.InstituteId == instituteId).ToListAsync();

            var classSubjectMapping = await _iMSDbContext.InstituteClassSubjectMappings.Where(x => x.InstituteClass.InstituteId == instituteId).ToListAsync();

            var teachingStaffs = await _iMSDbContext.TeachingStaffs.Where(x => x.InstituteId == instituteId).ToListAsync();

            var academicYears = await _iMSDbContext.InstituteAcademicYears.Where(x => x.InstituteId == instituteId).ToListAsync();

            var subjects = await _iMSDbContext.InstituteSubjects.Where(x => x.InstituteId == instituteId).ToListAsync();

            var currentYear = academicYears.FirstOrDefault(x => x.IsActive);
            var attendances = await _iMSDbContext.StaffAttendances.Where(x => x.Staff.InstituteId == instituteId).ToListAsync();

            if (currentYear != null)
            {
                attendances = attendances.Where(x => x.AcademicYearId == currentYear.Id).ToList();
            }
            attendances.ForEach(x => x.AttendanceTypeDescription = EnumHelperService.GetDescription(x.AttendanceType));
            var notices = await _iMSDbContext.CircularNotices.Where(x => x.InstituteId == instituteId).ToListAsync();

            var homeworks = await _iMSDbContext.Homeworks.Include(s => s.HomeworkMessageMappings).Where(x => x.Class.InstituteId == instituteId).ToListAsync();

            var allowedDates = await GetAttendanceDaysAsync(instituteId);

            return(Ok(new { classes, religions, classSubjectMapping, teachingStaffs, academicYears, subjects, attendances, notices, homeworks, allowedDates }));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Method for generating event reports - RS
        /// </summary>
        /// <param name="eventManagementReportQueryAc"></param>
        /// <param name="currentUserInstituteId"></param>
        /// <returns></returns>
        public async Task <EventManagementReportResponseAc> GenerateEventReportAsync(EventManagementReportQueryAc eventManagementReportQueryAc, int currentUserInstituteId)
        {
            #region Fetch details

            List <EventReportAc>     eventReportAcList      = new List <EventReportAc>();
            List <EventReportDetail> eventReportDetailsList = await _imsDbContext.EventReportDetails
                                                              .Where(x => x.InstituteId == currentUserInstituteId && x.SentOn.Date >= eventManagementReportQueryAc.StartDate.Date && x.SentOn.Date <= eventManagementReportQueryAc.EndDate.Date)
                                                              .ToListAsync();

            foreach (EventReportDetail eventReportDetail in eventReportDetailsList)
            {
                eventReportAcList.Add(new EventReportAc
                {
                    Format  = EnumHelperService.GetDescription(eventReportDetail.TemplateFormat),
                    To      = eventReportDetail.To,
                    Subject = eventReportDetail.Subject,
                    Message = eventReportDetail.Message,
                    SentOn  = eventReportDetail.SentOn.ToString("dd-MMM-yyyy")
                });
            }

            #endregion

            #region Generate file

            string fileName = "Event_Report_" + DateTime.Now.Day.ToString("00") + "_" + DateTime.Now.Month.ToString("00") + "_" + DateTime.Now.Year.ToString("0000") + ".xlsx";
            return(new EventManagementReportResponseAc()
            {
                FileName = fileName,
                ResponseType = "application/ms-excel",
                FileByteArray = ExcelHelperService.GenerateExcelFromList(eventReportAcList, string.Empty)
            });

            #endregion
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> GetLeaveTypeAsync(int leaveTypeId)
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var leaveType = await _iMSDbContext.LeaveTypes.Include(s => s.LeaveAssignedTos).FirstOrDefaultAsync(x => x.Id == leaveTypeId && x.InstituteId == instituteId);

            leaveType.LeaveAssignedTypeEnumDescription = EnumHelperService.GetDescription(leaveType.LeaveAssignedTypeEnum);
            return(Ok(leaveType));
        }
        /// <summary>
        /// Method for fetching an activity by id
        /// </summary>
        /// <param name="activityId"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public async Task <StaffPlannerAc> GetStaffPlanByIdAsync(int plannerId, ApplicationUser currentUser)
        {
            int currentUserInstituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(currentUser.Id, true);

            StaffPlanner staffPlan = await _imsDbContext.StaffPlanners
                                     .Include(x => x.Staff)
                                     .Include(x => x.PlannerAttendeeMappings)
                                     .FirstOrDefaultAsync(x => x.Id == plannerId && x.InstituteId == currentUserInstituteId);

            StaffPlannerAc staffPlanAc = new StaffPlannerAc
            {
                Id                  = staffPlan.Id,
                Name                = staffPlan.Name,
                Description         = staffPlan.Description,
                DateOfPlan          = staffPlan.DateOfPlan,
                IsActive            = staffPlan.IsActive,
                StaffId             = staffPlan.StaffId,
                StaffName           = staffPlan.Staff.FirstName,
                InstituteId         = staffPlan.InstituteId,
                PlannerAttendeeList = new List <StaffPlannerAttendeeMappingAc>()
            };

            List <ApplicationUser> plannerAttendeesList = await _imsDbContext.PlannerAttendeeMappings
                                                          .Where(x => x.PlannerId == plannerId)
                                                          .Include(x => x.Attendee)
                                                          .Select(x => x.Attendee)
                                                          .ToListAsync();

            List <StudentBasicInformation> studentBasicInformationList = await _imsDbContext.StudentBasicInformation.Where(x => x.InstituteId == currentUserInstituteId).ToListAsync();

            List <StaffBasicPersonalInformation> staffBasicPersonalInformationList = await _imsDbContext.StaffBasicPersonalInformation.Where(x => x.InstituteId == currentUserInstituteId).ToListAsync();

            foreach (PlannerAttendeeMapping plannerAttendeeMapping in staffPlan.PlannerAttendeeMappings)
            {
                string attendeeName = plannerAttendeesList.FirstOrDefault(x => x.Id == plannerAttendeeMapping.AttendeeId)?.Name;
                if (plannerAttendeeMapping.ActivityAttendeeType == ActivityAttendeeTypeEnum.Staff)
                {
                    attendeeName = staffBasicPersonalInformationList.FirstOrDefault(x => x.UserId == plannerAttendeeMapping.AttendeeId).FirstName;
                }
                else if (plannerAttendeeMapping.ActivityAttendeeType == ActivityAttendeeTypeEnum.Student)
                {
                    attendeeName = studentBasicInformationList.FirstOrDefault(x => x.UserId == plannerAttendeeMapping.AttendeeId).FirstName;
                }

                staffPlanAc.PlannerAttendeeList.Add(new StaffPlannerAttendeeMappingAc
                {
                    PlannerId                 = staffPlan.Id,
                    PlannerName               = staffPlan.Name,
                    PlannerAttendeeType       = plannerAttendeeMapping.ActivityAttendeeType,
                    PlannerAttendeeTypeString = EnumHelperService.GetDescription(plannerAttendeeMapping.ActivityAttendeeType),
                    AttendeeId                = plannerAttendeeMapping.AttendeeId,
                    AttendeeName              = attendeeName
                });
            }

            return(staffPlanAc);
        }
        /// <summary>
        /// Method to get vehicles list
        /// </summary>
        /// <param name="instituteId">institute id</param>
        /// <returns>list of vehicles</returns>
        public async Task <List <VehicleMaster> > GetVehicleMastersAsync(int instituteId)
        {
            var list = await _iMSDbContext.VehicleMasters.Where(x => x.InstituteId == instituteId).ToListAsync();

            list.ForEach(x =>
            {
                x.FuelTypeDescription    = EnumHelperService.GetDescription(x.FuelType);
                x.VehicleTypeDescription = EnumHelperService.GetDescription(x.VehicleType);
            });
            return(list);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Method to get all feature list by user group id - SS
 /// </summary>
 /// <param name="userGroupId">user group id</param>
 /// <returns>list of user group feature</returns>
 public async Task<List<UserGroupFeature>> GetAllUserGroupFeaturesByUserGroupIdAsync(int userGroupId)
 {
     await SeedingUserGroupFeaturesAsync(userGroupId);
     var list = await _iMSDbContext.UserGroupFeatures.OrderByDescending(c => c.UserGroupFeatureParent).Where(x => x.UserGroupId == userGroupId).ToListAsync();
     list.Reverse();
     list.ForEach(x =>
     {
         x.UserGroupFeatureChildDescription = EnumHelperService.GetDescription(x.UserGroupFeatureChild);
         x.UserGroup = null;
         x.UserGroupFeatureParentDescription = EnumHelperService.GetDescription(x.UserGroupFeatureParent);
     });
     return list;
 }
        /// <summary>
        /// Method to get auto sequence data - SS
        /// </summary>
        /// <param name="loggedInUser">logged in user detail</param>
        /// <param name="generatorTypeEnum">auto sequence type</param>
        /// <returns>auto sequence data</returns>
        public async Task <AutoSequenceGenerator> GetSequenceGeneratorsAsync(ApplicationUser loggedInUser, AutoSequenceGeneratorTypeEnum generatorTypeEnum)
        {
            var instituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(loggedInUser.Id, true);

            await SeedDataForAutoSequenceByTypeAsync(instituteId, loggedInUser.Id, generatorTypeEnum);

            var autoSequence = await _iMSDbContext.AutoSequenceGenerators.Include(x => x.AutoSequenceGeneratorDataTypes)
                               .FirstAsync(x => x.AutoSequenceGeneratorType == generatorTypeEnum && x.InstituteId == instituteId);

            autoSequence.SeperatorDescription           = EnumHelperService.GetDescription(autoSequence.Seperator);
            autoSequence.AutoSequenceGeneratorDataTypes = autoSequence.AutoSequenceGeneratorDataTypes.OrderByDescending(x => x.OrderId).ToList();
            autoSequence.AutoSequenceGeneratorDataTypes = autoSequence.AutoSequenceGeneratorDataTypes.Reverse().ToList();
            return(autoSequence);
        }
        /// <summary>
        /// Method to get all student from relieving table - SS
        /// </summary>
        /// <param name="instituteId">institute id</param>
        /// <returns>list of student</returns>
        public async Task <List <StudentRelievingMapping> > GetAllStudentRelievingMappingsAsync(ApplicationUser loggedInUser)
        {
            var instituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(loggedInUser.Id, true);

            var academicYear = await _iMSDbContext.SelectedAcademicYears.FirstOrDefaultAsync(x => x.UserId == loggedInUser.Id &&
                                                                                             x.AcademicYear.InstituteId == instituteId);

            var list = await _iMSDbContext.StudentRelievingMappings.Include(s => s.Student).Where(x => x.Student.InstituteId == instituteId).ToListAsync();

            list.ForEach(x => x.StudentRelievingDescription = EnumHelperService.GetDescription(x.StudentRelieving));
            if (academicYear != null)
            {
                list = list.Where(x => x.Student.CurrentAcademicYearId == academicYear.AcademicYearId).ToList();
            }
            return(list);
        }
        /// <summary>
        /// Method for fetching the list of all occurance types
        /// </summary>
        /// <returns></returns>
        public List <HolidayOccuranceTypeEnumDetailsListAc> GetOccuranceTypesList()
        {
            List <HolidayOccuranceTypeEnum> occuranceTypeEnumList = EnumHelperService.GetEnumValuesList <HolidayOccuranceTypeEnum>();
            List <HolidayOccuranceTypeEnumDetailsListAc> occuranceTypeEnumDetailsList = new List <HolidayOccuranceTypeEnumDetailsListAc>();

            foreach (HolidayOccuranceTypeEnum holidayOccuranceType in occuranceTypeEnumList)
            {
                occuranceTypeEnumDetailsList.Add(new HolidayOccuranceTypeEnumDetailsListAc
                {
                    HolidayOccuranceTypeEnum       = holidayOccuranceType,
                    HolidayOccuranceTypeEnumString = EnumHelperService.GetDescription(holidayOccuranceType)
                });
            }

            return(occuranceTypeEnumDetailsList);
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> GetFeeReceiptsByIdAsync(int feeReceiptId)
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var feeReceipt = await _imsDbContext.FeeReceipts.Include(s => s.FeeReceiptComponents).FirstOrDefaultAsync(x => x.Id == feeReceiptId &&
                                                                                                                      x.Student.InstituteId == instituteId);

            if (feeReceipt != null)
            {
                feeReceipt.ReceiptTypeDescription = EnumHelperService.GetDescription(feeReceipt.ReceiptType);
                return(Ok(feeReceipt));
            }
            else
            {
                return(Ok(new { Message = "Fee receipt not found" }));
            }
        }
        public async Task <IActionResult> GetVehicleMasterAsync(int vehicleId)
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var vehicle = await _imsDbContext.VehicleMasters.Include(s => s.VehicleDocumentMappings).FirstOrDefaultAsync(x => x.Id == vehicleId && x.InstituteId == instituteId);

            if (vehicle != null)
            {
                vehicle.FuelTypeDescription    = EnumHelperService.GetDescription(vehicle.FuelType);
                vehicle.VehicleTypeDescription = EnumHelperService.GetDescription(vehicle.VehicleType);
                return(Ok(vehicle));
            }
            else
            {
                return(Ok(new { Message = "Vehicle not found" }));
            }
        }
        /// <summary>
        /// Method for fetching the details of the holiday
        /// </summary>
        /// <param name="holidayId"></param>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public async Task <AddHolidayAc> GetHolidayDetailsByIdAsync(int holidayId, ApplicationUser currentUser)
        {
            int currentUserInstituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(currentUser.Id, true);

            Holiday holiday = await _imsDbContext.Holidays.FirstOrDefaultAsync(x => x.Id == holidayId && x.InstitutionId == currentUserInstituteId);

            return(new AddHolidayAc
            {
                Id = holiday.Id,
                AcademicYearId = holiday.AcademicYearId,
                Description = holiday.Description,
                FromDate = holiday.HolidayDate,
                ToDate = holiday.HolidayToDate,
                OccuranceType = holiday.OccuranceType,
                OccuranceTypeString = EnumHelperService.GetDescription(holiday.OccuranceType)
            });
        }
        /// <summary>
        /// Method to get Staff details - SS
        /// </summary>
        /// <param name="getStaffAttendance">query data</param>
        /// <param name="loggedInUser">logged in user</param>
        /// <returns>list of Staff attendance</returns>
        public async Task <List <StaffAttendance> > GetStaffAttendanceAsync(GetStaffAttendanceManagementAc getStaffAttendance, ApplicationUser loggedInUser)
        {
            var instituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(loggedInUser.Id, true);

            var academicYear = await _iMSDbContext.SelectedAcademicYears.FirstOrDefaultAsync(x => x.AcademicYear.InstituteId == instituteId &&
                                                                                             x.UserId == loggedInUser.Id);

            var attendances = await _iMSDbContext.StaffAttendances.Where(x => x.AttendanceDate >= getStaffAttendance.StartDate &&
                                                                         x.AttendanceDate <= getStaffAttendance.EndDate).ToListAsync();

            if (academicYear != null)
            {
                attendances = attendances.Where(x => x.AcademicYearId == academicYear.AcademicYearId).ToList();
            }
            attendances.ForEach(x => x.AttendanceTypeDescription = EnumHelperService.GetDescription(x.AttendanceType));
            return(attendances);
        }
Ejemplo n.º 20
0
        public async Task <IActionResult> GetStudentRelievingDetailByIdAsync(int relievingId)
        {
            var loggedInUserInstituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var relieving = await _iMSDbContext.StudentRelievingMappings.Include(s => s.Student).FirstOrDefaultAsync(x => x.Id == relievingId && x.Student.InstituteId == loggedInUserInstituteId);

            if (relieving == null)
            {
                return(Ok(new StudentRelievingManagementResponse()
                {
                    HasError = true, Message = "Student not found", ErrorType = StudentRelievingManagementResponseType.StudentId
                }));
            }
            else
            {
                relieving.StudentRelievingDescription = EnumHelperService.GetDescription(relieving.StudentRelieving);
                return(Ok(relieving));
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Method for fetching the list of week days
        /// </summary>
        /// <returns></returns>
        public List <WeekDaysEnumDetails> GetDaysOfWeek(int instituteId)
        {
            List <WeekDaysEnumDetails> weekDaysEnumDetailsList = new List <WeekDaysEnumDetails>();
            List <WeekDaysEnum>        weekDaysEnumList        = EnumHelperService.GetEnumValuesList <WeekDaysEnum>();

            foreach (WeekDaysEnum weekDay in weekDaysEnumList)
            {
                WeekOff weekOff = _imsDbContext.WeekOffs.FirstOrDefault(x => x.WeekDay == weekDay && x.InstitutionId == instituteId);
                if (weekOff == null)
                {
                    weekDaysEnumDetailsList.Add(new WeekDaysEnumDetails
                    {
                        WeekDaysEnum       = weekDay,
                        WeekDaysEnumString = EnumHelperService.GetDescription(weekDay)
                    });
                }
            }

            return(weekDaysEnumDetailsList);
        }
        /// <summary>
        /// Method for fetching a particular circular/notice by id - RS
        /// </summary>
        /// <param name="currentUserInstituteId"></param>
        /// <param name="noticeId"></param>
        /// <returns></returns>
        public async Task <CircularNoticeAc> GetCircularNoticeByIdAsync(int currentUserInstituteId, int noticeId)
        {
            CircularNotice circularNotice = await _imsDbContext.CircularNotices
                                            .Include(x => x.CircularNoticeRecipients)
                                            .FirstOrDefaultAsync(x => x.InstituteId == currentUserInstituteId && x.Id == noticeId);

            CircularNoticeAc circularNoticeAc = new CircularNoticeAc
            {
                Id                           = circularNotice.Id,
                Description                  = circularNotice.Description,
                Message                      = circularNotice.Message,
                NoticeDate                   = circularNotice.NoticeDate,
                NoticeTo                     = circularNotice.NoticeTo,
                NoticeToString               = EnumHelperService.GetDescription(circularNotice.NoticeTo),
                NoticeType                   = circularNotice.NoticeType,
                NoticeTypeString             = EnumHelperService.GetDescription(circularNotice.NoticeType),
                CircularNoticeRecipientsList = new List <CircularNoticeRecipientAc>()
            };

            List <ApplicationUser> circularNoticeRecipientsList = await _imsDbContext.CircularNoticeRecipients
                                                                  .Where(x => x.CircularNoticeId == noticeId)
                                                                  .Include(x => x.Recipient)
                                                                  .Select(x => x.Recipient)
                                                                  .ToListAsync();

            foreach (CircularNoticeRecipient circularNoticeRecipient in circularNotice.CircularNoticeRecipients)
            {
                circularNoticeAc.CircularNoticeRecipientsList.Add(new CircularNoticeRecipientAc
                {
                    RecipientId         = circularNoticeRecipient.RecipientId,
                    RecipientName       = circularNoticeRecipientsList.FirstOrDefault(x => x.Id == circularNoticeRecipient.RecipientId)?.Name,
                    CircularNoticeId    = circularNotice.Id,
                    RecipientType       = circularNoticeRecipient.RecipientType,
                    RecipientTypeString = EnumHelperService.GetDescription(circularNoticeRecipient.RecipientType)
                });
            }

            return(circularNoticeAc);
        }
Ejemplo n.º 23
0
        public IActionResult GetInitialDataAsync()
        {
            List <string> templateFormats = new List <string>();

            foreach (var format in EnumHelperService.GetEnumValuesList <TemplateFormatEnum>())
            {
                templateFormats.Add(EnumHelperService.GetDescription(format));
            }
            List <string> templateFeatureTypes = new List <string>();

            foreach (var feature in EnumHelperService.GetEnumValuesList <TemplateFeatureEnum>())
            {
                templateFeatureTypes.Add(EnumHelperService.GetDescription(feature));
            }
            List <string> templateTypes = new List <string>();

            foreach (var type in EnumHelperService.GetEnumValuesList <TemplateTypeEnum>())
            {
                templateTypes.Add(EnumHelperService.GetDescription(type));
            }
            return(Ok(new { templateFormats, templateFeatureTypes, templateTypes }));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Method for mapping a list of Chart Of Account to application class's list
        /// </summary>
        /// <param name="chartOfAccountsList"></param>
        /// <returns></returns>
        private List <ChartOfAccountsAC> MapChartOfAccountToApplicationClassList(List <FinanceChartOfAccounts> chartOfAccountsList)
        {
            List <ChartOfAccountsAC> chartOfAccountsAcList = new List <ChartOfAccountsAC>();

            foreach (FinanceChartOfAccounts chartOfAccount in chartOfAccountsList)
            {
                chartOfAccountsAcList.Add(new ChartOfAccountsAC
                {
                    Id                       = chartOfAccount.Id,
                    AccountType              = chartOfAccount.AccountType,
                    AccountTypeName          = EnumHelperService.GetDescription(chartOfAccount.AccountType),
                    AliasName                = chartOfAccount.AliasName,
                    Code                     = chartOfAccount.Code,
                    Description              = chartOfAccount.Description,
                    InstituteId              = chartOfAccount.InstituteId,
                    IsActive                 = chartOfAccount.IsActive,
                    IsParent                 = chartOfAccount.IsParent,
                    Name                     = chartOfAccount.Name,
                    ParentChartOfAccountName = chartOfAccount.ParentChartOfAccount?.Name,
                    ParentGroupId            = chartOfAccount.ParentGroupId
                });
            }
            return(chartOfAccountsAcList);
        }
        /// <summary>
        /// Method for fetching the week offs by academic year id
        /// </summary>
        /// <param name="academicYearId"></param>
        /// <returns></returns>
        public async Task <List <InstituteWeekOffAc> > GetWeekOffsByAcademicYearIdAsync(int academicYearId, ApplicationUser currentUser)
        {
            int currentUserInstituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(currentUser.Id, true);

            List <WeekOff> weekOffsList = await _imsDbContext.WeekOffs.Where(x => x.AcademicYearId == academicYearId && x.InstitutionId == currentUserInstituteId).ToListAsync();

            List <WeekDaysEnum> weekDaysEnumList = EnumHelperService.GetEnumValuesList <WeekDaysEnum>();

            List <InstituteWeekOffAc> weekOffsListAc = new List <InstituteWeekOffAc>();

            foreach (WeekDaysEnum weekDay in weekDaysEnumList)
            {
                weekOffsListAc.Add(new InstituteWeekOffAc
                {
                    AcademicYearId = academicYearId,
                    InstitutionId  = currentUserInstituteId,
                    WeekDay        = weekDay,
                    WeekDayString  = EnumHelperService.GetDescription(weekDay),
                    IsWeekOff      = weekOffsList.Any(x => x.WeekDay == weekDay)
                });
            }

            return(weekOffsListAc);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Method for fetching the student fee details for generating the reports - RS
        /// </summary>
        /// <param name="feeManagementReportQueryAc"></param>
        /// <param name="currentUserInstituteId"></param>
        /// <returns></returns>
        private async Task <List <StudentFeeExcelReportAc> > GetStudentFeeDetailsForReportAsync(FeeManagementReportQueryAc feeManagementReportQueryAc, int currentUserInstituteId)
        {
            List <StudentFeeExcelReportAc> studentFeeExcelReportAcList = new List <StudentFeeExcelReportAc>();

            List <StudentBasicInformation> studentsList = await _imsDbContext.StudentBasicInformation
                                                          .Include(x => x.Religion)
                                                          .Include(x => x.CurrentClass)
                                                          .Include(x => x.SectionMap)
                                                          .Where(x => x.InstituteId == currentUserInstituteId)
                                                          .ToListAsync();

            List <StudentFeeComponent> studentFeeComponentList = await _imsDbContext.StudentFeeComponents
                                                                 .Include(x => x.IndividualOrDiscountFeeComponent)
                                                                 .Include(x => x.StudentFee)
                                                                 .ThenInclude(x => x.StudentFeeComponents)
                                                                 .ToListAsync();

            #region Apply queries

            if (feeManagementReportQueryAc.ReligionId != 0)
            {
                studentsList = studentsList.Where(x => x.ReligionId == feeManagementReportQueryAc.ReligionId).ToList();
            }
            if (feeManagementReportQueryAc.ClassId != 0)
            {
                studentsList = studentsList.Where(x => x.CurrentClassId == feeManagementReportQueryAc.ClassId).ToList();
            }
            if (feeManagementReportQueryAc.SectionId != 0)
            {
                studentsList = studentsList.Where(x => x.SectionId == feeManagementReportQueryAc.SectionId).ToList();
            }
            if (feeManagementReportQueryAc.StudentId != 0)
            {
                studentsList = studentsList.Where(x => x.Id == feeManagementReportQueryAc.StudentId).ToList();
            }

            #endregion

            foreach (StudentBasicInformation studentBasicInformation in studentsList)
            {
                if (studentFeeComponentList.Count == 0)
                {
                    studentFeeExcelReportAcList.Add(new StudentFeeExcelReportAc
                    {
                        AdmissionNumber = studentBasicInformation.AdmissionNumber,
                        RollNumber      = studentBasicInformation.RollNumber,
                        FirstName       = studentBasicInformation.FirstName,
                        LastName        = studentBasicInformation.LastName,
                        IsActive        = studentBasicInformation.IsActive.ToString(),
                        IsArchived      = studentBasicInformation.IsArchived.ToString(),
                        CurrentClass    = studentBasicInformation.CurrentClass?.Name,
                        Section         = studentBasicInformation.SectionMap?.Name,
                        Religion        = studentBasicInformation.Religion?.Name
                    });
                }
                else
                {
                    foreach (StudentFeeComponent studentFeeComponent in studentFeeComponentList)
                    {
                        if (studentFeeComponent.StudentFee.StudentId == studentBasicInformation.Id)
                        {
                            studentFeeExcelReportAcList.Add(new StudentFeeExcelReportAc
                            {
                                AdmissionNumber  = studentBasicInformation.AdmissionNumber,
                                RollNumber       = studentBasicInformation.RollNumber,
                                FirstName        = studentBasicInformation.FirstName,
                                LastName         = studentBasicInformation.LastName,
                                IsActive         = studentBasicInformation.IsActive.ToString(),
                                IsArchived       = studentBasicInformation.IsArchived.ToString(),
                                CurrentClass     = studentBasicInformation.CurrentClass?.Name,
                                Section          = studentBasicInformation.SectionMap?.Name,
                                Religion         = studentBasicInformation.Religion?.Name,
                                FeeComponent     = studentFeeComponent.IndividualOrDiscountFeeComponent.Name,
                                FeeComponentType = EnumHelperService.GetDescription(studentFeeComponent.IndividualOrDiscountFeeComponent.FeeComponentType),
                                Amount           = studentFeeComponent.Amount,
                                Term             = studentFeeComponent.TermOrderId,
                                PaymentDate      = studentFeeComponent.StudentFee.UpdatedOn.ToString("dd-MM-yyyy")
                            });
                        }
                        else
                        {
                            studentFeeExcelReportAcList.Add(new StudentFeeExcelReportAc
                            {
                                AdmissionNumber  = studentBasicInformation.AdmissionNumber,
                                RollNumber       = studentBasicInformation.RollNumber,
                                FirstName        = studentBasicInformation.FirstName,
                                LastName         = studentBasicInformation.LastName,
                                IsActive         = studentBasicInformation.IsActive.ToString(),
                                IsArchived       = studentBasicInformation.IsArchived.ToString(),
                                CurrentClass     = studentBasicInformation.CurrentClass?.Name,
                                Section          = studentBasicInformation.SectionMap?.Name,
                                Religion         = studentBasicInformation.Religion?.Name,
                                FeeComponent     = studentFeeComponent.IndividualOrDiscountFeeComponent.Name,
                                FeeComponentType = EnumHelperService.GetDescription(studentFeeComponent.IndividualOrDiscountFeeComponent.FeeComponentType),
                                Amount           = 0,
                                Term             = 0,
                                PaymentDate      = "-"
                            });
                        }
                    }
                }
            }

            return(studentFeeExcelReportAcList.Distinct().OrderBy(x => x.RollNumber).ThenBy(x => x.FeeComponent).ToList());
        }
        /// <summary>
        /// Method to generate auto sequence data - SS
        /// </summary>
        /// <param name="instituteId">institue id</param>
        /// <param name="typeEnum">type of data</param>
        /// <returns>response</returns>
        public async Task <GenerateAutoSequenceDataResponse> GetAutoSequenceNumberByTypeAndInstituteIdAsync(int instituteId, AutoSequenceGeneratorTypeEnum typeEnum)
        {
            var autoSequence = await _iMSDbContext.AutoSequenceGenerators.Include(s => s.AutoSequenceGeneratorDataTypes)
                               .Include(d => d.Institute).FirstOrDefaultAsync(x => x.InstituteId == instituteId && x.AutoSequenceGeneratorType == typeEnum);

            if (autoSequence == null)
            {
                return new GenerateAutoSequenceDataResponse()
                       {
                           HasValue = false
                       }
            }
            ;
            else
            {
                string value = string.Empty;

                var selected = autoSequence.AutoSequenceGeneratorDataTypes.OrderByDescending(x => x.OrderId).Where(x => x.IsSelected).ToList();
                selected.Reverse();
                for (int i = 0; i < selected.Count; i++)
                {
                    var data = selected[i];
                    switch (data.Name)
                    {
                    case "Institute":
                    {
                        value += autoSequence.Institute.Name.Substring(0, (autoSequence.Institute.Name.Length >= data.Length ? data.Length : autoSequence.Institute.Name.Length));

                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;

                    case "Day":
                    {
                        value += DateTime.UtcNow.DayOfWeek.GetDescription();
                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;

                    case "Month":
                    {
                        value += DateTime.UtcNow.Month;
                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;

                    case "Year":
                    {
                        value += DateTime.UtcNow.Year;
                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;

                    case "Date":
                    {
                        value += DateTime.UtcNow.Day;
                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;

                    case "Text":
                    {
                        value += autoSequence.CustomText.Substring(0, data.Length);
                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;

                    case "Sequence Number":
                    {
                        var count = 0;
                        if (typeEnum == AutoSequenceGeneratorTypeEnum.RollNumber)
                        {
                            count = await _iMSDbContext.StudentBasicInformation.CountAsync();
                        }
                        else if (typeEnum == AutoSequenceGeneratorTypeEnum.RefundNumber)
                        {
                            count = await _iMSDbContext.FeeRefunds.CountAsync();
                        }
                        else if (typeEnum == AutoSequenceGeneratorTypeEnum.ReceiptNumber)
                        {
                            count = await _iMSDbContext.FeeReceipts.CountAsync();
                        }
                        else if (typeEnum == AutoSequenceGeneratorTypeEnum.ChartOfAccountsCode)
                        {
                            count = await _iMSDbContext.FinanceChartOfAccounts.CountAsync();
                        }
                        else
                        {
                            count = await _iMSDbContext.StaffBasicPersonalInformation.CountAsync();
                        }
                        count++;
                        var length = "D" + data.Length;
                        value += count.ToString(length);
                        if ((selected.Count - 1) != i)
                        {
                            value += EnumHelperService.GetDescription(autoSequence.Seperator);
                        }
                    }
                    break;
                    }
                }
                return(new GenerateAutoSequenceDataResponse()
                {
                    HasValue = true, Data = value, Seperator = EnumHelperService.GetDescription(autoSequence.Seperator)
                });
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Method to generate employee id - SS
        /// </summary>
        /// <param name="autoSequence"></param>
        /// <returns></returns>
        private async Task <string> GenerateRefundNumberAsync(AutoSequenceGenerator autoSequence)
        {
            string value    = string.Empty;
            var    selected = autoSequence.AutoSequenceGeneratorDataTypes.OrderByDescending(x => x.OrderId).Where(x => x.IsSelected).ToList();

            selected.Reverse();
            for (int i = 0; i < selected.Count; i++)
            {
                var data = selected[i];
                switch (data.Name)
                {
                case "Institute":
                {
                    value += autoSequence.Institute.Name.Substring(0, (autoSequence.Institute.Name.Length >= data.Length ? data.Length : autoSequence.Institute.Name.Length));
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;

                case "Day":
                {
                    value += DateTime.UtcNow.DayOfWeek.GetDescription();
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;

                case "Month":
                {
                    value += DateTime.UtcNow.Month;
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;

                case "Year":
                {
                    value += DateTime.UtcNow.Year;
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;

                case "Date":
                {
                    value += DateTime.UtcNow.Day;
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;

                case "Text":
                {
                    value += autoSequence.CustomText.Substring(0, data.Length);
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;

                case "Sequence Number":
                {
                    var count = await _iMSDbContext.FeeRefunds.CountAsync();

                    count++;
                    var length = "D" + data.Length;
                    value += count.ToString(length);
                    if ((selected.Count - 1) != i)
                    {
                        value += EnumHelperService.GetDescription(autoSequence.Seperator);
                    }
                }
                break;
                }
            }
            return(value);
        }
        /// <summary>
        /// Method for updating an existing circular/notice - RS
        /// </summary>
        /// <param name="currentUserInstituteId"></param>
        /// <param name="updatedCircularNoticeAc"></param>
        /// <returns></returns>
        public async Task <dynamic> UpdateCircularNoticeAsync(int currentUserInstituteId, CircularNoticeAc updatedCircularNoticeAc, ApplicationUser currentUser)
        {
            CircularNotice existingNotice = await _imsDbContext.CircularNotices.FirstOrDefaultAsync(x => x.Id == updatedCircularNoticeAc.Id && x.InstituteId == currentUserInstituteId);

            if (existingNotice == null)
            {
                return(new { Message = "No notice exists with this id", HasError = true });
            }
            else
            {
                // Update notice
                existingNotice.Message     = updatedCircularNoticeAc.Message;
                existingNotice.Description = updatedCircularNoticeAc.Description;
                existingNotice.NoticeDate  = updatedCircularNoticeAc.NoticeDate;
                existingNotice.NoticeType  = updatedCircularNoticeAc.NoticeType;
                existingNotice.NoticeTo    = updatedCircularNoticeAc.NoticeTo;
                existingNotice.UpdatedById = currentUser.Id;

                _imsDbContext.CircularNotices.Update(existingNotice);
                await _imsDbContext.SaveChangesAsync();

                // Update notice recipients
                List <CircularNoticeRecipient> noticeRecipientMappingsList = await _imsDbContext.CircularNoticeRecipients
                                                                             .Where(x => x.CircularNoticeId == existingNotice.Id).ToListAsync();

                _imsDbContext.CircularNoticeRecipients.RemoveRange(noticeRecipientMappingsList);
                await _imsDbContext.SaveChangesAsync();
                await AddNoticeRecipientsAsync(existingNotice.Id, updatedCircularNoticeAc.CircularNoticeRecipientsList);

                noticeRecipientMappingsList = await _imsDbContext.CircularNoticeRecipients.Include(s => s.Recipient)
                                              .Where(x => x.CircularNoticeId == existingNotice.Id).ToListAsync();

                if (updatedCircularNoticeAc.IsNotificationSendingEnabled)
                {
                    #region Send Mail/Message

                    var tos = new List <EmailAddress>();
                    var messageRecipients = new List <string>();
                    foreach (var user in noticeRecipientMappingsList)
                    {
                        if (!string.IsNullOrEmpty(user.Recipient.Email))
                        {
                            tos.Add(new EmailAddress()
                            {
                                Name = user.Recipient.Name, Address = user.Recipient.Email
                            });
                        }
                        else
                        {
                            messageRecipients.Add(user.Recipient.UserName);
                        }
                    }
                    var emailConfiguration = await _imsDbContext.AdministrationEmailConfigurations.Include(s => s.Institute)
                                             .FirstOrDefaultAsync(x => x.InstituteId == existingNotice.InstituteId);

                    if (emailConfiguration != null)
                    {
                        var    path           = Path.Combine(Directory.GetCurrentDirectory(), "MailTemplates");
                        var    engine         = new RazorLightEngineBuilder().UseFilesystemProject(path).UseMemoryCachingProvider().Build();
                        string resultFromFile = await engine.CompileRenderAsync("NotificationMail.cshtml", new CircularNoticeAc()
                        {
                            InstituteName = updatedCircularNoticeAc.InstituteName, Message = existingNotice.Message
                        });

                        // Send Email
                        var email = new EmailMessage()
                        {
                            Content       = resultFromFile,
                            ToAddresses   = tos,
                            FromAddresses = new List <EmailAddress>()
                            {
                                new EmailAddress()
                                {
                                    Name = emailConfiguration.Institute.Name, Address = emailConfiguration.MailUserName
                                }
                            },
                            Subject = "Notice"
                        };
                        _emailService.SendMail(email);
                    }
                    var recipient = string.Empty;
                    foreach (var user in messageRecipients)
                    {
                        recipient += user;
                        recipient += ",";
                    }
                    // Send SMS
                    await _smsService.SendSms(recipient, existingNotice.Message);

                    #endregion

                    #region Add events for report generation

                    await _eventManagementRepository.AddEventReportInfoAsync(currentUserInstituteId, updatedCircularNoticeAc.Description,
                                                                             EnumHelperService.GetDescription(updatedCircularNoticeAc.NoticeType), EnumHelperService.GetDescription(updatedCircularNoticeAc.NoticeTo), TemplateFormatEnum.Email);

                    await _eventManagementRepository.AddEventReportInfoAsync(currentUserInstituteId, updatedCircularNoticeAc.Description,
                                                                             EnumHelperService.GetDescription(updatedCircularNoticeAc.NoticeType), EnumHelperService.GetDescription(updatedCircularNoticeAc.NoticeTo), TemplateFormatEnum.Sms);

                    #endregion
                }

                // Add notification
                await AddNotificationsAsync(currentUserInstituteId, currentUser, updatedCircularNoticeAc);

                return(new { Message = EnumHelperService.GetDescription(existingNotice.NoticeType) + " updated successfully" });
            }
        }
Ejemplo n.º 30
0
        public async Task <IActionResult> GetInitialDataForReportsAsync()
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            var classes = await _iMSDbContext.InstituteClasses.Where(x => x.InstituteId == instituteId).ToListAsync();

            var sections = await _iMSDbContext.Sections.Where(x => x.InstituteId == instituteId).ToListAsync();

            var religions = await _iMSDbContext.Religions.Where(x => x.InstituteId == instituteId).ToListAsync();

            var academicYears = await _iMSDbContext.InstituteAcademicYears.Where(x => x.InstituteId == instituteId).ToListAsync();

            var genders = await _iMSDbContext.Genders.Where(x => x.InstituteId == instituteId).ToListAsync();

            var students = await _iMSDbContext.StudentBasicInformation.Include(s => s.CurrentClass).Include(s => s.Religion)
                           .Include(s => s.Gender).Where(x => x.InstituteId == instituteId).ToListAsync();

            var currentYear = academicYears.FirstOrDefault(x => x.IsActive);

            if (currentYear != null)
            {
                students = students.Where(x => x.CurrentAcademicYearId == currentYear.Id).ToList();
            }
            var studentIds  = students.Select(s => s.Id).Distinct().ToList();
            var attendances = await _iMSDbContext.StudentAttendances.Where(x => studentIds.Contains(x.StudentId)).ToListAsync();

            if (currentYear != null)
            {
                attendances = attendances.Where(x => x.AcademicYearId == currentYear.Id).ToList();
            }
            attendances.ForEach(x => x.AttendanceTypeDescription = EnumHelperService.GetDescription(x.AttendanceType));
            var classSubjectMappings = await _iMSDbContext.InstituteClassSubjectMappings.Where(x => x.InstituteClass.InstituteId == instituteId).ToListAsync();

            var staffs = await _iMSDbContext.StaffBasicPersonalInformation.Where(x => x.InstituteId == instituteId).ToListAsync();

            var notices = await _iMSDbContext.CircularNotices.Include(s => s.CreatedBy)
                          .Where(x => x.InstituteId == instituteId && x.NoticeTo == NoticeToEnum.AllStudents).ToListAsync();

            foreach (var notice in notices)
            {
                notice.CircularNoticeRecipients = await _iMSDbContext.CircularNoticeRecipients.Include(s => s.Recipient)
                                                  .Where(x => x.CircularNoticeId == notice.Id).ToListAsync();
            }
            var examScores = await _iMSDbContext.ExamScoreEntrys.Include(s => s.Exam).Where(x => x.Student.InstituteId == instituteId).ToListAsync();

            var exams = await _iMSDbContext.ExamDefinitions.Where(x => x.InstituteId == instituteId).ToListAsync();

            var classExams = await _iMSDbContext.ClassExams.Where(x => x.Class.InstituteId == instituteId).ToListAsync();

            var allowedDates = await GetAttendanceDaysAsync(instituteId);

            return(Ok(new
            {
                classes,
                sections,
                religions,
                academicYears,
                genders,
                students,
                attendances,
                classSubjectMappings,
                staffs,
                notices,
                examScores,
                exams,
                classExams,
                allowedDates
            }));
        }