Example #1
0
        //Create search
        public static WebResult <SearchDTO> Create(SearchDTO searchDTO, string passwordUser)
        {
            using (ProjectEntities db = new ProjectEntities())
            {
                searchDTO.dateEnd   = searchDTO.dateEnd.Value.AddDays(1);
                searchDTO.dateStart = searchDTO.dateStart.Value.AddDays(1);
                searchDTO.status    = CheckStatus(searchDTO);

                try
                {
                    searchDTO.codeUser = db.Users.FirstOrDefault(f => f.passwordUser == passwordUser).codeUser;
                    db.Searches.Add(SearchCast.GetSearch(searchDTO));
                    db.SaveChanges();
                    return(new WebResult <SearchDTO>
                    {
                        Message = "יצירת חיפוש בוצעה בהצלחה",
                        Status = true,
                        Value = searchDTO
                    });
                }
                catch (Exception e)
                {
                    return(new WebResult <SearchDTO>()
                    {
                        Message = e.Message,
                        Status = false,
                        Value = null
                    });
                }
            }
        }
Example #2
0
        public async Task <ActionResult <IEnumerable <Customer> > > Search([FromBody] SearchDTO body)
        {
            if (body == null)
            {
                return(BadRequest("Invalid body."));
            }

            IEnumerable <Customer> response = null;

            try
            {
                response = await _business.Search(body.CustomerName, body.VehicleId, body.Status);

                if (response == null || response.Count() <= 0)
                {
                    return(NoContent());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest($"Unexpected error: {ex.Message}"));
            }


            return(Ok(response));
        }
        public async Task <PagedQuery <IdentityResourceDTO> > SearchAsync(SearchDTO search)
        {
            var query = from ir in IdentityResources
                        .Include(c => c.UserClaims)
                        orderby ir.Name
                        select ir;

            if (!string.IsNullOrWhiteSpace(search.Search))
            {
                query = from obj in query
                        where obj.Name.Contains(search.Search)
                        orderby obj.Name
                        select obj;
            }

            var items = await query.Select(s => s.ToDTO()).ToListAsync();

            var result = new PagedQuery <IdentityResourceDTO>
            {
                Count = search.Count,
                Items = items,
                Start = search.Start,
                Total = items.Count()
            };

            return(result);
        }
Example #4
0
 public IList <SearchDTO> GetAllHashTag(string searchString, Guid Userid)
 {
     if (searchString != null && searchString != "")
     {
         IList <SearchDTO> resultList = new List <SearchDTO>();
         SearchDTO         getAllTags;
         IList <Tag>       tag = DBContext.Tag.Where(de => de.TagName.Contains(searchString)).ToList();
         if (tag.Count > 0)
         {
             foreach (var item in tag)
             {
                 getAllTags = new SearchDTO();
                 tweetDBContext.updateSearchCount(item);
                 IList <Tweet> tweet = DBContext.Tweet.Where(dr => dr.ID == item.TweetID).ToList();
                 foreach (var item1 in tweet)
                 {
                     User user1 = DBContext.User.Where(dw => dw.ID == item1.UserID).FirstOrDefault();
                     getAllTags.Message   = item1.Message;
                     getAllTags.CreatedAt = item1.CreatedAt;
                     getAllTags.UserName  = user1.FirstName + user1.LastName;
                 }
                 resultList.Add(getAllTags);
             }
             return(resultList);
         }
         else
         {
             throw new Exceptions.TagNotExist("Tag Not Exists");
         }
     }
     else
     {
         return(null);
     }
 }
Example #5
0
        public string Post(SearchDTO searchDTO)
        {
            var    ListResult = _IMASRepository.Get(searchDTO.searchValue.ToLower());
            string result     = JsonConvert.SerializeObject(ListResult);

            return(result);
        }
        //public ActionResult<List<CarModels>> SearchForCars(SearchDTO car)
        public ActionResult <List <CarModels> > SearchForCars(SearchDTO car)
        {
            List <CarModels> cars         = _context.CarsModels.ToList();
            List <CarModels> searchResult = new List <CarModels>();

            DateTime dateFrom = DateTime.Parse(car.DateFrom);
            DateTime dateTo   = DateTime.Parse(car.DateTo);

            if (car.Name)
            {
                //searchResult = _context.CarsModels.Where(x => (x.Ime == car.SearchText && Int32.Parse(x.Cena) <= car.Price && DateTime.Parse(x.DatumOd) >= car.DateFrom && DateTime.Parse(x.DatumDo) <= car.DateTo && x.Rezervisan == false)).ToList();
                cars.ForEach(x =>
                {
                    if (x.Ime == car.SearchText && Int32.Parse(x.Cena) >= car.Price && DateTime.Parse(x.DatumOd) >= dateFrom && DateTime.Parse(x.DatumDo) <= dateTo && x.Rezervisan == false)
                    {
                        searchResult.Add(x);
                    }
                });
            }
            else
            {
                cars.ForEach(x =>
                {
                    if (x.Lokacija == car.SearchText && Int32.Parse(x.Cena) <= car.Price && (DateTime.Now - DateTime.Parse(x.DatumOd)).TotalMilliseconds >= (DateTime.Now - dateFrom).TotalMilliseconds && (DateTime.Now - DateTime.Parse(x.DatumDo)).TotalMilliseconds <= (DateTime.Now - dateTo).TotalMilliseconds && x.Rezervisan == false)
                    {
                        searchResult.Add(x);
                    }
                });
            }

            return(searchResult);
        }
Example #7
0
        public HomeViewModel(SearchDTO searchResult, List <Movie> savedList)
        {
            MovieList = searchResult
                        .Search.Select(x => new Movie
            {
                imdbId  = x.imdbID,
                Title   = x.Title,
                Poster  = x.Poster,
                Actors  = x.Actors,
                Plot    = x.Plot,
                Year    = x.Year,
                ratings = x.Ratings
            }).ToList();

            for (int i = 0; i < MovieList.Count; i++)
            {
                for (int j = 0; j < savedList.Count; j++)
                {
                    if (MovieList[i].imdbId == savedList[j].imdbId)
                    {
                        MovieList[i].numberOfLikes    = savedList[j].numberOfLikes;
                        MovieList[i].numberOfDislikes = savedList[j].numberOfDislikes;
                    }
                    else if (j == savedList.Count)
                    {
                        MovieList[i].numberOfLikes    = 0;
                        MovieList[i].numberOfDislikes = 0;
                    }
                    MovieList[i] = FixNAValues(MovieList[i]);
                }
            }
        }
Example #8
0
        public Task <IEnumerable <ScoreboardViewModel> > SearchTargets([FromQuery] SearchDTO search)
        {
            // ha egy usernek több countryja lesz, itt majd ScoreboardViewModel helyett olyat kell odaadni ami country nevet ad, nem usert
            int userId = int.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            return(gameService.SearchTargetsAsync(search, userId));
        }
        public IHttpActionResult RunSearch([FromBody] JObject data)
        {
            SearchDTO searchDTO    = data["search"].ToObject <SearchDTO>();
            string    passwordUser = data["passwordUser"].ToObject <string>();

            return(Ok(Searches.Create(searchDTO, passwordUser)));
        }
Example #10
0
        public IEnumerable <Product> Search([FromBody] SearchDTO searchDto)
        {
            var query = Context.Products.Include(p => p.AdditionalPropsValues)
                        .Where(p =>
                               (searchDto.Name == null || p.Name.Contains(searchDto.Name)) &&
                               (searchDto.Detail == null || p.Detail.Contains(searchDto.Detail)) &&
                               (searchDto.Price == null || p.Price == searchDto.Price) &&
                               (searchDto.CategoryId == null || p.CategoryId == searchDto.CategoryId)
                               );
            var props = searchDto.Props;

            if (props == null || props.Count == 0)
            {
                return(query.ToList());
            }


            var keys   = props.Keys.ToList();
            var values = props.Values.ToList();

            query = query.Where(p =>
                                p.AdditionalPropsValues.Any(prop =>
                                                            keys.Contains(prop.AdditionalPropsId) &&
                                                            values.Contains(prop.Value)
                                                            )
                                );

            return(query.ToList());
        }
        public IEnumerable <MovieDTO> GetMoviesBySearchModel(SearchDTO search)
        {
            List <MovieDTO> movies = new List <MovieDTO>();

            try
            {
                MySqlCommand command = GetCommandFromSearchModel(search);
                command.Connection = _conn;

                _conn.Open();

                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    movies.Add(GetMovieFromReader(reader));
                }
                _conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                _conn.Close();
                throw;
            }
            return(movies);
        }
Example #12
0
        public async Task <PagedQuery <RoleDTO> > SearchRole(SearchDTO search)
        {
            var query = from obj in Roles select obj;

            if (!string.IsNullOrWhiteSpace(search.Search))
            {
                var _s = search.Search;
                query = from obj in query
                        where obj.Name.Contains(_s)
                        select obj;
            }

            int total = query.Count();
            var roles = await query.Skip(search.Start).Take(search.Count).ToArrayAsync();

            var result = new PagedQuery <RoleDTO>
            {
                Start  = search.Start,
                Count  = search.Count,
                Total  = total,
                Items  = roles.Select(i => i.ToDTO()),
                Search = search.Search
            };

            return(result);
        }
Example #13
0
    private void search()
    {
        string           serchKey   = Request.Params["searchKey"];
        List <SearchDTO> searchList = new List <SearchDTO>();
        DataTable        dt         = AjaxService.searchName(serchKey);

        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 10 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["SKUName"] + "";
                sDTO.SearchVal = dt.Rows[i]["SKUCode"] + "";
                sDTO.Src       = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type      = "product";
                searchList.Add(sDTO);
            }
        }
        dt = AjaxService.searchBrand(serchKey);
        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 20 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["SKUBrand"] + "";
                sDTO.SearchVal = dt.Rows[i]["SKUBrand"] + "";
                //   sDTO.Src = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type = "Brand";
                searchList.Add(sDTO);
            }
        }
        dt = AjaxService.searchSubCat(serchKey);
        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 10 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["CategoryTypeUrlName"] + "";
                sDTO.SearchVal = dt.Rows[i]["CategoryTypeID"] + "";
                // sDTO.Src = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type = "category";
                searchList.Add(sDTO);
            }
        }

        dt = AjaxService.searchPType(serchKey);
        if (!CommonUtil.DT.isEmptyOrNull(dt))
        {
            for (int i = 0; i <= 10 && i < dt.Rows.Count; i++)
            {
                SearchDTO sDTO = new SearchDTO();
                sDTO.Name      = dt.Rows[i]["SKUProductType"] + "";
                sDTO.SearchVal = dt.Rows[i]["ProductTypeID"] + "";
                //sDTO.Src = dt.Rows[i]["PathInternaldetailsSmallImage"] + "";
                sDTO.Type = "subcategory";
                searchList.Add(sDTO);
            }
        }
        sendResponse(searchList);
    }
Example #14
0
        public ActionResult Index([Bind(Include = "Id,AirportFromId,AirportToId,DepartureDate,ReturnDate,NumOfPassengers,CurrencyId")] SearchDTO searchDTO)
        {
            searchDTO.AirportFrom = aps.GetAirportById(searchDTO.AirportFromId);
            searchDTO.AirportTo   = aps.GetAirportById(searchDTO.AirportToId);
            searchDTO.Currency    = cs.GetCurrencyById(searchDTO.CurrencyId);

            if (ModelState.IsValid)
            {
                try
                {
                    List <FlightDTO> flights = fs.FindFlights(searchDTO);
                    return(View("Results", flights));
                }
                catch
                {
                    //neki mehanizam logiranja grešaka, npr:
                    //Logger.Log(e.StackTrace, ...)

                    //namapirati greške u neke user-friendly poruke i vratiti poruku u View


                    return(View("Error"));
                }
            }

            ViewBag.AirportFromId = new SelectList(aps.MapAirportsToDTO().AsEnumerable(), "Id", "Iata");
            ViewBag.AirportToId   = new SelectList(aps.MapAirportsToDTO().AsEnumerable(), "Id", "Iata");
            ViewBag.CurrencyId    = new SelectList(cs.MapCurrenciesToDTO().AsEnumerable(), "Id", "Code");
            return(View());
        }
        public async Task <PagedQuery <ApiResourceDTO> > SearchAsync(SearchDTO search)
        {
            var query = from api in Apis
                        .Include(x => x.UserClaims)
                        .Include(o => o.Secrets)
                        .Include(o => o.Scopes)
                        .ThenInclude(s => s.UserClaims)
                        orderby api.Name
                        select api;

            if (!string.IsNullOrWhiteSpace(search.Search))
            {
                query = from obj in query
                        where obj.Name.Contains(search.Search)
                        orderby obj.Name
                        select obj;
            }

            var items = await query.Select(s => s.ToDTO()).ToListAsync();

            var result = new PagedQuery <ApiResourceDTO>
            {
                Count = search.Count,
                Items = items,
                Start = search.Start,
                Total = items.Count()
            };

            return(result);
        }
Example #16
0
        /// <summary>
        /// Get friends of current user
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public IList <FriendDTO> GetFriends(SearchDTO request)
        {
            if (request.Context == null)
            {
                base.AddError("Authenticate failed !");
                return(null);
            }
            try
            {
                var m_friendshipRepository = UnitOfWork.Repository <DB_TB_FRIENDSHIP>();
                var m_friendshipQueryable  = m_friendshipRepository.GetQueryable().Where(a => a.AccountId == request.Context.Id);
                if (!string.IsNullOrEmpty(request.Keyword))
                {
                    m_friendshipQueryable = m_friendshipQueryable.Where(a => a.DB_TB_ACCOUNTS1.ACC_EMAIL.Contains(request.Keyword) ||
                                                                        a.DB_TB_ACCOUNTS1.ACC_FIRSTNAME.Contains(request.Keyword) ||
                                                                        a.DB_TB_ACCOUNTS1.ACC_LASTNAME.Contains(request.Keyword) ||
                                                                        a.DB_TB_ACCOUNTS1.ACC_FIRSTNAME.Contains(request.Keyword) ||
                                                                        a.DB_TB_ACCOUNTS1.ACC_MIDDLENAME.Contains(request.Keyword));
                }
                var m_frship = m_friendshipQueryable.Select(a => new FriendDTO()
                {
                    Email     = a.DB_TB_ACCOUNTS1.ACC_EMAIL,
                    Id        = a.DB_TB_ACCOUNTS1.ACC_SYS_ID,
                    FirstName = a.DB_TB_ACCOUNTS1.ACC_FIRSTNAME,
                    LastName  = a.DB_TB_ACCOUNTS1.ACC_LASTNAME,
                    IsActived = a.DB_TB_ACCOUNTS1.ACC_IS_ACTIVED
                }).ToList();

                return(m_frship);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public async Task <SearchDTO> Get(string q, int from, int size)
        {
            if (string.IsNullOrEmpty(q))
            {
                var noResults = new SearchDTO {
                    Term = "[No Search]"
                };
                return(noResults);
            }

            var response = await _elasticClient.SearchAsync <ProductDTO>(s =>
                                                                         s.Query(sq =>
                                                                                 sq.MultiMatch(mm => mm
                                                                                               .Query(q)
                                                                                               .Fuzziness(Fuzziness.Auto)
                                                                                               )
                                                                                 ).Size(10000).Scroll("5m")
                                                                         );

            var dispDTO = new SearchDTO {
                Term  = q,
                Total = response.Total
            };

            if (response.IsValid)
            {
                dispDTO.Results = response.Documents?.Skip(from).Take(size).ToList();
            }
            else
            {
                _logger.LogError(response.OriginalException, "Problem searching Elasticsearch for term {0}", q);
            }

            return(dispDTO);
        }
Example #18
0
        public List <OrderDTO> GetOrders(SearchDTO request)
        {
            if (request.Context == null)
            {
                base.AddError("Authenticate failed !");
                return(null);
            }

            var m_orderRepository = UnitOfWork.Repository <DB_TB_ORDERS>().GetQueryable();
            var orders            = m_orderRepository.Where(a => a.DB_TB_ORDER_DETAIL.Any(b => b.AccountId == request.Context.Id))
                                    .Select(a => new OrderDTO()
            {
                Title             = a.Title,
                Id                = a.Id,
                CreatedDate       = a.CreatedDate,
                Description       = a.Description,
                LunchDate         = a.LunchDate.Value,
                RestaurantId      = a.RestaurantId,
                RestaurantName    = a.RestaurantId.HasValue? a.DB_TB_RESTAURANT.Name:string.Empty,
                RestaurantAddress = a.RestaurantId.HasValue ? a.DB_TB_RESTAURANT.Address:string.Empty
            }).OrderByDescending(a => a.LunchDate).Skip(request.Skip).Take(request.Take).ToList();


            return(orders);
        }
Example #19
0
        public Task <List <AdUser4> > FindUser(SearchDTO model, string[] roles, SpuContext spucontext)
        {
            return(Task.Run(() =>
            {
                var setup = spucontext.table_setup.FirstOrDefault();
                var adusers = new List <AdUser4>();

                if (roles != null)
                {
                    //if (model.ou == "Staff" | model.ou == "Internet")
                    //{
                    //    if (adusers.Count < 100)
                    //        adusers.AddRange(FindUser(model.ou.ToLower(), "", model.text_search, setup, spucontext));
                    //}
                    //else
                    //{
                    //    foreach (var role in roles)
                    //    {
                    //        if (adusers.Count < 100)
                    //            adusers.AddRange(FindUser(model.ou.ToLower(), role, model.text_search, setup, spucontext));
                    //    }
                    //}
                }
                return adusers.OrderBy(o => o.givenName).ThenBy(o => o.sn).ToList();
            }));
        }
Example #20
0
 //Create search
 public static WebResult <SearchDTO> Create(SearchDTO searchDTO, string passwordUser)
 {
     using (ProjectEntities db = new ProjectEntities())
     {
         try
         {
             searchDTO.codeUser = db.Users.FirstOrDefault(f => f.passwordUser == passwordUser).codeUser;
             db.Searches.Add(SearchCast.GetSearch(searchDTO));
             db.SaveChanges();
             return(new WebResult <SearchDTO>
             {
                 Message = "החיפוש הופעל בהצלחה",
                 Status = true,
                 Value = searchDTO
             });
         }
         catch (Exception e)
         {
             return(new WebResult <SearchDTO>()
             {
                 Message = e.Message,
                 Status = false,
                 Value = null
             });
         }
     }
 }
Example #21
0
        public async Task <PagedQuery <UserDTO> > SearchUser(SearchDTO search)
        {
            var query = from obj in Users
                        .Include(o => o.UserRoles)
                        .ThenInclude(o => o.Role)
                        .Include(o => o.Claims)
                        select obj;

            if (!string.IsNullOrWhiteSpace(search.Search))
            {
                var _s = search.Search;
                query = from obj in query
                        where obj.Email.Contains(_s) || obj.Claims.Any(claim => claim.ClaimValue.Contains(_s)) || obj.UserRoles.Any(s => s.Role.Name.Contains(_s))
                        select obj;
            }

            int total = query.Count();
            var users = await query.Skip(search.Start).Take(search.Count).ToArrayAsync();

            var result = new PagedQuery <UserDTO>
            {
                Start  = search.Start,
                Count  = search.Count,
                Total  = total,
                Items  = users.Select(i => i.ToDTO()),
                Search = search.Search
            };

            return(result);
        }
Example #22
0
        public List <RestaurantDTO> GetRestaurants(SearchDTO request)
        {
            try
            {
                // check authenticate

                if (request.Context == null)
                {
                    base.AddError("Authenticate failed !");
                    return(null);
                }


                var m_restaurantRepository = UnitOfWork.Repository <DB_TB_RESTAURANT>().GetQueryable();
                if (!string.IsNullOrEmpty(request.Keyword))
                {
                    m_restaurantRepository = m_restaurantRepository.Where(a => a.Name.Contains(request.Keyword));
                }
                var m_restaurants = m_restaurantRepository.Where(a => a.DB_TB_ACCOUNT_RESTAURANT.Any(b => b.AccountId == request.Context.Id)).Select(a => new RestaurantDTO()
                {
                    Address    = a.Address,
                    Name       = a.Name,
                    MenuUrl    = a.MenuUrl,
                    Id         = a.Id,
                    Phone      = a.Phone,
                    IsDelivery = a.IsDelivery
                }).ToList();
                return(m_restaurants);
            }
            catch (Exception)
            {
                return(null);
            }
        }
        public async Task <IActionResult> SearchVenueAsync([FromBody] SearchDTO SearchDataDTO)
        {
            Guard.Against.NullItem <SearchDTO>(SearchDataDTO);

            List <VenueInventoryViewModel> searchResult = await _venueService.GetVenueDetailsSearchAsync(SearchDataDTO.FromDate, SearchDataDTO.ToDate, SearchDataDTO.City);

            return(Ok(searchResult));
        }
Example #24
0
        public JsonResult GetRestaurants()
        {
            SearchDTO request = new SearchDTO()
            {
            };
            var result = _Service.GetRestaurants(request);

            return(result.ToJsonResult(result.Data));
        }
Example #25
0
        // GET: Restaurant
        public ActionResult Index()
        {
            SearchDTO request = new SearchDTO()
            {
            };
            var result = _Service.GetRestaurants(request);

            return(View(result.Data));
        }
Example #26
0
        public List <Company> Search(SearchDTO search)
        {
            List <Company> company = _context.Company
                                     .Where(s => search.Keyword
                                            .All(k => s.CompanyName.Contains(k)))
                                     .Include(x => x.Employee).ToList();

            return(company);
        }
Example #27
0
        public async Task <ActionResult> GetUsers(SearchDTO search)
        {
            List <User> users = await _authService.GetUsers(search.SearchCriteriaEmail);

            if (users.Count() == 0)
            {
                return(BadRequest("Usuário não cadastrado"));
            }
            return(Ok(users));
        }
Example #28
0
 public RedisSearch(SearchDTO dto)
 {
     TakeOfStationId  = dto.TakeOfStationId;
     ArrivalStationId = dto.ArrivalStationId;
     TakeOfDate       = dto.TakeOfDate;
     ArrivalDate      = dto.ArrivalDate;
     NumberOfCards    = dto.NumberOfCards;
     MaxCardPrice     = dto.MaxCardPrice;
     RideTypes        = dto.RideTypes;
 }
Example #29
0
        public IActionResult SearchWP([FromBody] SearchDTO model)
        {
            var result = repository.SearchIt(model);

            if (!result.Any())
            {
                return(NoContent());
            }
            return(Ok(result));
        }
Example #30
0
        public IList <SearchDTO> SearchTag([FromBody] SearchModel SearchString)
        {
            SearchDTO Dto = new SearchDTO();

            Dto.UserID       = Guid.Parse(SearchString.UserID);
            Dto.SearchString = SearchString.SearchString;
            IList <SearchDTO> AllResults = searchBusinessContext.SearchAllHashTag(Dto.SearchString, Dto.UserID);

            return(AllResults);
        }
		private void syncResultData (SearchDTO searchDto)
		{
			this.InvokeOnMainThread (delegate {
				if (searchDto != null) {
					if (searchDto.listSpecialistProfile.Count != 0)
						hideNoResultView ();
					else
						showNoResultView ();

					if (this.isNewSearch) {
						specialists = searchDto.listSpecialistProfile; 
					} else {
						foreach (SpecialistProfileInfos speInfo in searchDto.listSpecialistProfile) {
							specialists.Add (speInfo);
						}
					}
				} else { 
					specialists = new List<SpecialistProfileInfos> ();
				}
			
				this.tableView.ReloadData ();
				hideLoading ();

				if (specialists.Count < 2) {
					this.tcNavi.disableFilter ();
				} else {
					this.tcNavi.enableFilter ();
				}
					
				if (searchDto != null && searchDto.isLimitSearchResult) {
					showWarningManyResult (true);
				} else {
					showWarningManyResult (false);
				}

				tcNavi.showTitle (TCLocalizabled.getText ("TextTitleSearchResultSpecialist"));

			});
		}
		public void searchSuccess (TCSearchHelper self, SearchDTO result)
		{
			if (result == null || result.listSpecialistProfile == null || result.listSpecialistProfile.Count <= 0) {
				result = new SearchDTO ();
				result.listSpecialistProfile = new List<SpecialistProfileInfos> (); 
				result.isLimitSearchResult = false;

				this.showNoResultView ();
				
				if (this.searchBar.Text.Equals ("")) {
					this.hideNoResultView ();
				}
				
				this.hideLoading ();
			} else {
				if (!this.searchBar.Text.Equals ("")) {
					this.hideLoading ();
					this.hideNoResultView ();
				}
			}

			syncResultData (result);
		}
        public void Search()
        {
            var dto1 = new SearchDTO("Isis", "Castañeda", "Finantial");
            var dto2 = new SearchDTO("Helenia", "Caro", "Online");
            var dto3 = new SearchDTO("Humberto", "Carmona", "Finantial");

            var query = Coll.Array(dto1, dto2, dto3).AsQueryable();

            var result = query.Search("isis", x => x.Property1).ToList();
            Assert.Equal(1, result.Count());
            Assert.Equal(dto1.Property1, result.First().Property1);

            result = query.Search("isis casta", x => x.Property1 + " " + x.Property2).ToList();
            Assert.Equal(1, result.Count());
            Assert.Equal(dto1.Property1, result.First().Property1);
        }
Example #34
0
		public static SearchDTO parseResponseSearchDTO (string response)
		{
			SearchDTO searchDto = new SearchDTO ();
			List<SpecialistProfileInfos> specialistProfiles = new List<SpecialistProfileInfos> ();

			try {
				Dictionary<string, object> result = JsonConvert.DeserializeObject<Dictionary<string, object>> (response);

				if (result.ContainsKey("ListSpecialistProfile")) {
					DataContractJsonSerializer js = new DataContractJsonSerializer (typeof(List<SpecialistProfileInfos>));
					MemoryStream ms = new MemoryStream (System.Text.UTF8Encoding.UTF8.GetBytes (result["ListSpecialistProfile"].ToString ()));
					List<SpecialistProfileInfos> specInfos = (List<SpecialistProfileInfos>)js.ReadObject (ms);

					foreach (SpecialistProfileInfos specInfo in specInfos) {
						if (specInfo.Account != null && specInfo.SpecialistDetail != null) {
							if (MApplication.getInstance().isLogedIn || MApplication.getInstance().isLoginAfterSearch) {
								specInfo.isLoaded = true;
							}
							specialistProfiles.Add (specInfo);
						}
					}

					ms.Close ();

					searchDto.listSpecialistProfile = specialistProfiles;
				}

				if (result.ContainsKey("IsLimitSearchResult")) {
					searchDto.isLimitSearchResult = (bool)result["IsLimitSearchResult"];
				} else {
					searchDto.isLimitSearchResult = false;
				}
			} catch (Exception ex) {
				#if DEBUG
				Console.Write(ex.Message);
				#endif
				return null;
			} 

			return searchDto;
		}