Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 6170 was 6170, checked in by mjesner, 12 years ago

#1499 design, cleanup, remove button

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