예제 #1
0
        public Task <SearchContactsResponse> SearchContacts(
            string searchTerms,
            int?numRows       = null,
            string?sort       = null,
            string?recordType = null,
            CancellationToken cancellationToken = default)
        {
            var parameters = new SearchContactsParams(
                searchTerms, numRows, sort, recordType);
            var function = new SearchContacts(parameters);

            return(CallApi <SearchContactsParams, SearchContactsResponse>(
                       function, cancellationToken));
        }
예제 #2
0
 public void Search_Contacts(string text)
 {
     ThreadPool.QueueUserWorkItem((o) =>
     {
         try
         {
             text = text.ToLower();
             SearchContacts.Clear();
             foreach (var c in Contacts)
             {
                 // FIXME: also search phone numbers
                 if (c.Name.ToLower().IndexOf(text) > -1)
                 {
                     SearchContacts.Add(c);
                     continue;
                 }
                 foreach (var p in c.Phones)
                 {
                     if (p.Number.IndexOf(text) > -1)
                     {
                         SearchContacts.Add(c);
                         break;
                     }
                 }
             }
             if (Regex.IsMatch(GoogleVoice.Util.StripNumber(text), "^[0-9|\\+]+$"))
             {
                 text      = GoogleVoice.Util.StripNumber(text);
                 Contact c = new Contact {
                     Name = GoogleVoice.Util.FormatNumber(text)
                 };
                 c.Group = "Dial";
                 c.Phones.Add(new Phone {
                     Number = text, Type = "Unknown"
                 });
                 SearchContacts.Add(c);
             }
         }
         catch (Exception ex)
         {
             Trace.WriteLine("Contacts search: " + ex);
         }
     });
 }
        public IEnumerable<IResult> ExecuteSearch()
        {

            QueryResult<IEnumerable<SearchResult>> search = new SearchContacts
            {
                SearchText = SearchText
            }.AsResult();
            
            yield return Show.Busy();
            yield return search;

            int resultCount = search.Response.Count();

            if (resultCount == 0)
                SearchResults = noResults.WithTitle(SearchText);
            else
            {
                SearchResults = results.With(search.Response);
            }

            yield return Show.NotBusy();

        }
예제 #4
0
        public IEnumerable <IResult> ExecuteSearch()
        {
            QueryResult <IEnumerable <SearchResult> > search = new SearchContacts
            {
                SearchText = SearchText
            }.AsResult();

            yield return(Show.Busy());

            yield return(search);

            int resultCount = search.Response.Count();

            if (resultCount == 0)
            {
                SearchResults = noResults.WithTitle(SearchText);
            }
            else
            {
                SearchResults = results.With(search.Response);
            }

            yield return(Show.NotBusy());
        }
예제 #5
0
        public IActionResult Index([FromQuery] SearchContacts dto, int Type = 0, int EventId = 0)
        {
            dto.Type = Type;
            int           TotalItems     = 0;
            string        ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            ContactsModel data           = new ContactsModel()
            {
                SearchData = dto
            };

            data.ListItems = ContactsService.GetListPagination(data.SearchData, API.Models.Settings.SecretId + ControllerName);
            data.eID       = EventId;

            if (data.ListItems != null && data.ListItems.Count() > 0)
            {
                TotalItems = data.ListItems[0].TotalRows;
            }
            data.Pagination = new Models.Partial.PartialPagination()
            {
                CurrentPage = data.SearchData.CurrentPage, ItemsPerPage = data.SearchData.ItemsPerPage, TotalItems = TotalItems, QueryString = Request.QueryString.ToString()
            };

            return(View(data));
        }