示例#1
0
        public override void ViewAppeared()
        {
            IndexClientName = string.Empty;
            IsRelation      = false;

            base.ViewAppeared();
            var indexJson = _settings.GetValue(nameof(IndexClientDTO), "");

            if (!string.IsNullOrWhiteSpace(indexJson))
            {
                IsRelation     = true;
                IndexClientDTO = JsonConvert.DeserializeObject <IndexClientDTO>(indexJson);
                if (null != IndexClientDTO)
                {
                    MoveNextLabel     = "SAVE";
                    IndexClientName   = $"Relation To Index [{IndexClientDTO}]";
                    Title             = $"Profile [{IndexClientDTO.RelType}]";
                    RelationshipTypes = RelationshipTypes
                                        .Where(x => x.Description.ToLower() == IndexClientDTO.RelType.ToLower()).ToList();
                }
            }

            var preventEnroll = _settings.GetValue("PreventEnroll", "");

            if (!string.IsNullOrWhiteSpace(preventEnroll))
            {
                MoveNextLabel = Convert.ToBoolean(preventEnroll) ? "SAVE" : "NEXT";
            }

            var educationsJson  = _settings.GetValue("lookup.Education", "");
            var completionsJson = _settings.GetValue("lookup.Completion", "");
            var occupationsJson = _settings.GetValue("lookup.Occupation", "");

            if (!string.IsNullOrWhiteSpace(educationsJson) && !Educations.Any())
            {
                Educations = JsonConvert.DeserializeObject <List <CategoryItem> >(educationsJson);
            }

            if (!string.IsNullOrWhiteSpace(completionsJson) && !Completions.Any())
            {
                Completions = JsonConvert.DeserializeObject <List <CategoryItem> >(completionsJson);
            }

            if (!string.IsNullOrWhiteSpace(occupationsJson) && !Occupations.Any())
            {
                Occupations = JsonConvert.DeserializeObject <List <CategoryItem> >(occupationsJson);
            }
        }