Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6102


Ignore:
Timestamp:
05/02/11 21:40:26 (13 years ago)
Author:
dhohl
Message:

#1499 query filter
recursive layout of the filters

Location:
branches/WebApplication/MVC2/HLWebOKBQueryPlugin
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Controllers/FilterController.cs

    r6097 r6102  
    1818        // GET: /Filter/
    1919
    20 
    2120        [ChildActionOnly]
    2221        public ActionResult Filters()
    2322        {
     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
    2434            // For ModelViewuUserControl
    25             return PartialView("Filters"); // name of usercontrol
     35            return PartialView("Filters", qm); // name of usercontrol
    2636        }
     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     
    2766
    2867
     
    3574        public ActionResult AddFilter(FormCollection collection)
    3675        {
     76           
     77
    3778            // Model     
    3879            FilterModel qm = new FilterModel();
     
    4687            // Selected filter (from combobox)
    4788            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();
    4994
    5095
    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                    {
    53102
    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                    }
    57105
    58                 qm.SelectedFilters.Add(filter);
    59             }
    60106
    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                    {
    68110
    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)
    72116                    {
    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                        }
    74138                    }
    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.)
    80139                }
    81140            }
    82 
    83141
    84142
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/HLWebOKBQueryPlugin.csproj

    r6097 r6102  
    146146      <LastGenOutput>Reference.cs</LastGenOutput>
    147147    </None>
    148     <Content Include="Views\AlgorithmClass\Index.aspx" />
    149148    <EmbeddedResource Include="Views\Filter\Filters.ascx" />
    150149    <Content Include="Views\Filter\Index.aspx" />
    151150    <Content Include="Views\Home\About.aspx" />
    152151    <Content Include="Views\Home\Index.aspx" />
    153     <EmbeddedResource Include="Views\Shared\FilterControl.ascx" />
    154152    <Content Include="Views\Query\Index.aspx" />
    155153    <EmbeddedResource Include="Views\Query\Menu.ascx" />
     
    197195    <Folder Include="App_Data\" />
    198196    <Folder Include="App_LocalResources\" />
     197    <Folder Include="Views\AlgorithmClass\" />
    199198    <Folder Include="Views\Query\Controls\" />
    200199  </ItemGroup>
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Models/QueryModel.cs

    r6076 r6102  
    2929        }
    3030
    31         // just 4 testing
    32         public IList<RunCollectionData> getTestRuns() {
     31        //// just 4 testing
     32        //public IList<RunCollectionData> getTestRuns() {
    3333
    34             QueryServiceClient client = Query.GetClientFactory();
     34        //    QueryServiceClient client = Query.GetClientFactory();
    3535
    36             if (client != null) {
    37                 IList<RunCollectionData> runs = new List<RunCollectionData>();
     36        //    if (client != null) {
     37        //        IList<RunCollectionData> runs = new List<RunCollectionData>();
    3838
    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;
    4141
    42                 long[] getRuns = new long[2]{1,2};
     42        //        long[] getRuns = new long[2]{1,2};
    4343
    44                 IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>();
     44        //        IList<Run> runList = client.GetRuns(getRuns, false).ToList<Run>();
    4545
    46                 foreach (Run r in runList)
    47                     runs.Add(new RunCollectionData(r));
     46        //        foreach (Run r in runList)
     47        //            runs.Add(new RunCollectionData(r));
    4848
    49                 return runs;
    50             }
    51             return new List<RunCollectionData>();
    52         }
     49        //        return runs;
     50        //    }
     51        //    return new List<RunCollectionData>();
     52        //}
    5353    }
    5454}
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx

    r6097 r6102  
    33<%@ Import Namespace="HLWebOKBQueryPlugin.OKBQueryService" %>
    44<!-- Put all into a form that calls the "AddFilter" Action-->
    5 <% using (Html.BeginForm("AddFilter", "Filter")) %>
     5<% using (Html.BeginForm ("AddFilter", "Filter")) %>
    66<% { %>
    77<p>
     
    2121    <li>
    2222        <%
    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             <% }
    2930               // If type is NameStringComparisonFilter build thes controls
    3031               else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
    3132               { %>
    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               %>
    4256    </li>
    4357    <% }
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Query/Menu.ascx

    r6097 r6102  
    33<ul>
    44<li <% if(Session["SelectedSubMenu"] == "Filter") {%> class="selected" <%}%>>
    5     <%: Html.ActionLink("Filter", "Index", "Filter") %>
     5    <%: Html.ActionLink( "Filter", "Index", "Filter") %>
    66</li>
    77<li <% if(Session["SelectedSubMenu"] == "Results") {%> class="selected" <%}%>>
Note: See TracChangeset for help on using the changeset viewer.