/// <summary> /// Get the Store Inventory (Offers) /// </summary> /// <param name="storeName">The name of store to retreive the offers from</param> /// <returns>XMLDocument containing the Store Inventory (Offers)</returns> public XmlDocument GetStoreInventory(string storeName, ResultFilter filter) { XmlDocument response = null; try { PaymentCommand cmd = new PaymentCommand(); cmd.Noun = "Store"; cmd.Verb = "FindStore"; cmd.Parameters.Add("storeName", storeName); cmd.Parameters.Add("itemTypeNames", filter.ItemTypeNames); cmd.Parameters.Add("startIndex", filter.StartIndex); cmd.Parameters.Add("blockSize", filter.BlockSize); response = CallTwoFishService(cmd, MethodBase.GetCurrentMethod()); } catch (Exception ex) { logError("GetStoreInventory", ex); } return(response); }
public void Filter_IsOpen_False() { var filterer = new ResultFilter(); var response = new PlacesResponse() { results = new PlacesResult[] { new PlacesResult() { name = "Name A", opening_hours = new OpeningHours { open_now = false }, rating = 4.8, vicinity = "near by" }, new PlacesResult() { name = "Name B", opening_hours = new OpeningHours { open_now = true }, rating = 4.8, vicinity = "near by" }, } }; var filteredResults = filterer.FilterResults(response, false, null, null); Assert.Equal(1, filteredResults.results.Length); Assert.Equal("Name A", filteredResults.results[0].name); }
public IEnumerable <MenuItem> Search(string queryString, ResultFilter filter = null) { if (queryString != null) { queryString = queryString.Trim(); } if (string.IsNullOrEmpty(queryString)) { yield break; } queryString = Escape(queryString); queryString += "~"; // FuzzyQuery query = new FuzzyQuery(new Term("joe", queryString), 5); // parser.FuzzyMinSim = 10f; Query query = parser.Parse(queryString); manager.MaybeRefreshBlocking(); IndexSearcher searcher = manager.Acquire(); try { TopDocs documents = searcher.Search(query, (filter ?? ResultFilter.Default).Limit > 0 ? filter.Limit : 1); foreach (ScoreDoc scoreDocument in documents.ScoreDocs) { Document document = searcher.Doc(scoreDocument.Doc); yield return(items[document.GetField(DESCRIPTION).GetStringValue()]); } } finally { manager.Release(searcher); searcher = null; } }
void ChangeFilter(object sender, EventArgs e) { switch (CurrentFilter) { case ResultFilter.All: CurrentFilter = ResultFilter.Failed; FilterButton.Image = RemoveSign; break; case ResultFilter.Failed: CurrentFilter = ResultFilter.Ignored; FilterButton.Image = QuestionSign; break; case ResultFilter.Ignored: CurrentFilter = ResultFilter.Success; FilterButton.Image = OkSign; break; case ResultFilter.Success: CurrentFilter = ResultFilter.All; FilterButton.Image = Asterisk; break; } Filter(); }
/// <summary> /// フィルタしたリストを生成する. /// </summary> private void CreateFilterdList() { var addSkill1 = this.cmbAddSkill1.SelectedObj <MasterSkillData>(); var addSkill2 = this.cmbAddSkill2.SelectedObj <MasterSkillData>(); var addSkill3 = this.cmbAddSkill3.SelectedObj <MasterSkillData>(); var skill1Idx = null == addSkill1 ? 0 : addSkill1.Index; var skill2Idx = null == addSkill2 ? 0 : addSkill2.Index; var skill3Idx = null == addSkill3 ? 0 : addSkill3.Index; // 画面の内容からフィルタを生成. var filter = new ResultFilter { NeedBlankSlotLv1 = this.numBlankSlotLv1.Value, NeedBlankSlotLv2 = this.numBlankSlotLv2.Value, NeedBlankSlotLv3 = this.numBlankSlotLv3.Value, NeedSkill1 = new SkillBase(skill1Idx, this.numAddSkill1.Value), NeedSkill2 = new SkillBase(skill2Idx, this.numAddSkill2.Value), NeedSkill3 = new SkillBase(skill3Idx, this.numAddSkill3.Value), }; // フィルタした結果を生成. this.FilterdList = this.ResultList .Where(filter.Filter) .ToList(); // 画面に反映. this.txtbFilterdCount.Text = "{0}件".Fmt(this.FilterdList.Count); this.txtbAllCount.Text = "{0}件".Fmt(this.ResultList.Count); }
/// <summary> /// Get User Inventory /// </summary> /// <param name="userId">userId</param> /// <returns>XML Document containing the user inventory</returns> public XmlDocument GetUserInventory(string userId, ResultFilter filter) { XmlDocument response = null; try { PaymentCommand cmd = new PaymentCommand(); cmd.Noun = "Items"; cmd.Verb = "ItemInstance"; cmd.Parameters.Add("userId", userId); if (String.IsNullOrEmpty(filter.Filter)) { filter.Filter = "all"; } cmd.Parameters.Add("filter", filter.Filter); // cmd.Parameters.Add("itemTypeName", filter.ItemTypeNames); // cmd.Parameters.Add("startIndex", filter.StartIndex); // cmd.Parameters.Add("blockSize", filter.BlockSize); response = CallTwoFishService(cmd, MethodBase.GetCurrentMethod()); int totalItems = 0; XmlNodeList itemInstanceNodes = response.SelectNodes("Response/itemInstances/itemInstance"); if (itemInstanceNodes != null) { totalItems = itemInstanceNodes.Count; } int startIndex = -1; int tempOut = -1; if (int.TryParse(filter.StartIndex, out tempOut)) { startIndex = tempOut; } int blockSize = -1; tempOut = -1; if (int.TryParse(filter.BlockSize, out tempOut)) { blockSize = tempOut; } AddAttribute(response, "/Response/itemInstances", "startIndex", startIndex.ToString()); AddAttribute(response, "/Response/itemInstances", "blockSize", blockSize.ToString()); AddAttribute(response, "/Response/itemInstances", "total", totalItems.ToString()); AddAttribute(response, "/Response/itemInstances", "itemTypeNames", filter.ItemTypeNames); } catch (Exception ex) { response = CreateErrorDoc(ex.Message); logError("GetUserInventory", ex); } return(response); }
/// <summary> /// フィルタを反映. /// </summary> /// <param name="defaultFilter"></param> private void SetResultFilter(ResultFilter defaultFilter) { this.txtbValBlankSlotLv1.Text = defaultFilter.NeedBlankSlotLv1.ToString(); this.txtbValBlankSlotLv2.Text = defaultFilter.NeedBlankSlotLv2.ToString(); this.txtbValBlankSlotLv3.Text = defaultFilter.NeedBlankSlotLv3.ToString(); this.UpdateFilterdCount(); }
public Form_Fitler(string data, ResultFilter resultFilter) { this.data = data; this.resultFilter = resultFilter; tachDuLieu(); kieuDLs = new int[values.Count]; InitializeComponent(); createUI(); }
/// <summary> /// Execute the action, hold the result, and potentially respond. /// </summary> protected override void RunAction() { Result = Action(ConditionParam); if (!ReferenceEquals(null, ResultFilter) && ResultFilter.Equals(Result)) { Response(); } }
public async Task <PlacesResponse> Get([FromQuery] string address, [FromQuery] string cuisine, [FromQuery] string name, [FromQuery] double?rating, [FromQuery] bool?isOpen) { IGoogleApiClient client = new GoogleApiClientFake(); var resultsPriorToFilter = await client.GetFoodNearAddress(cuisine, address); var filter = new ResultFilter(); var resultsAfterFitler = filter.FilterResults(resultsPriorToFilter, isOpen, name, rating); return(resultsAfterFitler); }
public void OnResultExecuting(ResultExecutingContext filterContext) { var metadata = LogCall(OnResultExecutingGuid); var watch = new Stopwatch(); watch.Start(); ResultFilter.OnResultExecuting(filterContext); watch.Stop(); metadata.ExecutionTime = watch.Elapsed; }
public IEnumerable <T> Search(string query, ResultFilter filter = null) { if (query != null) { query = query.Trim().ToLower(); } return(Dataset.Where(t => t != null && !string.IsNullOrEmpty(query) && t.ToString().ToLower().Contains(query))); }
/// <summary> /// Given a PaymentCommand returns the Filter Paramaters specified /// </summary> /// <param name="command">PaymentCommand</param> /// <returns>The Filter Paramaters specified in the Payment Command</returns> public static ResultFilter GetFilterParameters(PaymentCommand command) { ResultFilter resultFilterInfo = new ResultFilter(); resultFilterInfo.ItemTypeNames = GetValue(command.Parameters, "itemTypeNames", ""); resultFilterInfo.StartIndex = GetValue(command.Parameters, "startIndex", ""); resultFilterInfo.BlockSize = GetValue(command.Parameters, "blockSize", ""); resultFilterInfo.Filter = GetValue(command.Parameters, "filter", ""); resultFilterInfo.OrderBy = GetValue(command.Parameters, "orderBy", ""); return(resultFilterInfo); }
/// <summary> /// Retreives the ResultFilter object data from the Parameters Dictionary /// </summary> /// <param name="Parameters"></param> /// <returns>ResultFilter object</returns> private ResultFilter GetResultFilterParamaters(NameValueCollection Parameters) { ResultFilter resultFilterInfo = new ResultFilter(); resultFilterInfo.ItemTypeNames = GetValue(Parameters, "itemTypeNames", ""); resultFilterInfo.StartIndex = GetValue(Parameters, "startIndex", ""); resultFilterInfo.BlockSize = GetValue(Parameters, "blockSize", ""); resultFilterInfo.Filter = GetValue(Parameters, "filter", ""); resultFilterInfo.OrderBy = GetValue(Parameters, "orderBy", ""); return(resultFilterInfo); }
/// <summary> /// コンストラクタ. /// </summary> /// <param name="defaultFilter"></param> /// <param name="resultList"></param> public DlgResultFilter(ResultFilter defaultFilter, List <ResultSet> resultList) { this.ResultList = resultList; InitializeComponent(); this.btnPlusBlankSlotLv1.Tag = this.txtbValBlankSlotLv1; this.btnPlusBlankSlotLv2.Tag = this.txtbValBlankSlotLv2; this.btnPlusBlankSlotLv3.Tag = this.txtbValBlankSlotLv3; this.btnMinusBlankSlotLv1.Tag = this.txtbValBlankSlotLv1; this.btnMinusBlankSlotLv2.Tag = this.txtbValBlankSlotLv2; this.btnMinusBlankSlotLv3.Tag = this.txtbValBlankSlotLv3; this.SetResultFilter(defaultFilter); }
public void OnResultExecuting(ResultExecutingContext filterContext) { var metadata = LogCall(OnResultExecutingGuid); var watch = new Stopwatch(); watch.Start(); using (GlimpseTimer.Start("Executing: Result Filter", "Filter", ResultFilter.GetType().Name)) { ResultFilter.OnResultExecuting(filterContext); } watch.Stop(); metadata.ExecutionTime = watch.Elapsed; }
/// <summary> /// Implements call to Twofish method purchase to retreive the user payment history /// </summary> /// <param name="userId">userId</param> /// <param name="filter">StartIndex, BlockSize</param> /// <param name="commmonKeyValue">Twofish REST service common values</param> /// <param name="baseAddress">Twofish REST service base address</param> /// <returns>XmlDocument document containing the users purchase history</returns> public XmlDocument PurchaseHistory(UserId userId, ResultFilter filter, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress) { ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue); Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(false); keyValues.Add("id", userId.ToString()); if (filter != null) { keyValues.Add("fetchRequest.startIndex", filter.StartIndex); keyValues.Add("fetchRequest.blockSize", filter.BlockSize); } DebugLog("purchase", keyValues); return(rest.GetXMLRequest("purchase", keyValues)); }
/// <summary> /// Implements call to Twofish method itemInstances to retrieve the item instance information for a user and item /// </summary> /// <param name="userId">userId</param> /// <param name="itemsInfo">ItemName, ItemTypeName, IPAddress</param> /// <param name="filter">Filter</param> /// <param name="commmonKeyValue">Twofish REST service common values</param> /// <param name="baseAddress">Twofish REST service base address</param> /// <returns>Twofish XML response document containing item instances information for a user and item</returns> public XmlDocument ItemInstance(UserId userId, ItemsInfo itemsInfo, ResultFilter filter, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress) { ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue); Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true); keyValues.Add("userId", userId.ToString()); keyValues.Add("itemName", itemsInfo.ItemName); keyValues.Add("itemTypeName", itemsInfo.ItemTypeName); keyValues.Add("ipAddress", itemsInfo.IPAddress); keyValues.Add("filter", filter.Filter); keyValues.Add("fetchRequest.startIndex", filter.StartIndex); keyValues.Add("fetchRequest.blockSize", filter.BlockSize); DebugLog("ItemInstance", keyValues); return(rest.GetXMLRequest("itemInstances", keyValues)); }
/// <summary> /// Retrieve all of the store offer for a given store /// </summary> /// <param name="storeName">storeName<storeName/param> /// <param name="filter">ItemTypeNames, MaxRemaining, LatestEndDate, OrderBy, Descending, StartIndex, BlockSize</param> /// <param name="commmonKeyValue">Twofish REST service common values</param> /// <param name="baseAddress">Twofish REST service base address</param> /// <returns>XML doucment containing stores offers</returns> public XmlDocument FindStore(String storeName, ResultFilter filter, CommmonKeyValues commmonKeyValue, BaseAddress baseAddress) { ServiceHandler rest = new ServiceHandler(baseAddress.BaseAddressValue); Dictionary <string, string> keyValues = commmonKeyValue.GetCommmonInfo(true); keyValues.Add("name", storeName); keyValues.Add("itemTypeNames", filter.ItemTypeNames); keyValues.Add("maxRemaining", filter.MaxRemaining); keyValues.Add("latestEndDate", filter.LatestEndDate); keyValues.Add("orderBy", filter.OrderBy); keyValues.Add("descending", filter.Descending); keyValues.Add("fetchRequest.startIndex", filter.StartIndex); keyValues.Add("fetchRequest.blockSize", filter.BlockSize); DebugLog("Store", keyValues); return(rest.GetXMLRequest("store", keyValues)); }
/// <summary> /// Filter, Sort, and Page the Store Inventory /// </summary> /// <param name="response">XML Document response from the GetStoreInventory cached response</param> /// <param name="dataSetResponse">Dataset containing the GetStoreInventory cached response</param> /// <param name="command">PaymentItem Command sent, used to retrieve the Filter, OrderBy, StartIndex and BlockSize parameters</param> /// <returns>xml string response of the filtered, sorted and paged store inventory</returns> public string FilterSortStoreInventoryResponse(XmlDocument response, object dataSetResponse, PaymentCommand command) { ResultFilter resultFilter = PaymentItemsSortFilter.GetFilterParameters(command); string filter = resultFilter.Filter; //"itemOffer_title Like '%basic%'"; string sort = resultFilter.OrderBy; //"itemOffer_endDate desc, item_itemTypeName asc"; if (filter == null) { filter = ""; } if (sort == null) { sort = ""; } filter = AddItemTypeNamesToFilter(filter, resultFilter.ItemTypeNames); int startIndex; int blockSize; if (!int.TryParse(resultFilter.StartIndex, out startIndex)) { startIndex = -1; } if (!int.TryParse(resultFilter.BlockSize, out blockSize)) { blockSize = -1; } response = PaymentItemsSortFilter.FilterSortTheStoreResponse(response, dataSetResponse, filter, sort, startIndex, blockSize); return(response.InnerXml); }
public IEnumerable <OrderItem> GetItems(string person, DateTime start, DateTime end, ResultFilter filter) => Dao.Get(person, start, end, filter);
public void ReturnTwoMethods(IProxyFactory proxyFactory) { AlternateType <IResultFilter> sut = new ResultFilter(proxyFactory); Assert.Equal(2, sut.AllMethods.Count()); }
/// <summary> /// Initializes a new instance of the <see cref="RegisteredResultCallback"/> class. /// </summary> /// <param name="filter"> /// The filter. /// </param> /// <param name="callback"> /// The callback. /// </param> internal RegisteredResultCallback(ResultFilter filter, ResultCallback callback) { this.Filter = filter; this.Callback = callback; }
public IEnumerable <OrderItem> Get(string person, DateTime start, DateTime end, ResultFilter filter) { return(Execute(database => FindEntities(database.OrderItems, o => (string.IsNullOrEmpty(person) || o.Person == person) && (start == DateTime.MinValue || o.Modified >= start) && (end == DateTime.MaxValue || o.Modified <= end), filter))); }
/// <summary> /// Saves the <see cref="Opc.Da.Server"/> in the configuration data set. /// </summary> /// <param name="server">The server.</param> /// <param name="connectData">The connect data.</param> /// <param name="locale">The locale.</param> /// <param name="filter">The filter.</param> /// <returns></returns> public long Save(Opc.Da.Server server, ConnectData connectData, string locale, ResultFilter filter) { ServersRow rw = this.NewServersRow(); rw.IsConnected = server.IsConnected; rw.Name = server.Name; rw.PreferedSpecyficationID = server.PreferedSpecyfication.ID; rw.PreferedSpecyficationDsc = server.PreferedSpecyfication.Description; rw.URL = server.Url.ToString(); if (!string.IsNullOrEmpty(locale)) { rw.Locale = locale; } rw.Filter = (int)filter; this.AddServersRow(rw); if (connectData != null) { ((OPCCliConfiguration)this.DataSet).ConnectData.Save(connectData, rw.ID); } return(rw.ID); }
/// <summary> /// Creates a query for cities, hurricanes, or both, /// restricted to a particular country. /// /// Note: Wunderground does not use the standard ISO country codes. /// See http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching /// </summary> /// <param name="query">The full or partial name to be looked up.</param> /// <param name="filter">The types of results that are expected.</param> /// <param name="countryCode">The Wunderground country code to restrict results to.</param> public SearchRequest(String query, ResultFilter filter, String countryCode) { _searchString = query; _filter = filter; _countryCode = countryCode; }
public static IQueryable <T> Filter <T>(this IQueryable <T> collection, ResultFilter filter) { return((filter ?? ResultFilter.Default).Filter(collection)); }
public IEnumerable <OrderItem> GetItems(string person, DateTime start, DateTime end, ResultFilter filter = null) { return(new OrderRepository().GetItems(person, start, end, filter)); }
public void SetProxyFactory(IProxyFactory proxyFactory) { AlternateType<IResultFilter> sut = new ResultFilter(proxyFactory); Assert.Equal(proxyFactory, sut.ProxyFactory); }
public IEnumerable <OrderItem> GetItems(DateTime start, DateTime end, ResultFilter filter = null) { return(GetItems(null, start, end, filter)); }
public IEnumerable <OrderItem> GetItems(string person, ResultFilter filter = null) { Scheduler scheduler = new Scheduler(); return(GetItems(person, scheduler.Start, scheduler.End, filter)); }
public void OnResultExecuted(ResultExecutedContext filterContext) { LogCall(OnResultExecutedGuid); ResultFilter.OnResultExecuted(filterContext); }
public void OnResultExecuting(ResultExecutingContext filterContext) { LogCall(OnResultExecutingGuid); ResultFilter.OnResultExecuting(filterContext); }
public void ReturnTwoMethods(IProxyFactory proxyFactory) { AlternateType<IResultFilter> sut = new ResultFilter(proxyFactory); Assert.Equal(2, sut.AllMethods.Count()); }
// Optional: sort (default is back_no) public List<ResultItem> GetResultItemList(ResultFilter filter, int number, ResultSort sort = ResultSort.Default) { // Case statment for sort column string sortString = null; switch (sort) { case ResultSort.Class: sortString = "c.class_no"; break; case ResultSort.Horse: sortString = "h.horse_no"; break; case ResultSort.Place: sortString = "t.place"; break; case ResultSort.Rider: sortString = "r.rider_last, r.rider_first, s.date, c.class_no, t.place"; break; case ResultSort.Show: sortString = "s.date, c.class_no"; break; default: sortString = "b.back_no, s.date, c.class_no"; break; } string filterString = null; switch (filter) { case ResultFilter.BackNo: filterString = "b.back_no"; break; case ResultFilter.Class: filterString = "c.class_no"; break; case ResultFilter.Horse: filterString = "h.horse_no"; break; case ResultFilter.Rider: filterString = "r.rider_no"; break; case ResultFilter.Show: filterString = "s.show_no"; break; default: sortString = "b.back_no"; break; } string query = "SELECT b.back_no, r.rider_no, r.rider_first, r.rider_last, h.horse_no, h.horse_name, " + "s.show_no, s.date, c.class_no, c.class_name, t.place, t.time, t.points, t.paid_in, t.paid_out " + "FROM [" + Year + "_result] AS t JOIN [" + Year + "_back] AS b ON t.back_no = b.back_no " + "JOIN [" + Year + "_rider] AS r ON b.rider_no = r.rider_no " + "JOIN [" + Year + "_horse] AS h ON b.horse_no = h.horse_no " + "JOIN [" + Year + "_class] AS c ON t.class_no = c.class_no " + "JOIN [" + Year + "_show] AS s ON t.show_no = s.show_no " + "WHERE " + filterString + " = " + number + " " + "ORDER BY " + sortString + ";"; SQLiteDataReader reader = DoTheReader(ClubConn, query); List<ResultItem> resultItemList = new List<ResultItem>(); ResultItem item; reader = DoTheReader(ClubConn, query); while (reader.Read()) { item = new ResultItem(); item.BackNo = reader.GetInt32(0); item.RiderNo = reader.GetInt32(1); item.Rider = reader.GetString(2) + " " + reader.GetString(3); item.HorseNo = reader.GetInt32(4); item.Horse = reader.GetString(5); item.ShowNo = reader.GetInt32(6); item.ShowDate = reader.GetString(7); item.ClassNo = reader.GetInt32(8); item.ClassName = reader.GetString(9); item.Place = reader.GetInt32(10); item.Time = reader.GetDecimal(11); item.Points = reader.GetInt32(12); item.PayIn = reader.GetDecimal(13); item.PayOut = reader.GetDecimal(14); resultItemList.Add(item); } reader.Close(); ClubConn.Close(); return resultItemList; }
/// <summary> /// Creates a general query for cities, hurricanes, or both. /// </summary> /// <param name="query">The full or partial name to be looked up.</param> /// <param name="filter">The types of results that are expected.</param> public SearchRequest(String query, ResultFilter filter) : this(query, filter, null) { }