protected EfRepositoryBase(IDocumentSession documentSession, ISavingStrategy savingStrategy, IDeletionStrategy <T> deletionStrategy, IFilterStrategy <T, Guid> filterStrategy) : base(documentSession, savingStrategy, deletionStrategy, filterStrategy) { }
private IFilterStrategy DetermineFilter(FilterOptions options) { IFilterStrategy filterStrategy = null; if (options.Filter == FilterBy.Name && !string.IsNullOrEmpty(options.Name)) { filterStrategy = new NameFilter(options); } else if (options.Filter == FilterBy.Email && !string.IsNullOrEmpty(options.Email)) { filterStrategy = new EmailFilter(options); } else if (options.Filter == FilterBy.Phone && !string.IsNullOrEmpty(options.Phone)) { filterStrategy = new PhoneFilter(options); } else if (options.Filter == FilterBy.From && options.From.HasValue) { filterStrategy = new FromFilter(options); } else if (options.Filter == FilterBy.To && options.To.HasValue) { filterStrategy = new ToFilter(options); } else if (options.Filter == FilterBy.Status) { filterStrategy = new StatusFIlter(options); } else if (options.Filter == FilterBy.Date && options.Date.HasValue) { filterStrategy = new DateFilter(options); } return(filterStrategy); }
public void TLPParser() { m_filters = new IFilterStrategy[] { new ConstraintFilterStrategy() }; string sAnswerFile = Path.Combine(m_sExpectedResultsPath, "TLPParser.xml"); DoDump("TestLangProj", "TLP M3Parser dump", m_sFxtParserPath, sAnswerFile, true, true); }
/// <summary> /// Setzt die Beziehung von dem "realen" GUI Element zu dem UI-Element auf der Stiftplatte umd die Darstellung eines Screenshots zu testen /// falls noch kein Baum gefiltert wurde, so wird die Anwendung gefiltert /// </summary> public void setOSMRelationshipImg() { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); if (grantTree.filteredTree == null) { filterTreeOfApplication(); } if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); OSMElements.OSMElement osmElement = filterStrategy.getOSMElement(pointX, pointY); GeneralProperties propertiesForSearch = new GeneralProperties(); propertiesForSearch.controlTypeFiltered = "Screenshot"; List <Object> treeElement = treeOperation.searchNodes.getNodesByProperties(grantTree.brailleTree, propertiesForSearch, OperatorEnum.and); if (treeElement.Count > 0) { treeOperation.osmTreeConnector.addOsmConnection(osmElement.properties.IdGenerated, strategyMgr.getSpecifiedTree().GetData(treeElement[0]).properties.IdGenerated); } } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } }
public static FriendFilter Build(LinkedList <eFilters> i_ListOfOptionalFiltersToAdd) { FriendFilter firstInChain = null; foreach (IFilterStrategy criticalFilterTest in sr_CriticalFilterTests) { if (firstInChain == null) { firstInChain = new CriticalFilter(criticalFilterTest); } else { firstInChain.AddToEndOfChain(new CriticalFilter(criticalFilterTest)); } } foreach (eFilters nameOfOptionalFilter in i_ListOfOptionalFiltersToAdd) { IFilterStrategy optionalFilterTest = sr_StringToOptionalFilterTest[nameOfOptionalFilter]; if (firstInChain == null) { firstInChain = new OptionalFilter(optionalFilterTest); } else { firstInChain.AddToEndOfChain(new OptionalFilter(optionalFilterTest)); } } return(firstInChain); }
public String filterNodeOfApplicatione() { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IntPtr points = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Element, 0); /* if (grantTree.filteredTree != null) * { * treeOperation.updateNodes.changePropertiesOfFilteredNode(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties); * }*/ // strategyMgr.getSpecifiedTreeOperations().printTreeElements(tree, -1); if (strategyMgr.getSpecifiedTree().HasChild(tree) == true) { return(printProperties(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties)); } return(""); } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } return(""); }
// GET: Admin/Basic public ActionResult Index(int?page, FilterOptions options) { var allReservations = this.reservations.All(); var pagination = this.Paginate(page, allReservations.Count()); if (pagination.IsRedirect) { return(Index(pagination.Page, options)); } ViewBag.CurrentPage = pagination.Page; // Holds the view numbering of the reservations ViewBag.CountStart = pagination.SkipSize; IFilterStrategy filter = filterFactory.GetFilter(options); if (filter != null) { allReservations = filter.Filter(allReservations); } IEnumerable <ReservationsOutputModel> viewReservations = allReservations .OrderByDescending(x => x.CreatedOn) .Skip(pagination.SkipSize) .Take(PAGE_SIZE) .Project() .To <ReservationsOutputModel>() .ToList(); return(View(viewReservations)); }
public String filterSubtreeOfApplication() { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IntPtr points = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Descendants, -1); if (grantTree.filteredTree != null) { List <Object> result = treeOperation.searchNodes.getNodesByProperties(grantTree.filteredTree, strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties, OperatorEnum.and); if (result.Count == 1) { GuiFunctions guiFunctions = new GuiFunctions(strategyMgr, grantTree, treeOperation); treeOperation.updateNodes.filterSubtreeWithCurrentFilterStrtegy(strategyMgr.getSpecifiedTree().GetData(result[0]).properties.IdGenerated); // guiFunctions.filterAndAddSubtreeOfApplication(strategyMgr.getSpecifiedTreeOperations().getFilteredTreeOsmElementById("7CA0B5B9845D7906E3BD235A600F3546")); } } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } return(""); }
private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.F1) { exampleInspectGui.inspect(); String element = exampleTree.filterNodeOfApplicatione(); NodeBox.Text = element; } if (e.Key == Key.F2) { List <String> result = exampleBrailleDis.getPosibleScreens(); NodeBox.Text = "Mögliche Screens: \n"; NodeBox.Text = result != null ? NodeBox.Text + String.Join(", ", result.Select(p => p.ToString()).ToArray()) : ""; } if (e.Key == Key.F3) { exampleBrailleDis.changeScreen(Screen.Text); } if (e.Key == Key.F4) { exampleBrailleDis.update(); } if (e.Key == Key.F5) { NodeBox.Text = exampleDisplay.allDevices(); } if (e.Key == Key.F6) { NodeBox.Text = exampleDisplay.deviceInfo(); } if (e.Key == Key.F7) { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { //Filtermethode IntPtr points = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition(); List <Strategy> possibleFilter = Settings.getPossibleFilters(); if (strategyMgr.getSpecifiedFilter() == null) { // auslesen aus GUI..... String cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName)); strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTree); strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperation); } guiFunctions.deleteGrantTrees(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); grantTree.filteredTree = filterStrategy.filtering(strategyMgr.getSpecifiedOperationSystem().getProcessHwndFromHwnd(filterStrategy.deliverElementID(points))); } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } } }
public TextFile() { _scriptContent = string.Empty; _codeDocument = new TextDocument(new StringTextSource(_scriptContent)); _contentRegistry = new ProjectContentRegistry(); _filterStrategy = new NonFilterStrategy(); _projectContent = new DefaultProjectContent(); }
// We can also pass the strategy implementation objects in the method // and not in the constructor to apply different behaviors to the same image. public void Store(string fileName, ICompressorStrategy compressor, IFilterStrategy filter) { compressor.ApplyCompression(fileName); filter.ApplyFilter(fileName); Console.WriteLine($"Store image with name {fileName}."); }
public TextFile() { _scriptContent = string.Empty; _codeDocument = new TextDocument(new StringTextSource(_scriptContent)); _contentRegistry = new ProjectContentRegistry(); _filterStrategy = new NonFilterStrategy(); _projectContent = new DefaultProjectContent(); }
public GUIInspector() { InitializeComponent(); settings = new Settings(); strategyMgr = new StrategyManager(); grantTrees = new GeneratedGrantTrees(); treeOperations = new TreeOperation(strategyMgr, grantTrees); // Setzen des Eventmanager List <Strategy> possibleEventManager = settings.getPossibleEventManager(); strategyMgr.setSpecifiedEventStrategy(possibleEventManager[0].className); List <Strategy> possibleOperationSystems = settings.getPossibleOperationSystems(); String cUserOperationSystemName = possibleOperationSystems[0].userName; // muss dynamisch ermittelt werden strategyMgr.setSpecifiedOperationSystem(Settings.strategyUserNameToClassName(cUserOperationSystemName)); IOperationSystemStrategy operationSystemStrategy = strategyMgr.getSpecifiedOperationSystem(); List <Strategy> possibleTrees = settings.getPossibleTrees(); strategyMgr.setSpecifiedTree(possibleTrees[0].className); ITreeStrategy <OSMElements.OSMElement> treeStrategy = strategyMgr.getSpecifiedTree(); List <Strategy> possibleFilter = Settings.getPossibleFilters(); String cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName)); strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees); strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperations); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); strategyMgr.setSpecifiedGeneralTemplateUi(settings.getPossibleUiTemplateStrategies()[0].className); strategyMgr.getSpecifiedGeneralTemplateUi().setGeneratedGrantTrees(grantTrees); strategyMgr.getSpecifiedGeneralTemplateUi().setTreeOperation(treeOperations); strategyMgr.setSpecifiedBrailleDisplay(settings.getPossibleBrailleDisplays()[0].className); // muss dynamisch ermittelt werden #region setzen der neuen (Juni 2017) Event Interfaces strategyMgr.setSpecifiedEventAction(settings.getPossibleEventAction()[0].className); strategyMgr.getSpecifiedEventAction().setGrantTrees(grantTrees); strategyMgr.getSpecifiedEventAction().setTreeOperation(treeOperations); strategyMgr.setSpecifiedEventManager(settings.getPossibleEventManager2()[0].className); strategyMgr.setSpecifiedEventProcessor(settings.getPossibleEventProcessor()[0].className); strategyMgr.getSpecifiedEventProcessor().setGrantTrees(grantTrees); strategyMgr.getSpecifiedEventProcessor().setTreeOperations(treeOperations); #endregion strategyMgr.setSpecifiedExternalScreenreader(settings.getPossibleExternalScreenreaders()[0].className); strategyMgr.setSpecifiedBrailleConverter(settings.getPossibleBrailleConverter()[0].className); filteredTreeOutput.SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(filteredTreeOutput_SelectedItemChanged); guiFunctions = new GuiFunctions(strategyMgr, grantTrees, treeOperations); root = new TreeViewItem(); NodeButton.IsEnabled = false; SaveButton.IsEnabled = false; filteredPropRoot = new GuiFunctions.MyViewModel(); }
/// <summary> /// Set deletion & saving strategies explicitly /// </summary> protected EfRepositoryBaseT(IDocumentSession documentSession, ISavingStrategy savingStrategy, IDeletionStrategyT <T, TId> deletionStrategy, IFilterStrategy <T, TId> filterStrategy) { DocumentSession = documentSession; SavingStrategy = savingStrategy; _deletionStrategy = deletionStrategy; FilterStrategy = filterStrategy; }
private static void ReportTradingDays(StockMarket tradingDays, IFilterStrategy strategy) { foreach (TradingDay day in tradingDays.GetTradingDays()) { if (strategy.FilterStrategy(day)) { Console.WriteLine(day.ToString()); } } }
private static void ReportTradingDays(StockMarketStrat tradingDays, IFilterStrategy swing) { foreach (TradingDayStrat day in tradingDays.GetTradingDays()) { if(swing.FilterStrategy(day)==true) { Console.WriteLine(day.ToString()); } } }
/// <summary> /// Setzt die Beziehung von dem "realen" GUI Element zu dem UI-Element auf der Stiftplatte mit der Id = "braille123_3" /// falls noch kein Baum gefiltert wurde, so wird die Anwendung gefiltert /// </summary> public void setOSMRelationship() { if (grantTree.brailleTree == null) { return; } if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); if (grantTree.filteredTree == null) { filterTreeOfApplication(); } if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); OSMElements.OSMElement osmElement = filterStrategy.getOSMElement(pointX, pointY); GeneralProperties propertiesForSearch = new GeneralProperties(); propertiesForSearch.controlTypeFiltered = "TextBox"; List <Object> treeElement = treeOperation.searchNodes.getNodesByProperties(grantTree.brailleTree, propertiesForSearch, OperatorEnum.and); if (treeElement.Count > 0) { //fĂĽr Testzwecke wird einfach das erste Element genutzt // OsmTreeRelationship.addOsmConnection(filteredSubtree.properties.IdGenerated, "braille123_3", ref relationship); // OsmTreeRelationship.addOsmConnection(filteredSubtree.properties.IdGenerated, "braille123_5", ref relationship); treeOperation.osmTreeConnector.setOsmConnection(osmElement.properties.IdGenerated, strategyMgr.getSpecifiedTree().GetData(treeElement[0]).properties.IdGenerated); // OsmTreeRelationship.setOsmConnection(filteredSubtree.properties.IdGenerated, "braille123_11", ref relationshipList); } } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } }
/// <summary> /// Setzt die zuverwendene Filterstrategie (UIA, Java-Access-Bridge, ...) /// </summary> /// <param name="filterClassName">Gibt den Namen der der Klasse der Filterstrategie an (dieser muss in der Strategy.config vorhanden sein)</param> public void setSpecifiedFilter(String filterClassName) { try { Type type = Type.GetType(filterClassName); specifiedFilter = (IFilterStrategy)Activator.CreateInstance(type); specifiedFilter.setStrategyMgr(this); //damit beim Filter-Wechsel nicht der Setter vergessen wird } catch (InvalidCastException ic) { throw new InvalidCastException("Fehler bei StrategyManager_setSpecifiedFilter: " + ic.Message); } catch (ArgumentException ae) { throw new ArgumentException("Fehler bei StrategyManager_setSpecifiedFilter: " + ae.Message); } catch (Exception e) { throw new Exception("Fehler bei StrategyManager_setSpecifiedFilter: " + e.Message); } }
public void filterTreeOfApplication() { if (strategyMgr.getSpecifiedOperationSystem().deliverCursorPosition()) { try { IntPtr points = strategyMgr.getSpecifiedOperationSystem().getHWNDByCursorPosition(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); // filterStrategy.setStrategyMgr(strategyMgr); //ITreeStrategy<OSMElement.OSMElement> tree1 = filterStrategy.filtering(operationSystemStrategy.getProcessHwndFromHwnd(filterStrategy.deliverElementID(points))); // strategyMgr.setFilteredTree(tree1); int pointX; int pointY; strategyMgr.getSpecifiedOperationSystem().getCursorPoint(out pointX, out pointY); Object tree = filterStrategy.filtering(pointX, pointY, TreeScopeEnum.Application); // strategyMgr.getSpecifiedTreeOperations().printTreeElements(parentBrailleTreeNode, -1); grantTree.filteredTree = tree; } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } }
static void Main(string[] arguments) { /// <summary> /// any filters that we want, for example, to only output items which satisfy their constraint. /// </summary> IFilterStrategy[] filters = null; if (arguments.Length < 3) { Console.WriteLine("usage: fxt dbName fxtTemplatePath xmlOutputPath (-guids)"); Console.WriteLine(""); Console.WriteLine("example using current directory: fxt TestLangProj WebPageSample.xhtml LangProj.xhtml"); Console.WriteLine("example with environment variables: fxt ZPU \"%fwroot%/distfiles/fxtTest.fxt\" \"%temp%/fxtTest.xml\""); return; } string fxtPath = System.Environment.ExpandEnvironmentVariables(arguments[1]); if (!File.Exists(fxtPath)) { Console.WriteLine("could not find the file " + fxtPath); return; } string outputPath = System.Environment.ExpandEnvironmentVariables(arguments[2]); FdoCache cache = null; try { Console.WriteLine("Initializing cache..."); Dictionary <string, string> cacheOptions = new Dictionary <string, string>(); cacheOptions.Add("db", arguments[0]); cache = FdoCache.Create(cacheOptions); } catch (Exception error) { Console.WriteLine(error.Message); return; } Console.WriteLine("Beginning output..."); DateTime dtstart = DateTime.Now; XDumper d = new XDumper(cache); if (arguments.Length == 4) { if (arguments[3] == "-parserDump") { filters = new IFilterStrategy[] { new ConstraintFilterStrategy() }; } else { //boy do we have a brain-dead argument parser in this app! System.Diagnostics.Debug.Assert(arguments[3] == "-guids"); } d.OutputGuids = true; } try { d.Go(cache.LangProject as CmObject, fxtPath, File.CreateText(outputPath), filters); //clean up, add the <?xml tag, etc. Won't be necessary if/when we make the dumper use an xmlwriter instead of a textwriter //was introducing changes such as single quote to double quote XmlDocument doc=new XmlDocument(); // doc.Load(outputPath); // doc.Save(outputPath); } catch (Exception error) { if (cache != null) { cache.Dispose(); } Console.WriteLine(error.Message); return; } TimeSpan tsTimeSpan = new TimeSpan(DateTime.Now.Ticks - dtstart.Ticks); Console.WriteLine("Finished: " + tsTimeSpan.TotalSeconds.ToString() + " Seconds"); if (outputPath.ToLower().IndexOf("fxttestout") > -1) { System.Diagnostics.Debug.WriteLine(File.OpenText(outputPath).ReadToEnd()); } if (cache != null) { cache.Dispose(); } System.Diagnostics.Debug.WriteLine("Finished: " + tsTimeSpan.TotalSeconds.ToString() + " Seconds"); }
public FriendFilter(IFilterStrategy i_FilterStrategy) { r_FilterStrategy = i_FilterStrategy; m_LastHandlerInChain = this; }
public void SetFilterStrategy(IFilterStrategy i_FilterStrategy) { m_FilterStrategy = i_FilterStrategy; }
private void Window_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { IOperationSystemStrategy operationSystemStrategy = strategyMgr.getSpecifiedOperationSystem(); ITreeStrategy <OSMElements.OSMElement> treeStrategy = strategyMgr.getSpecifiedTree(); if (e.Key == Key.F1) { if (operationSystemStrategy.deliverCursorPosition()) { try { IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); int pointX; int pointY; operationSystemStrategy.getCursorPoint(out pointX, out pointY); Console.WriteLine("Pointx: " + pointX); Console.WriteLine("Pointy: " + pointY); OSMElements.OSMElement osmElement = filterStrategy.getOSMElement(pointX, pointY); System.Drawing.Rectangle rect = operationSystemStrategy.getRect(osmElement); if (osmElement.properties.isOffscreenFiltered == false) { operationSystemStrategy.paintRect(rect); } } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } } if (e.Key == Key.F5) { if (operationSystemStrategy.deliverCursorPosition()) { try { //Filtermethode IntPtr points = operationSystemStrategy.getHWNDByCursorPosition(); List <Strategy> possibleFilter = Settings.getPossibleFilters(); if (strategyMgr.getSpecifiedFilter() == null) { // auslesen aus GUI..... String cUserFilterName = possibleFilter[0].userName; // der Filter muss dynamisch ermittelt werden strategyMgr.setSpecifiedFilter(Settings.strategyUserNameToClassName(cUserFilterName)); strategyMgr.getSpecifiedFilter().setGeneratedGrantTrees(grantTrees); strategyMgr.getSpecifiedFilter().setTreeOperation(treeOperations); } guiFunctions.deleteGrantTrees(); IFilterStrategy filterStrategy = strategyMgr.getSpecifiedFilter(); Object tree = filterStrategy.filtering(operationSystemStrategy.getProcessHwndFromHwnd(filterStrategy.deliverElementID(points))); grantTrees.filteredTree = tree; filteredTreeOutput.Items.Clear(); root.Items.Clear(); root.Header = "Filtered - Tree"; guiFunctions.createTreeForOutput(tree, ref root); SaveButton.IsEnabled = true; filteredTreeOutput.Items.Add(root); NodeButton.IsEnabled = false; /* updatePropertiesTable(strategyMgr.getSpecifiedTree().GetData(strategyMgr.getSpecifiedTree().Child(tree)).properties.IdGenerated); * ((TreeViewItem)filteredTreeOutput.Items[0]).IsSelected = true; * ((TreeViewItem)filteredTreeOutput.Items[0]).IsExpanded = true;*/ GuiFunctions.clearTable(filteredTreeProp); } catch (Exception ex) { Console.WriteLine("An error occurred: '{0}'", ex); } } } }
public void Go(ICmObject rootObject, string templateFilePath, TextWriter writer, IFilterStrategy[] filters) { m_sTemplateFilePath = templateFilePath; XmlDocument document = new XmlDocument(); document.Load(templateFilePath); FxtDocument = document; Go(rootObject,writer, filters); }
public FacebookObjectCollection <User> FilterBySameBirthMonth() { m_FilterStrategy = new FilterByBirth(); return(m_FilterStrategy.FilterFriends(Filter)); }
public CoursePaginateDto GetFilteredOrders(Filter filter) { using (var uow = _facade.UnitOfWork) { var filterStrats = new List <IFilterStrategy>(); IFilterStrategy paginateStrat = null; // we only want to show the published courses to the user filterStrats.Add(new FilterByOnlyPublishedStrategy()); if (filter != null) { if (filter.FilterQueries != null) { foreach (var item in filter.FilterQueries) { filterStrats.Add(new FilterSearchStrategy() { Query = item }); } } if (filter.OrderBy != null) { filterStrats.Add(new FilterOrderByNameStategy() { OrderBy = filter.OrderBy }); } // nullable int if (filter.UserId != null) { var user = uow.UserRepo.Get((int)filter.UserId); if (user != null) { filterStrats.Add(new FilterEnrolledStrategy() { User = user }); } } if (filter.CategoryId != null) { filterStrats.Add(new FilterByCategoryStrategy() { CategoryId = filter.CategoryId }); } if (filter.CurrentPage > -1 && filter.PageSize > 0) { paginateStrat = new FilterPaginateStrategy() { CurrentPage = filter.CurrentPage, PageSize = filter.PageSize }; } } IEnumerable <Course> courses; var count = 0; if (filterStrats.Count > 0 || paginateStrat != null) { count = uow.CourseRepo.GetAll(filterStrats).Count(); if (paginateStrat != null) { filterStrats.Add(paginateStrat); } courses = uow.CourseRepo.GetAll(filterStrats); } else { // if there are no filters return all courses count = uow.CourseRepo.GetAll().Count(); courses = uow.CourseRepo.GetAll(); } var courselistObject = new List <CourseBO>(); foreach (var course in courses) { var creatorConverted = _userConv.Convert(course.Creator); var courseConvereted = _crsConv.Convert(course); courseConvereted.Creator = creatorConverted; courselistObject.Add(courseConvereted); } return(new CoursePaginateDto() { Total = count, Courses = courselistObject }); } }
public void TLPParser() { m_filters = new IFilterStrategy[]{new ConstraintFilterStrategy()}; string sAnswerFile = Path.Combine(m_sExpectedResultsPath, "TLPParser.xml"); DoDump ("TestLangProj", "TLP M3Parser dump", m_sFxtParserPath, sAnswerFile, true, true); }
public ReadingSmoother(IFilterStrategy filterStrategy = null, int samplesCount = 25) { this._samplesCount = samplesCount; _sampleBuffer = new double[samplesCount]; this._filterStrategy = filterStrategy; }
static void Main(string[] arguments) { /// <summary> /// any filters that we want, for example, to only output items which satisfy their constraint. /// </summary> IFilterStrategy[] filters=null; if (arguments.Length < 3) { Console.WriteLine("usage: fxt dbName fxtTemplatePath xmlOutputPath (-guids)"); Console.WriteLine(""); Console.WriteLine("example using current directory: fxt TestLangProj WebPageSample.xhtml LangProj.xhtml"); Console.WriteLine("example with environment variables: fxt ZPU \"%fwroot%/distfiles/fxtTest.fxt\" \"%temp%/fxtTest.xml\""); return; } string fxtPath = System.Environment.ExpandEnvironmentVariables(arguments[1]); if(!File.Exists(fxtPath)) { Console.WriteLine("could not find the file "+fxtPath); return; } string outputPath = System.Environment.ExpandEnvironmentVariables(arguments[2]); FdoCache cache = null; try { Console.WriteLine("Initializing cache..."); Dictionary<string, string> cacheOptions = new Dictionary<string, string>(); cacheOptions.Add("db", arguments[0]); cache = FdoCache.Create(cacheOptions); } catch (Exception error) { Console.WriteLine(error.Message); return; } Console.WriteLine("Beginning output..."); DateTime dtstart = DateTime.Now; XDumper d = new XDumper(cache); if (arguments.Length == 4) { if(arguments[3] == "-parserDump") { filters = new IFilterStrategy[]{new ConstraintFilterStrategy()}; } else //boy do we have a brain-dead argument parser in this app! System.Diagnostics.Debug.Assert(arguments[3] == "-guids"); d.OutputGuids = true; } try { d.Go(cache.LangProject as CmObject, fxtPath, File.CreateText(outputPath), filters); //clean up, add the <?xml tag, etc. Won't be necessary if/when we make the dumper use an xmlwriter instead of a textwriter //was introducing changes such as single quote to double quote XmlDocument doc=new XmlDocument(); // doc.Load(outputPath); // doc.Save(outputPath); } catch (Exception error) { if (cache != null) cache.Dispose(); Console.WriteLine(error.Message); return; } TimeSpan tsTimeSpan = new TimeSpan(DateTime.Now.Ticks - dtstart.Ticks); Console.WriteLine("Finished: " + tsTimeSpan.TotalSeconds.ToString() + " Seconds"); if(outputPath.ToLower().IndexOf("fxttestout") > -1) System.Diagnostics.Debug.WriteLine(File.OpenText(outputPath).ReadToEnd()); if (cache != null) cache.Dispose(); System.Diagnostics.Debug.WriteLine("Finished: " + tsTimeSpan.TotalSeconds.ToString() + " Seconds"); }
public ReadingSmoother(IFilterStrategy filterStrategy = null, int samplesCount = 25) { this.samplesCount = samplesCount; sampleBuffer = new double[samplesCount]; this.filterStrategy = filterStrategy; }
public void Go(ICmObject rootObject, TextWriter writer, IFilterStrategy[] filters) { try { m_rootObject = rootObject; m_filters = filters; // Get the output filename from the writer. if (writer is StreamWriter) { StreamWriter sw = writer as StreamWriter; if (sw.BaseStream is System.IO.FileStream) m_sOutputFilePath = (sw.BaseStream as System.IO.FileStream).Name; } ////This allows the template to be somewhere other than the root of the xml ////document, which is useful if the document is, for example, an xhtml doc. //m_templateRootNode =document.SelectSingleNode("//template"); //if (m_templateRootNode == null) // throw new ConfigurationException ("Could not find the <template> element."); //DumpObject(writer, rootObject); Go(writer); } finally { writer.Close(); } if (!m_fSkipAuxFileOutput && !String.IsNullOrEmpty(m_sAuxiliaryFxtFile) && !String.IsNullOrEmpty(m_sAuxiliaryFilename)) { using (TextWriter w = new StreamWriter(m_sAuxiliaryFilename)) { XmlDocument document = new XmlDocument(); string sTemplatePath = Path.Combine(Path.GetDirectoryName(m_sTemplateFilePath), m_sAuxiliaryFxtFile); document.Load(sTemplatePath); FxtDocument = document; Go(w); } } }
public OptionalFilter(IFilterStrategy i_FilterTest) : base(i_FilterTest) { }
public Pipeline(ISelectionStrategy selection, IFilterStrategy filter, IPakuStrategy paku, bool loggingEnabled = false) { this.SelectionStrategy = selection; this.FilterStrategy = filter; this.PakuStrategy = paku; }
private Predicate<object> GetMatchStrategy(IFilterStrategy filterStrategy) { return o => { var text = _textBox.Text.Trim(); return text.Length > 0 && filterStrategy.IsMatch(o, text); }; }
public FacebookObjectCollection <User> FilterByGender(User.eGender i_Gender) { Filter.Gender = i_Gender; m_FilterStrategy = new FilterByGender(); return(m_FilterStrategy.FilterFriends(Filter)); }
public Filter(IFilterStrategy <T> filterStrategy) { _filterStrategy = filterStrategy; }
public ParallelFilter(IFilterStrategy <T> filterStrategy) { _filterStrategy = filterStrategy; }
private void RefreshFilterStrategy(IFilterStrategy filterStrategy) { if (_collectionView != null) _collectionView.Filter = GetMatchStrategy(filterStrategy); RefreshFilteredItems(); }
public CriticalFilter(IFilterStrategy i_FilterTest) : base(i_FilterTest) { }