[6097] | 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
---|
| 2 | <%@ Import Namespace="HLWebOKBQueryPlugin.Models" %>
|
---|
| 3 | <%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
|
---|
| 4 | <!-- Put all into a form that calls the "AddFilter" Action-->
|
---|
[6102] | 5 | <% using (Html.BeginForm ("AddFilter", "Filter")) %>
|
---|
[6097] | 6 | <% { %>
|
---|
| 7 | <p>
|
---|
| 8 | Select Filter:
|
---|
| 9 | <%: Html.DropDownList("filtersCombobox", new SelectList(((FilterModel)Model).Filters, "FilterTypeName", "Label"))%>
|
---|
| 10 | <input type="submit" value="add" />
|
---|
[6118] | 11 |
|
---|
[6097] | 12 | </p>
|
---|
| 13 | <ul>
|
---|
| 14 | <!-- Build the selected filters. The filtesr will be stored in the session and the
|
---|
| 15 | Controller puts the current filters from the session into the model. Selected Filters
|
---|
| 16 | will be iterated. -->
|
---|
| 17 | <% if (((FilterModel)Model).SelectedFilters != null)
|
---|
| 18 | {
|
---|
| 19 |
|
---|
| 20 | foreach (Filter f in ((FilterModel)Model).SelectedFilters)
|
---|
| 21 | { %>
|
---|
| 22 | <li>
|
---|
| 23 | <%
|
---|
[6102] | 24 | // If type is StringComparisonFilter build thes controls
|
---|
| 25 | if ("StringComparisonFilter".Equals(f.GetType().Name))
|
---|
| 26 | { %>
|
---|
| 27 | <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((StringComparisonFilter)f).Value)%>
|
---|
| 28 | <%: Html.LabelFor(x => f.Label)%>
|
---|
| 29 |
|
---|
| 30 | <% }
|
---|
[6097] | 31 | // If type is NameStringComparisonFilter build thes controls
|
---|
| 32 | else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
|
---|
| 33 | { %>
|
---|
[6102] | 34 | <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((NameStringComparisonFilter)f).Value) %>
|
---|
| 35 |
|
---|
| 36 | <% }
|
---|
| 37 | else if ("CombinedFilter".Equals(f.GetType().Name))
|
---|
| 38 | { %>
|
---|
| 39 | <% CombinedFilter combiFilter = ((CombinedFilter)f); %>
|
---|
| 40 | <% List<Filter> comtbiFtilterLis = combiFilter.Filters.ToList<Filter>();
|
---|
| 41 | FilterModel m = new FilterModel();
|
---|
| 42 | m.Filters = ((FilterModel)Model).Filters;
|
---|
| 43 | m.SelectedFilters = comtbiFtilterLis;
|
---|
| 44 | %>
|
---|
| 45 | <% Html.RenderPartial("Filters", m); %>
|
---|
| 46 |
|
---|
| 47 | <% }
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | else
|
---|
| 51 | { %>
|
---|
| 52 | <!-- type not supported ... -->
|
---|
| 53 | FilerTypeName =
|
---|
| 54 | <%: Html.Label(f.GetType().Name)%>
|
---|
| 55 | <% }
|
---|
| 56 | %>
|
---|
[6097] | 57 | </li>
|
---|
| 58 | <% }
|
---|
| 59 |
|
---|
| 60 | }
|
---|
| 61 | }%>
|
---|
| 62 | </ul>
|
---|