Пример #1
0
        public override void LoadFromStore(VMStore modelStore)
        {
            try
            {
                Profile               = JsonConvert.DeserializeObject <ClientProfileDTO>(modelStore.Store);
                Downloaded            = Profile.Downloaded;
                ClientId              = Profile.ClientId;
                SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == Profile.MaritalStatus);
                SelectedKeyPop        = KeyPops.FirstOrDefault(x => x.Id == Profile.KeyPop);
                OtherKeyPop           = Profile.OtherKeyPop;
                SelectedEducation     = Educations.FirstOrDefault(x => x.ItemId == Profile.Education);
                SelectedCompletion    = Completions.FirstOrDefault(x => x.ItemId == Profile.Completion);
                SelectedOccupation    = Occupations.FirstOrDefault(x => x.ItemId == Profile.Occupation);

                if (null != Profile.RelTypeId && !string.IsNullOrWhiteSpace(Profile.RelTypeId))
                {
                    SelectedRelationshipType =
                        RelationshipTypes.FirstOrDefault(x => x.Description.ToLower() == Profile.RelTypeId.ToLower());
                }
            }
            catch (Exception e)
            {
                Mvx.Error(e.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// Selects the best match to what the user typed
        /// </summary>
        /// <remarks>
        /// The steps to determine the best match:
        /// 1. Check if there is a precise match in the builders list
        /// 2. If not - check if there is a precise match in the completions list
        /// 3. If not - look up the closest match in the completions list
        /// </remarks>
        public override void SelectBestMatch()
        {
            string prefix = getPrefix();

            // precise match to a completion builder
            Completion completion = CompletionBuilders.FirstOrDefault(c => c.DisplayText.CompareTo(prefix) == 0);

            // if none - precise match to a completion
            if (completion == null)
            {
                completion = Completions.FirstOrDefault(c => c.DisplayText.CompareTo(prefix) == 0);
            }

            // if none - position the completion list
            if (completion == null)
            {
                completion = Completions.FirstOrDefault(c => c.DisplayText.CompareTo(prefix) >= 0);
            }

            if (completion != null)
            {
                SelectionStatus = new CompletionSelectionStatus(completion,
                                                                completion.DisplayText == prefix,
                                                                true
                                                                );
            }
        }
Пример #3
0
        public override void Start()
        {
            base.Start();
            MaritalStatus = _lookupService.GetMaritalStatuses(true).ToList();
            KeyPops       = _lookupService.GetKeyPops(true).ToList();
            Educations    = _lookupService.GetCategoryItems("Education", true, "[Select Education]").ToList();
            Completions   = _lookupService.GetCategoryItems("Completion", true, "[Select Completion]").ToList();
            Occupations   = _lookupService.GetCategoryItems("Occupation", true, "[Select Occupation]").ToList();

            try
            {
                SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == "");
                SelectedKeyPop        = KeyPops.FirstOrDefault(x => x.Id == "");
                SelectedEducation     = Educations.FirstOrDefault(x => x.Id == Guid.Empty);
                SelectedCompletion    = Completions.FirstOrDefault(x => x.Id == Guid.Empty);
                SelectedOccupation    = Occupations.FirstOrDefault(x => x.Id == Guid.Empty);
            }
            catch {}
        }