Пример #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);
            }
        }
Пример #2
0
        private bool IsEducationValid()
        {
            EducationErrors = null;

            if (Educations.Any(p => p.Faculty.IsNullOrWhiteSpace()))
            {
                EducationErrors += "Faculty field must be filled.\r\n";
            }
            if (Educations.Any(p => p.Speciality.IsNullOrWhiteSpace()))
            {
                EducationErrors += "Speciality field must be filled.\r\n";
            }
            if (Educations.Any(p => p.University.IsNullOrWhiteSpace()))
            {
                EducationErrors += "University field must be filled.\r\n";
            }
            if (Educations.Any(p => p.StartDate == default(DateTime)))
            {
                EducationErrors += "StartDate field must be filled.\r\n";
            }
            if (Educations.Any(p => p.EndDate == null))
            {
                EducationErrors += "EndDate field must be filled.\r\n";
            }
            if (Educations.Any(p => p.StartDate != default(DateTime) && p.EndDate != null && p.StartDate > p.EndDate))
            {
                EducationErrors += "Start date must be less than end date field.\r\n";
            }
            if (Projects.GroupBy(x => x.ProjectId).Any(group => group.Count() > 1))
            {
                EducationErrors += "Remove identical projects.\r\n";
            }

            EducationErrors = EducationErrors?.Trim();

            return(EducationErrors == null);
        }