Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx @ 6190

Last change on this file since 6190 was 6190, checked in by dhohl, 13 years ago

#1499 refactor, first part of the comparison combobox for the different filters, Controls for the Filters

File size: 5.0 KB
RevLine 
[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-->
[6170]5<div><table>
6<tr><td>A<br />N<br />D</td><td>
[6097]7<p>
[6141]8    <%
9        CombinedFilter currentFilter = ((FilterModel)Model).Content;
10    %>
11    <% using (Html.BeginForm("AddFilterAnd", "Filter", FormMethod.Post, new { id = currentFilter.Id, name = currentFilter.Id })) %>
12    <% {     %>
13    <%
14 
[6170]15        string comboboxName = FilterModel.ComboboxName + "." + currentFilter.Id;
16        string hiddenName = FilterModel.ParentIdName + "." + currentFilter.Id;
[6141]17    %>
18 
19    <%: Html.Hidden(hiddenName,currentFilter.Id.ToString()) %>
[6170]20    <%: Html.DropDownList(comboboxName, new SelectList(((FilterModel)Model).AvailableFilterForCombobox, "FilterTypeName", "Label"))%>
[6141]21    <input type="submit" value="+" />
[6097]22</p>
[6141]23<!-- Build the selected filters. The filtesr will be stored in the session and the
[6097]24Controller puts the current filters from the session into the model. Selected Filters
25will be iterated. -->
[6141]26<% if (currentFilter.Filters != null)
27   {
28
29       foreach (Filter f in currentFilter.Filters)
[6097]30       {
[6141]31           if (f != null)
32           {  %>
[6170]33
34           <table border="0"><tr><td>
[6141]35    <%
36           
[6163]37
[6141]38if ("StringComparisonFilter".Equals(f.GetType().Name))
39{  %>
[6163]40    <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
41    <%: Html.Label(filter.Label)%>
[6190]42    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons,"Value","Text", filter.Comparison))%>   
[6170]43    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, (filter.Value))%>
[6141]44    <% }
45else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
46{ %>
[6163]47    <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
48    <%: Html.Label(filter.Label)%>
[6190]49    <%: Html.Label("=")%>
[6170]50    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
[6141]51    <% }
[6163]52else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
53{ %>
54    <% StringComparisonAvailableValuesFilter filter = ((StringComparisonAvailableValuesFilter)f); %>
55    <%: Html.Label(filter.Label)%>
[6170]56    <%: Html.Label("=")%>
57    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueTextbox, new SelectList(filter.AvailableValues, filter.Value))%>
58    <% }
[6163]59else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name))
60{ %>
61    <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
[6170]62    <%: Html.Label(filter.Label)%>
[6190]63      <%: Html.Label("teby")%>
[6170]64    <% }
[6163]65else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
66{ %>
67    <% NameEqualityComparisonBoolFilter filter = ((NameEqualityComparisonBoolFilter)f);
68    %>
69    <%: Html.Label(filter.Label)%>
[6190]70    <%: Html.Label("is") %>
[6170]71    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(((FilterModel)Model).BoolStates, filter.Value))%>
72    <% }
[6163]73else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name))
74{ %>
75    <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f);   %>
76    <%: Html.Label(filter.Label)%>
[6190]77    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(FilterModel.OrdinalComparisons,"Value","Text", filter.Comparison))%>
78    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
[6170]79    <% }
[6163]80else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
81{ %>
82    <% NameStringComparisonAvailableValuesFilter filter = ((NameStringComparisonAvailableValuesFilter)f);   %>
83    <%: Html.Label(filter.Label)%>
[6170]84    <%: Html.Label("=")%>
85    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(filter.AvailableValues, filter.Value))%>
86    <% }
[6163]87else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name))
88{ %>
89    <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f);   %>
90    <%: Html.Label(filter.Label)%>
[6190]91    <%: Html.Label("<")%>
[6170]92    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
93    <% }
[6163]94else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
95{ %>
96    <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f);   %>
97    <%: Html.Label(filter.Label)%>
[6190]98    <%: Html.Label("<")%>
[6170]99    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
100    <% }
101else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
[6163]102{ %>
103    <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f);   %>
104    <%: Html.Label(filter.Label)%>
[6190]105    <%: Html.Label("<")%>
[6170]106    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
107    <% }                 
[6163]108                 
[6141]109    %>
[6170]110    <%: Html.ActionLink("remove", "DeleteFilter", new { f.Id })%>
111
112<% }%>
113    </td></tr></table>
114    <% } %>
115 <%  }%>
[6141]116<% }
[6170]117     
118%> </td></tr>
119</table></div>
Note: See TracBrowser for help on using the repository browser.