public async Task <ReadSiteTypesModelResponse> Read() { var invSiteType = await _repo.GetListAsync <InvSiteType>(); var invSiteTypeModels = _autoMapper.Map <List <SiteTypeModel> >(invSiteType); return(new ReadSiteTypesModelResponse { Items = invSiteTypeModels }); }
public async Task <string> GetCurrentCNVersion() { var admGlobalOptions = await _repository.GetListAsync <AdmGlobalOption>(); if (!admGlobalOptions.Any()) { Debug.WriteLine("No admin options found in database."); throw new ApplicationException("No admin options found"); } return(admGlobalOptions.First().CurrentCNVersion); }
public async Task <GetIntegrationMapResponse> GetIntegrationMap(GetIntegrationMapRequest request) { var map = await _repository.FindAsync <AdmIntegrationMap>(request.MapId); if (map == null) { return(null); } var response = _autoMapper.Map <GetIntegrationMapResponse>(map); var appObjects = await _repository.GetListAsync <AppObject>(x => x.IsImportable); response.AvailableAppObjects = _autoMapper.Map <List <AvailableAppObjectViewModel> >(appObjects); return(response); }
public async Task <List <AdmSitesCEPClaimingPercent> > GetAdmSitesCEPClaimingPercent(int admUserID) { var admGlobalOptions = await _repository.GetListAsync <AdmGlobalOption>(); if (!admGlobalOptions.Any()) { Debug.WriteLine("No AdmGlobalOption found in database.", nameof(GetAdmSitesCEPClaimingPercent)); throw new ApplicationException("No AdmGlobalOption found in database"); } var admGlobalOption = admGlobalOptions.First(); var optionList = await _repository.GetListAsync <view_AccCEPRates>(p => p.CEPSchoolOption == (int)admGlobalOption.CEPSchoolOption); return(_autoMapper.Map <List <AdmSitesCEPClaimingPercent> >(optionList)); }
public async Task <GetAdmFroOptionsResponse> GetAdmFroOptions() { var admFroOptions = await _repository.GetListAsync <AdmFroOption>(); var admFroOption = admFroOptions.FirstOrDefault(); if (admFroOption == null) { Debug.WriteLine($"{nameof(OnlineApplicationsLogic)}.{nameof(GetAdmFroOptions)} -> No AdmFroOption found in database"); throw new ApplicationException("No AdmFroOption found"); } var response = _autoMapper.Map <GetAdmFroOptionsResponse>(admFroOption); response.Customizations = await GetCustomizationList(); return(response); }
public async Task <GetFeedingFigureListResponse> GetFeedingFigures() { var data = await _repo.GetListAsync <view_AdmFeedingFigures>(); return(new GetFeedingFigureListResponse { FeedingFigures = _autoMapper.Map <List <FeedingFigure> >(data) }); }
public async Task <GetUserSendBoxMessagesResponse> GetUserSendBoxMessages(int admUserId) { return(new GetUserSendBoxMessagesResponse { SentMessages = (await _repository.GetListAsync <AdmMessagesDetail>(msg => msg.SentByAdmUserID == admUserId)) .OrderByDescending(msg => msg.MessageDate) .Select(msg => new UserMessage { AdmMessageId = msg.AdmMessageID, UserName = msg.AdmUser.FirstName + " " + msg.AdmUser.LastName, SiteDescription = msg.AdmMessage.AdmSite.SiteDescription, GroupName = msg.AdmMessage.AdmUserGroup.GroupName, MessageDate = msg.MessageDate, IsRead = msg.IsRead, IsUrgent = msg.AdmMessage.IsUrgent }) .ToList() }); }
public async Task <GetServingPeriodsResponse> GetServingPeriods() { return(new GetServingPeriodsResponse { ServingPeriods = (await _repository.GetListAsync <AdmServingPeriod>()) .OrderBy(x => x.DisplayOrder) .Select(x => new ServingPeriod() { AdmServingPeriodId = x.AdmServingPeriodID, Description = x.Description, DisplayOrder = x.DisplayOrder, PeriodType = x.PeriodType, ConversionFactor = x.ConversionFactor, Abbreviation = x.Abbreviation, MenuAnalysisType = x.MenuAnalysisType, AssignedSiteIDs = x.AdmSitesServingPeriods.Select(p => p.AdmSiteID).ToList() }) .ToList() }); }
public async Task <GetAdmGlobalOptionsResponse> GetAdmGlobalOptions() { var admGlobalOptions = await _repository.GetListAsync <AdmGlobalOption>(); if (!admGlobalOptions.Any()) { Debug.WriteLine("No admin options found in database."); throw new ApplicationException("No admin options found"); } var result = _autoMapper.Map <GetAdmGlobalOptionsResponse>(admGlobalOptions.FirstOrDefault()); var farOptions = await _repository.GetListAsync <FarOption>(); if (farOptions.Any()) { _autoMapper.Map(farOptions.FirstOrDefault(), result); } result.CepSchoolOptionsItemList.AddRange(GetCepSchoolOptions()); return(result); }
public async Task <GetYearEndProcessSetUpOptionsResponse> GetYearEndProcessSetUpOptions(int admSiteId) { var today = _repository.GetSchoolNow(admSiteId); int currentSchoolYear = today.Year; var options = (await _repository.GetListAsync <AdmYearEndProcessOptions>(p => p.OptionsForTheYear == currentSchoolYear)).FirstOrDefault(); var model = options == null ? await MapFromAdmSitesOption(admSiteId) : _autoMapper.Map <GetYearEndProcessSetUpOptionsResponse>(options); model.hasYearRoundSchool = await IsYearRoundSchoolExist(); return(model); }
public async Task <List <AdmSchoolGroupViewModel> > GetAdmSchoolGroups() { var admSchoolGroups = await _repository.GetListAsync <AdmSchoolGroup>(); return(_autoMapper.Map <List <AdmSchoolGroupViewModel> >(admSchoolGroups)); }
public async Task <List <AdmManagementLevelViewModel> > GetAdmManagementLevels() { var admManagementLevels = await _repository.GetListAsync <AdmManagementLevel>(); return(_autoMapper.Map <List <AdmManagementLevelViewModel> >(admManagementLevels.OrderBy(x => x.ManagementLevelOrder).ToList())); }
/// <summary> /// /// </summary> /// <returns></returns> public async Task <GetJobsResponse> GetJobs() { var results = await _repository.GetListAsync <AdmIntegrationJob>(s => !s.IsDeleted); return(new GetJobsResponse { Jobs = results .OrderBy(o => o.Name) .Select(s => new IntegrationJob { AdmIntegrationJobID = s.AdmIntegrationJobID, Name = s.Name, MapTypeName = Enum.GetName(typeof(IntegrationMapType), s.AdmIntegrationMap.MapType) ?.Replace("_", " "), JobType = s.AdmIntegrationMap.IsImport ? "Import" : "Export", IsDeleted = s.IsDeleted }) .ToList() }); }
public async Task AppViewsAdmUsersPreferencesInit(int admUserId, string id = "") { if (string.IsNullOrWhiteSpace(id)) { bool isNumeric = int.TryParse(id, out _); int admSiteId = Convert.ToInt32(id); if (isNumeric) { var appView = (await _repo.GetListAsync <AppView>(a => a.ControllerName.Equals("Schools") && a.ViewName.Equals("Index") && a.AppObjectID.Equals("Schools"))).FirstOrDefault(); if (appView == null) { return; } var appPreference = appView.AppViewsAdmUsersPreferences.FirstOrDefault(p => p.AppViewID == appView.AppViewID && p.AdmUserID == admUserId); if (appPreference != null) { appPreference.LastViewedID = admSiteId; } else { appView.AppViewsAdmUsersPreferences.Add(new AppViewsAdmUsersPreference { AppViewID = appView.AppViewID, AdmUserID = admUserId, LastViewedID = admSiteId }); } await _repo.UpdateAsync(appView); } } }
public async Task <List <AccP2RateViewModel> > GetAccP2Rates() { var accP2Rates = await _repository.GetListAsync <view_AccP2Rates>(); return(_autoMapper.Map <List <AccP2RateViewModel> >(accP2Rates.OrderBy(x => x.SchoolDescription))); }