Пример #1
0
        public override async Task InitializeAsync(object navigationData)
        {
            var pop = await _dialogService.OpenLoadingPopup();

            InitDataFilter = await _iDDLService.GetInitDataFilter();

            JobTypeCollection       = InitDataFilter.JobTypeDLL.Cast <object>().ToObservableCollection();
            CategoryCollection      = InitDataFilter.ClassificationDLL.Cast <object>().ToObservableCollection();
            LocationCollection      = InitDataFilter.LocationDDL.Cast <object>().ToObservableCollection();
            PositionCollection      = InitDataFilter.PositionDLL.Cast <object>().ToObservableCollection();
            SkillCollection         = InitDataFilter.SkillsDLL.Cast <object>().ToObservableCollection();
            QualificationCollection = InitDataFilter.QualificationDLL.Cast <object>().ToObservableCollection();
            LicenceCollection       = InitDataFilter.TicketsDLL.Cast <object>().ToObservableCollection();

            dynamic objSearchDifinition = await _candidateExploreService.GetSavedSearchDefinition();

            if (objSearchDifinition["parameter"] != null)
            {
                string[] jobTypeIds = objSearchDifinition["parameter"]["JobTypeIds"].ToString().Split(',');
                JobTypeSelected = new ObservableCollection <object>(JobTypeCollection.Where(x => Array.IndexOf(jobTypeIds, (x as LookupItem).Id) >= 0));

                string[] categoryIds = objSearchDifinition["parameter"]["CategoryIds"].ToString().Split(',');
                CategorySelected = new ObservableCollection <object>(CategoryCollection.Where(x => Array.IndexOf(categoryIds, (x as LookupItem).Id) >= 0));

                string[] locationIds = objSearchDifinition["parameter"]["LocationIds"].ToString().Split(',');
                LocationSelected = new ObservableCollection <object>(LocationCollection.Where(x => Array.IndexOf(locationIds, (x as LookupItem).Id) >= 0));

                string[] positionIds = objSearchDifinition["parameter"]["PositionIds"].ToString().Split(',');
                PositionSelected = new ObservableCollection <object>(PositionCollection.Where(x => Array.IndexOf(positionIds, (x as LookupItem).Id) >= 0));

                string[] skillIds = objSearchDifinition["parameter"]["SkillsIds"].ToString().Split(',');
                SkillSelected = new ObservableCollection <object>(SkillCollection.Where(x => Array.IndexOf(skillIds, (x as LookupItem).Id) >= 0));

                string[] qualificationIds = objSearchDifinition["parameter"]["QualificationsIds"].ToString().Split(',');
                QualificationSelected = new ObservableCollection <object>(QualificationCollection.Where(x => Array.IndexOf(qualificationIds, (x as LookupItem).Id) >= 0));

                string[] licenceIds = objSearchDifinition["parameter"]["TicketLicensesIds"].ToString().Split(',');
                LicenceSelected = new ObservableCollection <object>(LicenceCollection.Where(x => Array.IndexOf(licenceIds, (x as LookupItem).Id) >= 0));
            }
            else
            {
                JobTypeSelected       = new ObservableCollection <object>();
                CategorySelected      = new ObservableCollection <object>();
                LocationSelected      = new ObservableCollection <object>();
                PositionSelected      = new ObservableCollection <object>();
                SkillSelected         = new ObservableCollection <object>();
                QualificationSelected = new ObservableCollection <object>();
                LicenceSelected       = new ObservableCollection <object>();
            }

            await _dialogService.CloseLoadingPopup(pop);
        }
Пример #2
0
        public IActionResult Execute([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]
                                     HttpRequest req,
                                     ILogger log)
        {
            try
            {
                var mapKey = req.Query["key"].FirstOrDefault()?.ToLower();

                var pointsOfInterest = _locations.Where(x => x.RawKey().StartsWith(mapKey + "::")).ToList();

                var hotness = new Hotness();

                var highlights = new List <Highlight>();
                foreach (var poi in pointsOfInterest)
                {
                    var location            = _locations.Single(x => x.Key == poi.Key);
                    var totalAvailableSeats = location.Capacity;
                    var filledSeats         = _capacityService.NumberOfDesksOccupiedForLocation(poi.RawKey());
                    filledSeats = filledSeats > totalAvailableSeats ? totalAvailableSeats : filledSeats;

                    var percentage = (int)Math.Floor((double)filledSeats / (double)totalAvailableSeats * 100);

                    var colorGrade = hotness.Rank(percentage);

                    highlights.Add(new Highlight(poi.ImageLocation, colorGrade));
                }

                var outputBytes = _generator.HighlightMap(mapKey, highlights);

                return(new FileContentResult(outputBytes, "image/jpeg"));
            }
            catch (Exception ex)
            {
                log.LogError(ex.ToString());
                throw;
            }
        }