public SearchResultsPage(string searchCriteria)
        {
            InitializeComponent();

            GlobalSearchViewModel = new GlobalSearchViewModel(searchCriteria);
            BindingContext        = GlobalSearchViewModel;

            if (GlobalSearchViewModel.BugsDisplay.Count == 0)
            {
                bugResultLabel.IsVisible = true;
                bugButton.IsVisible      = false;
            }
            else
            {
                ContentView bugsContentView = new CritterContentView();
                bugsContentView.Content.SetBinding(ItemsView.ItemsSourceProperty, "BugsDisplay");

                collectionBugs.Children.Add(bugsContentView);

                bugsHeaderLabel.Text += " (" + GlobalSearchViewModel.BugsDisplay.Count + ")";
            }

            if (GlobalSearchViewModel.FishDisplay.Count == 0)
            {
                fishResultLabel.IsVisible = true;
                fishButton.IsVisible      = false;
            }
            else
            {
                ContentView fishContentView = new CritterContentView();
                fishContentView.Content.SetBinding(ItemsView.ItemsSourceProperty, "FishDisplay");

                collectionFish.Children.Add(fishContentView);

                fishHeaderLabel.Text += " (" + GlobalSearchViewModel.FishDisplay.Count + ")";
            }

            if (GlobalSearchViewModel.VillagersViewModel.VillagersDisplay.Count == 0)
            {
                villagerResultLabel.IsVisible = true;
                villagerButton.IsVisible      = false;
            }
            else
            {
                ContentView villagerContentView = new VillagersContentView(GlobalSearchViewModel.VillagersViewModel);
                villagerContentView.Content.SetBinding(ItemsView.ItemsSourceProperty, "VillagersDisplay");

                collectionVillagers.Children.Add(villagerContentView);

                villagerHeaderLabel.Text += " (" + GlobalSearchViewModel.VillagersViewModel.VillagersDisplay.Count + ")";
            }
        }
Ejemplo n.º 2
0
        public async Task <GlobalSearchViewModel> GetGlobalSearchResult(string Id)
        {
            try
            {
                GlobalSearchViewModel searchResults = await this.BusinessLayer.GlobalSearch(Id);

                return(searchResults);
            }
            catch (Exception ex)
            {
                this.ExceptionLogger.Log(LogLevel.Error, ex);
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public async Task <GlobalSearchViewModel> GlobalSearch(string searchText)
        {
            GlobalSearchViewModel objGlobalSearchViewModel = new GlobalSearchViewModel();
            CompanyViewModel      obj = new CompanyViewModel();
            var objGlobalSearch       = this.GlobalSearchRepository.GlobalSearch(searchText);

            if (objGlobalSearch != null)
            {
                if (objGlobalSearch.Company.Any())
                {
                    objGlobalSearchViewModel.CompanyViewModel = objGlobalSearch.Company.Select(e =>
                                                                                               new CompanyViewModel
                    {
                        CompanyId      = e.AccountId,
                        CompanyName    = e.CompanyName,
                        Phone          = e.Phone,
                        Type           = e.Type,
                        AlternatePhone = e.AlternatePhone,
                        ContactEmailId = e.EmailId,
                        KeyContact     = e.KeyContact ?? 0
                    }).ToList();
                }
                if (objGlobalSearch.Contact.Any())
                {
                    objGlobalSearchViewModel.ContactViewModel = objGlobalSearch.Contact.Select(e =>
                                                                                               new ContactViewModel
                    {
                        ContactId = e.ContactId,
                        FirstName = e.FirstName,
                        LastName  = e.LastName,
                        CompanyId = e.CompanyId,

                        CompanyName     = e.Company != null ? e.Company.CompanyName : string.Empty,
                        ContactTypeId   = e.ContactTypeId,
                        ContactTypeName = e.ContactType != null ? e.ContactType.ContactTypeName : string.Empty,
                        OwnerId         = e.OwnerId,
                        OwnerName       = e.Owner != null ? e.Owner.UserName:string.Empty,
                        Email           = e.EmailId,
                        Phone           = e.Phone,
                        Cell            = e.Cell,
                        // IsKeyContact = e.IsKeyContact,
                        Street      = e.Street,
                        City        = e.City,
                        StateId     = e.ProvinceId,
                        StateName   = e.Province != null ? e.Province.ProvinceName: string.Empty,
                        CountryId   = e.CountryId,
                        CountryName = e.Country != null ? e.Country.CountryName : string.Empty,
                        PostalCode  = e.Postal
                    }).ToList();
                }

                if (objGlobalSearch.Claim.Any())
                {
                    objGlobalSearchViewModel.ClaimViewModel = objGlobalSearch.Claim.Select(e =>
                                                                                           new ClaimViewModel
                    {
                        ClaimId      = e.ClaimId,
                        FileNo       = e.FileNo,
                        ClaimNo      = e.ClaimNo,
                        CompanyId    = e.CompanyId,
                        CompanyName  = e.Company != null ?e.Company.CompanyName:string.Empty,
                        ContactId    = e.ContactId,
                        ContactName  = e.Contact != null ? String.Format("{0} {1}", e.Contact.FirstName, e.Contact.LastName) : string.Empty,
                        ClaimantId   = e.ClaimantId,
                        ClaimantName = e.Claimant != null ? String.Format("{0} {1}", e.Claimant.FirstName, e.Claimant.LastName) : string.Empty,
                        ReceivedDate = e.ReceivedDate.Date.ToString("M/d/yyyy"),
                        AdjusterId   = e.AdjusterId,
                        AdjusterName = e.Adjuster != null ? String.Format("{0} {1}", e.Adjuster.FirstName, e.Adjuster.LastName) : string.Empty,
                        Status       = e.ClaimStatus != null ? e.ClaimStatus.Name : string.Empty
                    }).ToList();
                }
                //ContactViewModel = CopyClass.CopyObject<ContactViewModel>(objGlobalSearch.Contact, new ContactViewModel();
                //ClaimViewModel = CopyClass.CopyObject<ClaimViewModel>(e.Claim, new ClaimViewModel())
            }
            //new GlobalSearchViewModel
            //{
            //   //ClaimId = e.ClaimId,
            //    CompanyViewModel = CopyClass.CopyObject<CompanyViewModel>(e.Company, obj),
            //    ContactViewModel = CopyClass.CopyObject<ContactViewModel>(e.Contact, new ContactViewModel()),
            //    ClaimViewModel = CopyClass.CopyObject<ClaimViewModel>(e.Claim, new ClaimViewModel())
            //    ////FileNo = e.FileNo,
            //   //ClaimNo = e.ClaimNo,
            //   //CompanyId = e.CompanyId,
            //   //CompanyName = e.Company.CompanyName,
            //   //ContactId = e.ContactId,
            //   //ContactName = e.Contact != null ? String.Format("{0} {1}", e.Contact.FirstName, e.Contact.LastName) : string.Empty,
            //   //ClaimantId = e.ClaimantId,
            //   //ClaimantName = e.Claimant != null ? String.Format("{0} {1}", e.Claimant.FirstName, e.Claimant.LastName) : string.Empty,
            //   //ReceivedDate = e.ReceivedDate.Date.ToString("M/d/yyyy"),
            //   //AdjusterId = e.AdjusterId,
            //   //AdjusterName = e.Adjuster != null ? String.Format("{0} {1}", e.Adjuster.FirstName, e.Adjuster.LastName) : string.Empty,
            //   //Status = e.ClaimStatus != null ? e.ClaimStatus.Status : string.Empty

            //});
            return(objGlobalSearchViewModel);
        }
Ejemplo n.º 4
0
        public ActionResult GlobalSearchResults(GlobalSearchViewModel view)
        {
            GlobalSearchViewModel globalSearchvm = new GlobalSearchViewModel(view.SearchTerm);

            return(View(globalSearchvm));
        }