public JsonResult AdvancedSearch(AdvancedSearch searchParameters) { try { IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); string idCheck = $@"SELECT ID FROM Users WHERE Email = '{User.Identity.Name}'"; var id = db.Query <int>(idCheck).First(); List <Card> results = _cardData.GetSearchResults(searchParameters, id); results.ForEach(c => { c.src = "http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=" + c.ID + "&type=card"; c.url = Url.Action("CardDetail", "Cards", new { ID = c.ID }); c.Hovering = false; }); return(new CustomJsonResult { Data = results, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } catch (Exception ex) { return(new CustomJsonResult(new List <string> { ex.Message })); } }
public void TransformSQLLimitNegativeNumber() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("Document/limit/-1/10", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/limit/-1/-1", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("Document/limit/1/-1", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); ModelStateDictionary wrapper4 = new ModelStateDictionary(); AdvancedSearch search4 = new AdvancedSearch(); search4.ToSQL("Document/limit/1/0", "1", wrapper4); Assert.AreEqual(1, wrapper4.Count); ModelStateDictionary wrapper5 = new ModelStateDictionary(); AdvancedSearch search5 = new AdvancedSearch(); search5.ToSQL("Document/limit/0", "1", wrapper5); Assert.AreEqual(1, wrapper5.Count); ModelStateDictionary wrapper6 = new ModelStateDictionary(); AdvancedSearch search6 = new AdvancedSearch(); search6.ToSQL("Document/limit/0/-1", "1", wrapper6); Assert.AreEqual(1, wrapper6.Count); }
protected void GetIncidentEquipment() { DataSet Equipment = new DataSet(); AdvancedSearch EquipRetrieve = new AdvancedSearch(); Equipment = EquipRetrieve.IncidentEquipment(IncNumber); if (Equipment.Tables[0].Rows[0]["Equipment Description"].ToString() == "") { lbl_gridanounce.ForeColor = Color.Red; lbl_gridanounce.Text = "No Equipment was entered into our system for this incident."; } else { try { lbl_gridanounce.Text = "Equipment Used at this incident:"; EqupmentUsedGrid.AutoGenerateColumns = true; EqupmentUsedGrid.DataSource = Equipment; EqupmentUsedGrid.DataBind(); EqupmentUsedGrid.UseAccessibleHeader = true; EqupmentUsedGrid.HeaderRow.TableSection = TableRowSection.TableHeader; } catch (Exception exception) { lbl_gridanounce.Text = exception.ToString(); } } }
public ActionResult Advanced(AdvancedSearch model) { var recipes = context.Recipes.ToList(); //Filter by protein if (model.Chicken) { recipes = recipes.Where(p => p.Title.ToLower().Contains("chicken") || p.Description.ToLower().Contains("chicken")).ToList(); } if (model.Beef) { recipes = recipes.Where(p => p.Title.ToLower().Contains("beef") || p.Description.ToLower().Contains("beef")).ToList(); } if (model.Tofu) { recipes = recipes.Where(p => p.Title.ToLower().Contains("tofu") || p.Description.ToLower().Contains("tofu")).ToList(); } if (model.Parsley) { recipes = recipes.Where(p => p.Title.ToLower().Contains("parsley") || p.Description.ToLower().Contains("parsley")).ToList(); } if (model.Rosemary) { recipes = recipes.Where(p => p.Title.ToLower().Contains("rosemary") || p.Description.ToLower().Contains("rosemary")).ToList(); } if (model.Thyme) { recipes = recipes.Where(p => p.Title.ToLower().Contains("thyme") || p.Description.ToLower().Contains("thyme")).ToList(); } if (model.Stardust) { recipes = recipes.Where(p => p.Title.ToLower().Contains("stardust") || p.Description.ToLower().Contains("stardust")).ToList(); } return(View("Results", recipes)); }
public ActionResult AdvSearch(bool initial = false, bool isChemical = false, int groupId = 0) { BreadcrumbNavigation nav = System.Web.HttpContext.Current.Session["Navigation"] as BreadcrumbNavigation; if (initial) { nav = new BreadcrumbNavigation(); System.Web.HttpContext.Current.Session["Navigation"] = nav; } else { //if (nav != null) //{ // AdvancedSearchResults res = nav.GetOrderedItems().Where(n => n.NavigableID == "AdvancedSearchResults").FirstOrDefault() as AdvancedSearchResults; // if (res != null) // { // AdvSearchFiltersAll filters = res.PageData as AdvSearchFiltersAll; // if (filters != null && filters.StructureSearch != null && (!string.IsNullOrEmpty(filters.StructureSearch.Exactsearch) || !string.IsNullOrEmpty(filters.StructureSearch.Query) || !string.IsNullOrEmpty(filters.StructureSearch.Stereo))) // { // isChemical = true; // } // } //} isChemical = (bool)Session["isChemical"]; } AdvancedSearch model = new AdvancedSearch() { SearchCondition = new SearchCondition(), PropertyUnits = new List <PropertyUnitModel>() }; var sources = materialContextUow.Sources.AllAsNoTracking.ToList(); model.SearchCondition.FullText = ""; model.SearchCondition.Sources = sources; model.SearchCondition.ClassificationTypes = materialContextUow.Trees.GetFullTreeFor(); if (groupId != 1 && groupId != 0) { model.SearchCondition.ClassificationTypes = model.SearchCondition.ClassificationTypes.Where(m => m.TypeClassId == groupId).ToList(); } if (isChemical) { model.SearchCondition.ClassificationTypes = model.SearchCondition.ClassificationTypes.Where(m => m.TypeClassId == 609397 || m.TypeClassId == 609441).ToList(); } model.SearchCondition.PropertyGroups = materialContextUow.Trees.GetFullPropertyGroups(groupId); model.SearchModel = new BaseSearchModel() { Descriptor = new GridDescriptor(new SortDescriptor() { PropertyName = "Name", Order = SortOrder.Ascending }) }; model.PropertyUnits = BreadcrumbNavigationGetSet(); model.IsChemical = isChemical; Session["isChemical"] = isChemical; new TableFiltersBinder().resetAllTableFilters(); return(View("AdvSearch", model)); }
// Sorts the current page of the data grid each time the view model's ItemsSource is modified. private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "CurrentItem") { OnCurrentItemChanged(); if (m_dataContext.IsNewRecord) { DataGridList.SelectedIndex = -1; } } else if (e.PropertyName == "ItemsSource") { Dispatcher.BeginInvoke(new Action(ResizeDataGridContent)); Dispatcher.BeginInvoke(new Action(SortDataGrid)); OnCurrentPageChanged(); } else if (e.PropertyName == "AdvancedFindIsOpen") { Dispatcher.BeginInvoke(new Action(() => { TextBox searchTextBox = m_dataContext.AdvancedFindIsOpen ? AdvancedSearch.FindName("SearchTextBox") as TextBox : SearchTextBox; if ((object)searchTextBox != null) { searchTextBox.Focus(); searchTextBox.SelectAll(); } })); } }
public ActionResult Advanced(AdvancedSearch f) { OnlineUser u = (OnlineUser)System.Web.HttpContext.Current.Session["_u__OUSER"]; if (u != null) { if (f.Sex == 0) { f.Sex = u.Sex; } if (f.SeekSex == 0) { f.SeekSex = u.SeekSex; } if (f.Country == 0) { f.Country = u.Country; } } HttpCookie newCookie = new HttpCookie("counter"); newCookie.Expires = DateTime.Now.AddDays(-1); Response.AppendCookie(newCookie); return(View("AdvancedSearch", f)); }
public ActionResult AdvancedSearch(string lang = "it") { AdvancedSearch adv = new AdvancedSearch(); PageInfo p = db.PageInfo.Where(x => x.lang == lang && x.pname == "ricercaavanzata").FirstOrDefault(); adv.PageInfo = p; adv.Larghezze = db.Prodotti.Select(x => x.basecm).Distinct().OrderBy(x => x).ToArray(); adv.Profondita = db.Prodotti.Select(x => x.profonditacm).Distinct().OrderBy(x => x).ToArray(); adv.Collezioni = db.Collezioni.Where(x => x.lang == lang && x.visibile == true).OrderBy(x => x.titolo).ToDictionary(x => x.itemgroup.ToString(), x => x.titolo); adv.Categorie = db.Categorie.Where(x => x.lang == lang).OrderBy(x => x.titolo).ToDictionary(x => x.itemgroup.ToString(), x => x.titolo); //adv.Finiture = db.Finiture.Where(x => x.lang == lang).OrderBy(x => x.titolo).ToList(); Dictionary <int, string> fin = new Dictionary <int, string>(); db.FinitureGruppi.Where(x => x.lang == lang && x.itemgroup != 11).OrderBy(x => x.titolo).GroupBy(x => x.titolo) .Select(x => x.FirstOrDefault()) .ToList() .ForEach(x => { fin.Add(x.itemgroup, x.titolo); }); adv.Finiture = fin; return(View("RicercaAvanzata", adv)); }
public async virtual Task <IActionResult> AdSearchEntity(AdvancedSearch advancedSearch) { ApiResult apiResult = new ApiResult(); try { var querySelect = _entityDatapPermission.PermissionWhere(_context.Set <TEntity>()).AdSearchEntity(advancedSearch); //var querySelect = _context.AdSearchEntity<TEntity>(advancedSearch); await _cache.SetStringAsync(typeof(TController).Name + nameof(this.AdSearchEntity), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); _logger.LogInformation($"{typeof(TController).Name}/{nameof(this.AdSearchEntity)}"); var result = await querySelect.ToListAsync(); apiResult.resultCode = 0; apiResult.resultBody = result; return(Ok(apiResult)); } catch (Exception ex) { apiResult.resultCode = ResultCodeEnum.Exception; apiResult.resultBody = ex.ToString(); return(BadRequest(apiResult)); } }
public ActionResult AdvancedSearch(AdvancedSearch searchedAnn) { List <AnnouncementListModel> searchedList = GetSearchedAnnouncements(searchedAnn); TempData["searched"] = searchedList; return(RedirectToAction("List")); }
// GET: Home/AdvancedSearch public ActionResult AdvancedSearch() { ViewBag.Message = "Advanced Search"; int currentYear = 0; AdvancedSearch searchCriterias = new AdvancedSearch(); // Create DataSource for Year var dsYear = new[] { new { yearID = 0, yearString = "None" } }.ToList(); currentYear = DateTime.Today.Year; for (int i = currentYear; i >= 1900; i--) { dsYear.Add(new { yearID = i, yearString = i.ToString() }); } ViewBag.year = new SelectList(dsYear, "yearID", "yearString"); // Create DataSource for Sort by var dsSortBy = Enum.GetValues(typeof(DiscoverMovieSortBy)).Cast <DiscoverMovieSortBy>().Select(v => new SelectListItem { Text = v.ToString(), Value = ((int)v).ToString() }).ToList(); ViewBag.SortBy = new SelectList(dsSortBy, "Value", "Text"); // Create DataSource for Genre TMDbClient client = new TMDbClient(ApiKey); List <Genre> listGenres = client.GetMovieGenres(); ViewBag.Genres = new SelectList(listGenres, "Id", "Name"); return(View(searchCriterias)); }
public ActionResult GetOptionAdvancedSearch(LibraryLocationModel model, string txtSearch1, string txtSearch2, string txtSearch3, string txtSearch4, string libraryId, string searchType, string searchType2, string searchType3, string searchType4, string condition1, string condition2, string condition3, string documentType, string orderBy) { if (string.IsNullOrEmpty(txtSearch1.Trim()) && string.IsNullOrEmpty(txtSearch2.Trim()) && string.IsNullOrEmpty(txtSearch3.Trim()) && string.IsNullOrEmpty(txtSearch4.Trim())) { TempData["errorMessage"] = "Từ khóa không được để trống!"; return(RedirectToAction("AdvancedSearchBook")); } AdvancedSearch input = new AdvancedSearch() { LibraryId = libraryId, LocationId = model.LocationId, SearchType1 = searchType, SearchType2 = searchType2, SearchType3 = searchType3, SearchType4 = searchType4, TxtSearch1 = txtSearch1, TxtSearch2 = txtSearch2, TxtSearch3 = txtSearch3, TxtSearch4 = txtSearch4, Condition1 = condition1, Condition2 = condition2, Condition3 = condition3, DocumentType = documentType, OrderBy = orderBy }; TempData["inputSearch"] = input; return(RedirectToAction("AdvancedSearchResult", new { page = 1 })); }
public DeckSearcher(float x, float y, DeckEditorManager deck) { _DeckEditor = deck; xCorr = _DeckEditor._xWindowScale; yCorr = _DeckEditor._yWindowScale; _x = x; _y = y; _Background = Resources.Load ("DeckEditor/SearchResult") as Texture2D; _AdvancedSearch = new AdvancedSearch(800.0f, 0.0f, deck, this); CardListRight = new List<Card2D>(); CardListLeft = new List<Card2D>(); /* LastResult = _AdvancedSearch.Query(SearchQuery.ALL); LastResult = _AdvancedSearch.FilterBy(SearchQuery.BYCLAN, LastResult); LoadCardList(); */ UpArrowStyle = new GUIStyle(); UpArrowStyle.normal.background = Resources.Load ("DeckEditor/UpArrow") as Texture2D; DownArrowStyle = new GUIStyle(); DownArrowStyle.normal.background = Resources.Load ("DeckEditor/DownArrow") as Texture2D; }
private void buttonAdvancedSearch_Click(object sender, EventArgs e) { AdvancedSearch frm = new AdvancedSearch(); frm.Show(); PopulateCustomerList(); }
public void TransformSQLUnknownResource() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("unknownresource/where/id/eq/10", "1", wrapper); Assert.AreEqual(1, wrapper.Count); }
public void TransformSQLRandom() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("fpefpoeà)orfàfioefsdfvkpoejkfge", "1", wrapper); Assert.AreEqual(1, wrapper.Count); }
public ActionResult AdvancedSearch([FromBody] AdvancedSearch searchTerms) { searchTerms = searchTerms ?? new Models.AdvancedSearch(); var results = inventoryService.AdvancedSearch(searchTerms.Name, searchTerms.Category, searchTerms.MinPrice, searchTerms.MaxPrice, searchTerms.Manufacturer, searchTerms.ManufacturerPartNumber, searchTerms.SKU); return(Json(results)); }
public List <AnnouncementListModel> GetSearchedAnnouncements(AdvancedSearch searchedAnn) { RestClient <AnnouncementListModel> rc = new RestClient <AnnouncementListModel>(); rc.WebServiceUrl = "http://localhost:61144/api/Announcements/Search/"; List <AnnouncementListModel> searchedList = rc.Search(searchedAnn.CategoryId, searchedAnn.Value, searchedAnn.StartDate, searchedAnn.EndDate); return(searchedList); }
public void TransformSQLEmpty() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL(null, "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); }
public void TransformSQLUnknownKeyWord() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("Document/whereas/id/eq/10", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/where/id/eq/10/ora/id/eq/15", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); }
public ActionResult Index(string text) { var key = (string)text.Clone(); List <int> groupIDs = new List <int>(); var products = Products.AdvancedSearch(key); Products.FillProductItems(UserID, products, StaticValues.DefaultProductImageSize); var blogs = Articles.SimpleSearch(key, ArticleStatus.Approved, StaticValues.DefaultPostImageSize); var producers = Producers.SimpleSearch(key, groupIDs, StaticValues.ProducerImageSize); var groups = Groups.SimpleSearch(key); var isFa = Utilities.ContainsUnicodeCharacter(key); key = key.GetReversed(isFa); if (products.Count == 0) { products = Products.AdvancedSearch(key); Products.FillProductItems(UserID, products, StaticValues.DefaultProductImageSize); } if (blogs.Count == 0) { blogs = Articles.SimpleSearch(key, ArticleStatus.Approved, StaticValues.DefaultPostImageSize); } if (groups.Count == 0) { groups = Groups.SimpleSearch(key); } var mappedGroups = Mapper.Map <List <JsonProductGroup> >(groups); ViewBag.Title = "جستجو - " + text; ViewBag.Description = "جستجوی کلمه '" + text + "'"; ViewBag.Keywords = "جستجو, " + text; ViewBag.OGImage = StaticValues.WebsiteUrl + "/images/small-logo.jpg"; var model = new AdvancedSearch { Products = products, Blogs = blogs, Producers = producers, Groups = mappedGroups, }; return(View(model: model)); }
public AddOrUpdate(DataGrid dtg, ObservableCollection <ArticleModel> inv, AdvancedSearch adv) { InitializeComponent(); inventarSearch = new InventarSearch(); this.dtg = dtg; this.inv = inv; tvrCategory.Items.Add(CategoryController.getCategoryListAsTreeView()); cbxStatus.DisplayMemberPath = "Status"; cbxStatus.SelectedValuePath = "StatusID"; cbxStatus.SelectedIndex = 0; cbxStatus.ItemsSource = StatusController.StatusList(); this.inv = inv; this.adv = adv; }
public async virtual Task <IActionResult> AdSearchEntity(AdvancedSearch advancedSearch) { ApiResult apiResult = new ApiResult(); try { var conditions = advancedSearch?.entityConditions; var selectFileds = advancedSearch?.selectFileds; var queryDBSet = _context.Set <TEntity>(); IQueryable <TEntity> queryWhere = null; IQueryable <dynamic> querySelect = null; if (conditions == null) { queryWhere = queryDBSet.Where(x => 1 == 2); } else { queryWhere = queryDBSet.QueryConditions(conditions); } if (selectFileds == null || selectFileds.Length == 0) { querySelect = queryWhere.Select <TEntity, dynamic>(x => x); } else { querySelect = queryWhere.SelectByProperties <TEntity, dynamic>(selectFileds); } await _cache.SetStringAsync(typeof(TController).Name + nameof(this.AdSearchEntity), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); _logger.LogInformation($"{typeof(TController).Name}/{nameof(this.AdSearchEntity)}"); var result = await querySelect.ToListAsync(); apiResult.resultCode = 0; apiResult.resultBody = result; return(Ok(apiResult)); } catch (Exception ex) { apiResult.resultCode = ResultCodeEnum.Exception; apiResult.resultBody = ex.ToString(); return(BadRequest(apiResult)); } }
/// <summary> /// Searches all request item columns for item that match the specified search string. /// </summary> private async void ItemSearch(string searchString) { // If search string is empty, clear slider label and return. if (searchString.Trim() == "") { searchSlider.Clear(); return; } // Get a new AdvancedSearch instance. var AdvSearch = new AdvancedSearch(); // Perform search on Request Items table using (var results = AdvSearch.GetSingleTableResults(searchString.Trim(), SibiRequestItemsCols.TableName)) { // Make sure we have results. if (results.Rows.Count > 0) { //Clear slider label of any previous errors. searchSlider.Clear(); // Iterate through results and use Request Items Request Guid column to query for the full request data. // Task.Run lambda to keep UI alive. DataTable resultsTable = await Task.Run(() => { DataTable rtables = new DataTable(); foreach (DataRow row in results.Rows) { DataTable requestTable = DBFactory.GetDatabase().DataTableFromQueryString(Queries.SelectSibiRequestsByGuid(row[SibiRequestItemsCols.RequestGuid].ToString())); // Merge results into one table. rtables.Merge(requestTable); } return(rtables); }); // Display the table containing a collection of corresponding Requests. SendToGrid(resultsTable); } else { // Notify user of no results. searchSlider.QueueMessage("No matches found!", Color.Red, SlideDirection.Up, SlideDirection.Down, 0); } } }
public void TransformSQLLimitWithOffset() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("Document/limit/5/10", "1", wrapper); TestInfo(search.Infos, new SearchInfos() { count = false, orderByClause = "id ascending", resource = "Document", skip = 5, take = 10, whereClause = new System.Text.StringBuilder("Home.ClientId == 1"), whereParameters = new List <object>() { } }); }
public DataModel(MainWindow mainWindow) { MainWindow = mainWindow; ServerList = new ServerList(); ServerSession = new ServerSession(this); ServerStatus = new ServerStatus(this); Database = new Database(this); QuickSearch = new QuickSearch(this); AdvancedSearch = new AdvancedSearch(this); DatabaseView = new DatabaseView(this); StreamsCollection = new StreamsCollection(); SavedPlaylists = new SavedPlaylists(this); CurrentSong = new CurrentSong(this); Playlist = new Playlist(this); OutputCollection = new OutputCollection(this); CustomDateNormalizer = new DateNormalizer(); CustomDateNormalizer.ReadFromSettings(); YearNormalizer = new DateNormalizer(new string[] {"YYYY"}); }
public void TransformSQLCountError() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("Document/whereas/id/eq/10/count/count", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/whereas/id/eq/10/limit/5/count", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("Document/whereas/id/eq/10/Orderby/title/count", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); }
public DataModel(MainWindow mainWindow) { MainWindow = mainWindow; NetworkLog = null; ServerList = new ServerList(); ServerSession = new ServerSession(this); ServerStatus = new ServerStatus(this); Database = new Database(this); QuickSearch = new QuickSearch(this); AdvancedSearch = new AdvancedSearch(this); DatabaseView = new DatabaseView(this); StreamsCollection = new StreamsCollection(); SavedPlaylists = new SavedPlaylists(this); CurrentSong = new CurrentSong(this); Playlist = new Playlist(this); OutputCollection = new OutputCollection(this); CustomDateNormalizer = new DateNormalizer(); CustomDateNormalizer.ReadFromSettings(); YearNormalizer = new DateNormalizer(new string[] { "YYYY" }); }
public MovieResult AdvancedSearch(AdvancedSearch model) { FacetParameters parameters = new FacetParameters(); if (model.UseDate) { //parameters.Queries.Add(new SolrFacetDateQuery("")); } SolrQueryResults <Movie> results = _solr .Query(SolrQuery.All, new QueryOptions() { Rows = PageSize, Facet = parameters }); var result = new MovieResult { Movies = results.ToList(), }; return(result); }
public void TransformSQLOrderByError() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("Document/whereas/id/eq/10/Orderby/count", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/whereas/id/eq/10/Orderby/id/aaa", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("Document/whereas/id/eq/10/Orderby/id", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); ModelStateDictionary wrapper4 = new ModelStateDictionary(); AdvancedSearch search4 = new AdvancedSearch(); search4.ToSQL("Document/whereas/id/eq/10/Orderby/OrderBy/id/asc", "1", wrapper4); Assert.AreEqual(1, wrapper4.Count); ModelStateDictionary wrapper5 = new ModelStateDictionary(); AdvancedSearch search5 = new AdvancedSearch(); search5.ToSQL("Document/OrderBy/id/asc/whereas/id/eq/10///", "1", wrapper5); Assert.AreEqual(1, wrapper5.Count); ModelStateDictionary wrapper6 = new ModelStateDictionary(); AdvancedSearch search6 = new AdvancedSearch(); search6.ToSQL("Document/OrderBy/id/asc/whereas/id/eq/10", "1", wrapper6); Assert.AreEqual(1, wrapper6.Count); }
private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "ItemsSource") { Dispatcher.BeginInvoke(new Action(SortDataGrid)); } else if (e.PropertyName == "AdvancedFindIsOpen") { Dispatcher.BeginInvoke(new Action(() => { TextBox searchTextBox = m_dataContext.AdvancedFindIsOpen ? AdvancedSearch.FindName("SearchTextBox") as TextBox : SearchTextBox; if ((object)searchTextBox != null) { searchTextBox.Focus(); searchTextBox.SelectAll(); } })); } }
public void TransformSQLSlashes() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("///////", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("/", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("//", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); ModelStateDictionary wrapper4 = new ModelStateDictionary(); AdvancedSearch search4 = new AdvancedSearch(); search4.ToSQL("/Document/", "1", wrapper4); Assert.AreEqual(1, wrapper4.Count); ModelStateDictionary wrapper5 = new ModelStateDictionary(); AdvancedSearch search5 = new AdvancedSearch(); search5.ToSQL("/where/id/eq/10", "1", wrapper5); Assert.AreEqual(1, wrapper5.Count); ModelStateDictionary wrapper6 = new ModelStateDictionary(); AdvancedSearch search6 = new AdvancedSearch(); search6.ToSQL("/and/and/and/and", "1", wrapper6); Assert.AreEqual(1, wrapper6.Count); }
protected void SetIncidentInfo() { try { DataSet Incident = new DataSet(); AdvancedSearch IncidentRetrieve = new AdvancedSearch(); Incident = IncidentRetrieve.PopulateIncidentData(IncNumber); //Our References lbl_OurRef.Text = OurReference(); //Call Information lbl_IncRef.Text = Incident.Tables[0].Rows[0]["Incident Number"].ToString(); lbl_address.Text = Incident.Tables[0].Rows[0]["Location Address"].ToString(); lbl_datecall.Text = Incident.Tables[0].Rows[0]["Date Created"].ToString(); lbl_incidentEnd.Text = Incident.Tables[0].Rows[0]["Inc_Time_Stopped_Mobilising"].ToString(); lbl_methodcontact.Text = Incident.Tables[0].Rows[0]["Origin_Of_Call"].ToString(); //Incident Information lbl_proptype.Text = Incident.Tables[0].Rows[0]["Property_Type"].ToString() + " " + Incident.Tables[0].Rows[0]["Property_Subclass"].ToString(); if (Incident.Tables[0].Rows[0]["Item_First_Ignited"].ToString() == "") { lbl_originoffire.Text = lbl_originoffire.Text = Incident.Tables[0].Rows[0]["Fire_Main_Cause"].ToString(); ; } else { lbl_originoffire.Text = "No data was entered into our system."; }; lbl_oic.Text = Incident.Tables[0].Rows[0]["oic_inc_name"].ToString(); //Damage Information if (Incident.Tables[0].Rows[0]["Fire_Size_On_Arrival"].ToString() == "") { lbl_sizeonarrive.Text = "N/A"; } else { lbl_sizeonarrive.Text = Incident.Tables[0].Rows[0]["Fire_Size_On_Arrival"].ToString(); }; if (Incident.Tables[0].Rows[0]["Fire_Damage_On_Close"].ToString() == "") { lbl_damageonclose.Text = "N/A"; } else { lbl_damageonclose.Text = Incident.Tables[0].Rows[0]["Fire_Damage_On_Close"].ToString(); }; if (Incident.Tables[0].Rows[0]["Fire_Size_Room_Origin"].ToString() == "") { lbl_roomoforigin.Text = "N/A"; } else { lbl_roomoforigin.Text = Incident.Tables[0].Rows[0]["Fire_Size_Room_Origin"].ToString(); }; if (Incident.Tables[0].Rows[0]["Fire_Total_Damage_Area"].ToString() == "") { lbl_totaldamage.Text = "N/A"; } else { lbl_totaldamage.Text = Incident.Tables[0].Rows[0]["Fire_Total_Damage_Area"].ToString(); }; //Cause Information if (Incident.Tables[0].Rows[0]["Fire_Cause"].ToString() == "") { lbl_firecause.Text = "N/A"; } else { lbl_firecause.Text = Incident.Tables[0].Rows[0]["Fire_Cause"].ToString(); }; if (Incident.Tables[0].Rows[0]["Ignition_Source"].ToString() == "") { lbl_ignitionsource.Text = "N/A"; } else { lbl_ignitionsource.Text = Incident.Tables[0].Rows[0]["Ignition_Source"].ToString(); }; if (Incident.Tables[0].Rows[0]["Item_First_Ignited"].ToString() == "") { lbl_itemfirstigntited.Text = "N/A"; } else { lbl_itemfirstigntited.Text = Incident.Tables[0].Rows[0]["Item_First_Ignited"].ToString(); }; if (Incident.Tables[0].Rows[0]["Fire_Main_Cause"].ToString() == "") { lbl_maincause.Text = "N/A"; } else { lbl_maincause.Text = Incident.Tables[0].Rows[0]["Fire_Main_Cause"].ToString(); }; tb_adi.Text = Incident.Tables[0].Rows[0]["Adi_General"].ToString(); } catch (Exception excep) { lbl_gridanounce.Text = excep.ToString(); } }