public List <Artist> SearchArtist(string name, SearchEnum type) { var responseService = _searchService.Search(name, type.ToString()); var arrItem = ((ArtistSearch)responseService).artists.items; List <Artist> listArtista = new List <Artist>(); for (int i = 0; i < arrItem.Length; i++) { var alb = new ArtistBusiness(); Artist artist = new Artist() { name = arrItem[i].name, id = arrItem[i].id, type = arrItem[i].type, genres = arrItem[i].genres, popularity = arrItem[i].popularity, images = ImageMapper.ImageMapping(arrItem[i].images) }; listArtista.Add(artist); } return(listArtista); }
public List <Track> SearchTrack(string name, SearchEnum type) { var responseService = _searchService.Search(name, type.ToString()); var arrItem = ((TrackSearch)responseService).tracks.items; List <Track> listTrack = new List <Track>(); for (int i = 0; i < arrItem.Length; i++) { var trackFeatures = _searchService.TrackFeatures(arrItem[i].id); Track track = new Track() { name = arrItem[i].name, id = arrItem[i].id, trackLength = arrItem[i].duration_ms, albumName = arrItem[i].album.name, artistName = arrItem[i].artists[0].name, previewUrl = arrItem[i].preview_url, favorite = false, type = arrItem[i].type, images = ImageMapper.ImageMapping(arrItem[i].album.images), }; track.TrackMapping(trackFeatures); listTrack.Add(track); } return(listTrack); }
public List <Album> SearchAlbum(string name, SearchEnum type) { var responseService = _searchService.Search(name, type.ToString()); var arrItem = ((AlbumSearch)responseService).albums.items; List <Album> listAlbum = new List <Album>(); for (int i = 0; i < arrItem.Length; i++) { var tr = new AlbumBusiness(); Album album = new Album() { name = arrItem[i].name, id = arrItem[i].id, type = arrItem[i].album_type, totalTracks = arrItem[i].total_tracks, albumArtist = arrItem[i].artists[0].name, images = ImageMapper.ImageMapping(arrItem[i].images) }; listAlbum.Add(album); } return(listAlbum); }
Vector2 GetDirection(SearchEnum e) { switch (e) { case SearchEnum.UP: return(Vector2.up); case SearchEnum.UP_RIGHT: return(Vector2.up + Vector2.right); case SearchEnum.RIGHT: return(Vector2.right); case SearchEnum.DOWN_RIGHT: return(Vector2.right + Vector2.down); case SearchEnum.DOWN: return(Vector2.down); case SearchEnum.DOWN_LEFT: return(Vector2.down + Vector2.left); case SearchEnum.LEFT: return(Vector2.left); case SearchEnum.UP_LEFT: return(Vector2.up + Vector2.left); default: return(Vector2.zero); } }
public List <object> GetTermSearchResults(IAppDomainRequest e, SearchEnum type, string term) { string urlTest = null; GetSearchResponse dataDomainResponse = null; try { List <object> result = new List <object>(); IRestClient client = new JsonServiceClient(); //[Route("/{Context}/{Version}/{ContractNumber}/Search/{Type}/{Term}", "GET")] var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Search/{4}/", _ddSearchServiceUrl, "NG", e.Version, e.ContractNumber, type), e.UserId); url = url + "&Term=" + term; dataDomainResponse = client.Get <GetSearchResponse>(url); switch (type) { case SearchEnum.Medication: { if (dataDomainResponse.MedResults != null) { result = dataDomainResponse.MedResults.ConvertAll(s => new TextValuePair { Text = s.Text, Value = s.Value }).ToList <object>(); } break; } case SearchEnum.Allergy: { if (dataDomainResponse.AllergyResults != null) { try { result = dataDomainResponse.AllergyResults.ToList <object>(); } catch (Exception ex) { throw new Exception("AllergyResults tolist() failed.", ex.InnerException); } } break; } } return(result); } catch (WebServiceException ex) { throw new Exception("AD:SearchEndpointUtil:GetTermSearchResults():: url:" + urlTest + " message:" + dataDomainResponse.Status.Message + " trace:" + ex.StackTrace, ex.InnerException); } }
public SearchRadForm(SearchEnum search, NewInvoiceRadForm actual) { InitializeComponent(); this._seachForm = search; this._serviceCustomerBL = new CustomerBL(); this._serviceProductBL = new ProductBL(); listOfCustomer = new List <Sp_GetCustomerByParam>(); listOfProduct = new List <ProductToSearch>(); this._actualFormParent = actual; }
/// <summary>指定字段的搜索方式 返回搜索的字符串 /// 指定字段的搜索方式 并且可以给字段加权 /// </summary> /// <param name="searchEnum">搜索方式</param> /// <param name="filed">搜索的字段</param> /// <param name="FiledWeight">如果给字段加权 那么权重范围是0~65535之间数字 默认为1</param> /// <returns></returns> public static string GetFiledSearch(SearchEnum searchEnum, string filed, int FiledWeight) { StringBuilder searchFiledSb = new StringBuilder(); searchFiledSb.Append(filed); if (FiledWeight != 1) { searchFiledSb.Append("^"); searchFiledSb.Append(FiledWeight); } searchFiledSb.Append(" "); searchFiledSb.Append(searchEnum); return(searchFiledSb.ToString()); }
void SearchTarget() { // Get all enums System.Array a = System.Enum.GetValues(typeof(SearchEnum)); // Select random enum SearchEnum value = (SearchEnum)a.GetValue(UnityEngine.Random.Range(0, a.Length)); // Get the appropiate direction. Vector2 direction = GetDirection(value) * movementLength; Vector3 basePosition = this.transform.position; Vector3 target = basePosition + new Vector3(direction.x, 0, direction.y); agent.destination = target; }
public ISearch GetSearchProvider(SearchEnum searchEnum) { switch (searchEnum) { case SearchEnum.Google: { return(new GoogleSearch()); } case SearchEnum.Bing: { return(new BingSearch()); } default: { return(null); } } }
public async Task <IActionResult> Get(string queryString, string url, SearchEnum searchProvicer) { if (string.IsNullOrEmpty(queryString) || string.IsNullOrEmpty(url)) { return(BadRequest("QueryString or Url should not be empty.")); } var cacheKey = queryString.ToLower() + "_" + url.ToLower() + "_" + searchProvicer.ToString().ToLower(); // TODO : Ideally will use distributed caching like REDIS provided by AWS ElastiCache instead of in memory cache. if (!_memoryCache.TryGetValue(cacheKey, out string rank)) { rank = await _searchFactory.GetSearchProvider(searchProvicer).Search(queryString, url); var cacheExpirationOption = new MemoryCacheEntryOptions { AbsoluteExpiration = DateTime.Now.AddHours(1) }; _memoryCache.Set(cacheKey, rank, cacheExpirationOption); } return(Ok(rank.Split(','))); }
public List<object> GetTermSearchResults(GetSearchRequest request, SearchEnum type) { try { List<object> result = null; switch (type) { case SearchEnum.Medication: { result = MedNameStrategy.Search(request.Term).Select(s => s).ToList<object>(); break; } case SearchEnum.Allergy: { if (AllergyStrategy == null) throw new ArgumentException("Allergystrategy is null."); var matched = AllergyStrategy.SearchComplex(request.Term, "Name"); if (matched != null) { result = matched.Select(s => s).ToList<object>(); } break; } } return result; } catch (Exception ex) { FileLog.LogMessageToFile("SearchDD:GetTermSearchResults()::" + ex.Message + " trace:" + ex.StackTrace); throw new Exception("SearchDD:GetTermSearchResults()::" + ex.Message, ex.InnerException); } }
public OperateResult GetMerberCardInfo(string value, SearchEnum type = SearchEnum.MC_ID) { var model = Find(e => e.MC_ID == Convert.ToInt32(value)); if (type == SearchEnum.MC_CardID) { model = Find(e => e.MC_CardID == value); } if (model == null) { return(new OperateResult(false, "当前会员未找到", null)); } var viewModel = new MerberCardEditViewModel() { Id = model.MC_ID, CardLevelId = (int)model.CL_ID, BirthdayType = (byte)model.MC_BirthdayType, BirthdayDay = (int)model.MC_Birthday_Day, BirthdayMonth = (int)model.MC_Birthday_Month, IsPast = Convert.ToBoolean(model.MC_IsPast), IsPointAuto = Convert.ToBoolean(model.MC_IsPointAuto), Point = (int)model.MC_Point, CardId = model.MC_CardID, Mobile = model.MC_Mobile, Money = (decimal)model.MC_Money, Sex = (SexTypeEnum)model.MC_Sex, CardState = (CardStateTypeEnum)model.MC_State, RefererCard = model.MC_RefererCard, Password = model.MC_Password, PastTime = (DateTime)model.MC_PastTime, Name = model.MC_Name }; return(new OperateResult(true, "", viewModel)); }
public CarDateCreatedSearch(DateTime value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public IActionResult GetAlbum(string name, SearchEnum type = SearchEnum.Album) { var response = _searchBusiness.SearchAlbum(name, type); return(Ok(response)); }
public IActionResult GetTrack(string name, SearchEnum type = SearchEnum.Track) { var response = _searchBusiness.SearchTrack(name, type); return(Ok(response)); }
public CarPriceSearch(decimal value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarExtrasSearch(List <int> value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarModelIDSearch(List <int> value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarModelIDSearch(int value, SearchEnum searchType) : this(new List <int>() { value }, searchType) { }
public CarGearboxIDSearch(int value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarHorsePowerSearch(int value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarKilometersSearch(int value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarColourSearch(int value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public NameSearch(string value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarEngineSearch(int value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }
public CarConditionSearch(CarContitionModel value, SearchEnum searchType) { this.Value = value; this.SearchType = searchType; }