private void RowOperatorChange(jQueryObject row) { if (row.Length == 0) { return; } jQueryObject editorDiv = row.Children("div.v"); editorDiv.Html(""); IFilterHandler handler = GetFilterHandlerFor(row); if (handler == null) { return; } string op = row.Children("div.o").Children("select").GetValue(); if (op == null || op == "") { return; } handler.CreateEditor(op); }
public HttpModule() { _virtualDir = string.Empty; _errorPageString = ResourceContentLoader.LoadText("errorTemplate.html"); _conversionService = new ConversionService(); ServiceLocator.Locator.Register<IConversionService>(_conversionService); ServiceLocator.Locator.Register<HttpModule>(this); ServiceLocator.Locator.Register<SecurityDefinition>(_securityDefinition); _filtersHandler = ServiceLocator.Locator.Resolve<IFilterHandler>(); if (_filtersHandler == null) { _filtersHandler = new FilterHandler(); ServiceLocator.Locator.Register<IFilterHandler>(_filtersHandler); } SetParameter(HttpParameters.HttpShowDirectoryContent, true); RegisterDefaultFiles("index.htm"); RegisterDefaultFiles("index.html"); }
private IFilterHandler GetFilterHandlerFor(jQueryObject row) { FilterField field = GetFieldFor(row); if (field == null) { return(null); } IFilterHandler handler = (IFilterHandler)row.GetDataValue("FilterHandler"); string handlerField = row.GetDataValue("FilterHandlerField").As <string>(); if (handler != null) { if (handlerField != field.Name) { row.Data("FilterHandler", null); handler = null; } else { return(handler); } } Type handlerType = Type.GetType("Sinerji." + (field.Handler ?? "??") + "FilterHandler"); if (handlerType == null) { throw new Exception(String.Format("FilterHandler type Sinerji.{0}FilterHandler is not defined!", field.Handler)); } jQueryObject editorDiv = row.Children("div.v"); handler = (IFilterHandler)Activator.CreateInstance(handlerType, editorDiv, field); return(handler); }
public async Task <IEnumerable <Advertisement> > GetFilteredAdvertisementsAsync(FilteredAdvertisementDto ad) { if (!string.IsNullOrEmpty(ad.Value)) { _filter = _filter.With(a => a.Title.Contains(ad.Value)); } else { if (ad.Salary > 0) { _filter = _filter.With(a => a.Salary == ad.Salary); } if (ad.CompanyId != default) { _filter = _filter.With(a => a.Employer.CompanyId == ad.CompanyId); } if (ad.PositionId != default) { _filter = _filter.With(a => a.PositionId == ad.PositionId); } } return(await _repository.GetFilteredAdvertisementsAsync(_filter.Result)); }
private void PopulateOperatorList(jQueryObject select) { jQueryObject row = select.Closest("div.row"); IFilterHandler handler = GetFilterHandlerFor(row); if (handler == null) { return; } List <string> operators = handler.GetOperators(); SelectElement sel = (SelectElement)select[0]; if (operators != null) { foreach (string op in operators) { Q.AddOption(select, op, handler.OperatorTitle(op)); } } }
public AdvertisementsService(IAdvertisementsRepository repository, IPositionsRepository positionsRepository, IEmployersRepository employersRepository) : base(repository) { _positionsRepository = positionsRepository; _employersRepository = employersRepository; _filter = new AdvertisementFilter(); }
public Worker(WorkerNestedTypesFactory workerNestedTypesFactory) { _flightBuilder = workerNestedTypesFactory.GetFlightBuilder(); _filterBuilder = workerNestedTypesFactory.GetFilterBuilder(); _filterHandler = workerNestedTypesFactory.GetFilterHandler(); }
/*public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); }*/ public void InitializeFilters(IFilterHandler handler) { }
private void Search() { List <FilterLine> filterLines = new List <FilterLine>(); string filterText = ""; string errorText = null; jQueryObject row = null; this.rowsDiv.Children().Children("div.v").Children("span.error").Remove(); bool inParens = false; for (int i = 0; i < rowsDiv.Children().Length; i++) { row = rowsDiv.Children().Eq(i); IFilterHandler handler = GetFilterHandlerFor(row); if (handler == null) { continue; } FilterField field = GetFieldFor(row); string op = row.Children("div.o").Children("select").GetValue(); if (op == null || op.Length == 0) { errorText = Q.Text("Controls.FilterPanel.InvalidOperator"); break; } FilterLine lineEx = new FilterLine(); lineEx.Field = field.Name; lineEx.Title = field.Title ?? field.Name; lineEx.Operator = op; lineEx.IsOr = row.Children("div.l").Children("a.andor").HasClass("or"); lineEx.LeftParen = row.Children("div.l").Children("a.leftparen").HasClass("active"); lineEx.RightParen = row.Children("div.l").Children("a.rightparen").HasClass("active"); handler.ToFilterLine(lineEx); if (lineEx.ValidationError != null) { errorText = lineEx.ValidationError; break; } FilterLine line = new FilterLine(); line.Field = lineEx.Field; line.Operator = lineEx.Operator; if (Script.IsValue(lineEx.Value)) { line.Value = lineEx.Value; } if (Script.IsValue(lineEx.Value2)) { line.Value2 = lineEx.Value2; } if (Script.IsValue(lineEx.Values) && lineEx.Values.Count > 0) { line.Values = lineEx.Values; } if (lineEx.LeftParen) { line.LeftParen = 1.As < bool > (); } if (lineEx.RightParen) { line.RightParen = 1.As < bool > (); } if (lineEx.IsOr) { line.IsOr = 1.As < bool > (); } filterLines.Add(line); if (inParens && (lineEx.RightParen || lineEx.LeftParen)) { filterText += ")"; inParens = false; } if (filterText.Length > 0) { filterText += " " + Q.Text("Controls.FilterPanel." + (lineEx.IsOr ? "Or" : "And")) + " "; } if (lineEx.LeftParen) { filterText += "("; inParens = true; } filterText += lineEx.DisplayText; } // if an error occured, display it, otherwise set current filters if (errorText != null) { J("<span/>").AddClass("error").Text(errorText).AppendTo(row.Children("div.v")); row.Children("div.v").Find("input:first").Focus(); return; } if (filterLines.Count == 0) { this.SetCurrentFilter(null, null); } else { this.SetCurrentFilter(filterLines, filterText); } }