/// <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);
        }
        /// <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);
        }
        /// <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);
        }
Esempio n. 4
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 }));
        }
        /// <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);
        }