Changeset 6102
- Timestamp:
- 05/02/11 21:40:26 (14 years ago)
- Location:
- branches/WebApplication/MVC2/HLWebOKBQueryPlugin
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Controllers/FilterController.cs
r6097 r6102 18 18 // GET: /Filter/ 19 19 20 21 20 [ChildActionOnly] 22 21 public ActionResult Filters() 23 22 { 23 // Model 24 FilterModel qm = new FilterModel(); 25 26 27 //TODO nicht immer laden 28 QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester"); 29 List<Filter> filterList = client.GetFilters().ToList(); 30 qm.Filters = filterList; 31 qm.SelectedFilters = new List<Filter>(); 32 33 24 34 // For ModelViewuUserControl 25 return PartialView("Filters" ); // name of usercontrol35 return PartialView("Filters", qm); // name of usercontrol 26 36 } 37 38 //List<Filter> currentFilters 39 40 [ChildActionOnly] 41 public ActionResult Filters(FilterModel qms) 42 { 43 // Model 44 FilterModel qm = new FilterModel(); 45 46 47 //TODO nicht immer laden 48 QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester"); 49 List<Filter> filterList = client.GetFilters().ToList(); 50 qm.Filters = filterList; 51 qm.SelectedFilters =qms.SelectedFilters; 52 if (qm.SelectedFilters == null) 53 { 54 55 qm.SelectedFilters = new List<Filter>(); 56 } 57 58 59 60 // For ModelViewuUserControl 61 return PartialView("Filters", qm); // name of usercontrol 62 } 63 64 65 27 66 28 67 … … 35 74 public ActionResult AddFilter(FormCollection collection) 36 75 { 76 77 37 78 // Model 38 79 FilterModel qm = new FilterModel(); … … 46 87 // Selected filter (from combobox) 47 88 string filterType = collection.Get("filtersCombobox"); 48 Filter filter = filterList.Where(x => x.FilterTypeName.Equals(filterType)).First(); 89 90 if (filterType != null) 91 { 92 93 Filter filter = filterList.Where(x => x.FilterTypeName.CompareTo(filterType) == 0).First(); 49 94 50 95 51 // Get selected filters form session 52 qm.SelectedFilters = (List<Filter>)Session["selectedFilters"]; 96 if (filter != null) 97 { 98 // Get selected filters form session 99 qm.SelectedFilters = (List<Filter>)Session["selectedFilters"]; 100 if (qm.SelectedFilters == null) 101 { 53 102 54 // Add Filter only if not exists 55 if (qm.SelectedFilters.Where(x => x.FilterTypeName.Equals(filter.FilterTypeName)).Count() == 0) 56 { 103 qm.SelectedFilters = new List<Filter>(); 104 } 57 105 58 qm.SelectedFilters.Add(filter);59 }60 106 61 // Set values for the selected filters 62 foreach (string s in collection.AllKeys) 63 { 64 if (s.StartsWith("valueTextbox")) 65 { 66 // Get the type of the textbox 67 string type = s.Substring(s.IndexOf(".") + 1); 107 // Add Filter only if not exists 108 if (qm.SelectedFilters.Where(x => x.FilterTypeName.Equals(filter.FilterTypeName)).Count() == 0) 109 { 68 110 69 // Get the filter from the selected filters to set the value(s) 70 Filter f = qm.SelectedFilters.Where(x => x.GetType().Name.Equals(type)).First(); 71 if ("StringComparisonFilter".Equals(type)) 111 qm.SelectedFilters.Add(filter); 112 } 113 114 // Set values for the selected filters 115 foreach (string s in collection.AllKeys) 72 116 { 73 ((StringComparisonFilter)f).Value = collection.Get(s); 117 if (s.StartsWith("valueTextbox")) 118 { 119 // Get the type of the textbox 120 string type = s.Substring(s.IndexOf(".") + 1); 121 122 // Get the filter from the selected filters to set the value(s) 123 Filter f = qm.SelectedFilters.Where(x => x.GetType().Name.Equals(type)).First(); 124 if ("StringComparisonFilter".Equals(type)) 125 { 126 ((StringComparisonFilter)f).Value = collection.Get(s); 127 } 128 else if ("NameStringComparisonFilter".Equals(type)) 129 { 130 ((NameStringComparisonFilter)f).Value = collection.Get(s); 131 } 132 else if ("CombinedFilter".Equals(type)) 133 { 134 //((CombinedFilter)f).Filters 135 } 136 // TODO: add for all filter types and will the values (etc.) 137 } 74 138 } 75 else if ("NameStringComparisonFilter".Equals(type))76 {77 ((NameStringComparisonFilter)f).Value = collection.Get(s);78 }79 // TODO: add for all filter types and will the values (etc.)80 139 } 81 140 } 82 83 141 84 142 -
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/HLWebOKBQueryPlugin.csproj
r6097 r6102 146 146 <LastGenOutput>Reference.cs</LastGenOutput> 147 147 </None> 148 <Content Include="Views\AlgorithmClass\Index.aspx" />149 148 <EmbeddedResource Include="Views\Filter\Filters.ascx" /> 150 149 <Content Include="Views\Filter\Index.aspx" /> 151 150 <Content Include="Views\Home\About.aspx" /> 152 151 <Content Include="Views\Home\Index.aspx" /> 153 <EmbeddedResource Include="Views\Shared\FilterControl.ascx" />154 152 <Content Include="Views\Query\Index.aspx" /> 155 153 <EmbeddedResource Include="Views\Query\Menu.ascx" /> … … 197 195 <Folder Include="App_Data\" /> 198 196 <Folder Include="App_LocalResources\" /> 197 <Folder Include="Views\AlgorithmClass\" /> 199 198 <Folder Include="Views\Query\Controls\" /> 200 199 </ItemGroup> -
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Models/QueryModel.cs
r6076 r6102 29 29 } 30 30 31 // just 4 testing32 public IList<RunCollectionData> getTestRuns() {31 //// just 4 testing 32 //public IList<RunCollectionData> getTestRuns() { 33 33 34 QueryServiceClient client = Query.GetClientFactory();34 // QueryServiceClient client = Query.GetClientFactory(); 35 35 36 if (client != null) {37 IList<RunCollectionData> runs = new List<RunCollectionData>();36 // if (client != null) { 37 // IList<RunCollectionData> runs = new List<RunCollectionData>(); 38 38 39 //long[] runIds = client.GetRunIds(new Filter());40 //if (runIds.Length < cnt) cnt = runIds.Length;39 // //long[] runIds = client.GetRunIds(new Filter()); 40 // //if (runIds.Length < cnt) cnt = runIds.Length; 41 41 42 long[] getRuns = new long[2]{1,2};42 // long[] getRuns = new long[2]{1,2}; 43 43 44 IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>();44 // IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>(); 45 45 46 foreach (Run r in runList)47 runs.Add(new RunCollectionData(r));46 // foreach (Run r in runList) 47 // runs.Add(new RunCollectionData(r)); 48 48 49 return runs;50 }51 return new List<RunCollectionData>();52 }49 // return runs; 50 // } 51 // return new List<RunCollectionData>(); 52 //} 53 53 } 54 54 } -
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx
r6097 r6102 3 3 <%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %> 4 4 <!-- Put all into a form that calls the "AddFilter" Action--> 5 <% using (Html.BeginForm ("AddFilter", "Filter")) %>5 <% using (Html.BeginForm ("AddFilter", "Filter")) %> 6 6 <% { %> 7 7 <p> … … 21 21 <li> 22 22 <% 23 // If type is StringComparisonFilter build thes controls 24 if ("StringComparisonFilter".Equals(f.GetType().Name)) 25 { %> 26 <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((StringComparisonFilter)f).Value)%> 27 <%: Html.LabelFor(x => f.Label)%> 28 <% } 23 // If type is StringComparisonFilter build thes controls 24 if ("StringComparisonFilter".Equals(f.GetType().Name)) 25 { %> 26 <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((StringComparisonFilter)f).Value)%> 27 <%: Html.LabelFor(x => f.Label)%> 28 29 <% } 29 30 // If type is NameStringComparisonFilter build thes controls 30 31 else if ("NameStringComparisonFilter".Equals(f.GetType().Name)) 31 32 { %> 32 <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((NameStringComparisonFilter)f).Value)%> 33 <!-- other filter > 34 <% } // If type is StringComparisonFilter build thes controls 35 else 36 { %> 37 <!-- type not supported ... --> 38 FilerTypeName = 39 <%: Html.Label(f.GetType().Name)%> 40 <% } 41 %> 33 <%: Html.TextBox("valueTextbox." + f.GetType().Name, ((NameStringComparisonFilter)f).Value) %> 34 35 <% } 36 else if ("CombinedFilter".Equals(f.GetType().Name)) 37 { %> 38 <% CombinedFilter combiFilter = ((CombinedFilter)f); %> 39 <% List<Filter> comtbiFtilterLis = combiFilter.Filters.ToList<Filter>(); 40 FilterModel m = new FilterModel(); 41 m.Filters = ((FilterModel)Model).Filters; 42 m.SelectedFilters = comtbiFtilterLis; 43 %> 44 <% Html.RenderPartial("Filters", m); %> 45 46 <% } 47 48 49 else 50 { %> 51 <!-- type not supported ... --> 52 FilerTypeName = 53 <%: Html.Label(f.GetType().Name)%> 54 <% } 55 %> 42 56 </li> 43 57 <% } -
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Query/Menu.ascx
r6097 r6102 3 3 <ul> 4 4 <li <% if(Session["SelectedSubMenu"] == "Filter") {%> class="selected" <%}%>> 5 <%: Html.ActionLink( "Filter", "Index", "Filter") %>5 <%: Html.ActionLink( "Filter", "Index", "Filter") %> 6 6 </li> 7 7 <li <% if(Session["SelectedSubMenu"] == "Results") {%> class="selected" <%}%>>
Note: See TracChangeset
for help on using the changeset viewer.