Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6190


Ignore:
Timestamp:
05/12/11 20:08:00 (13 years ago)
Author:
dhohl
Message:

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

Location:
branches/WebApplication/MVC2/HLWebOKBQueryPlugin
Files:
2 added
4 edited

Legend:

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

    r6170 r6190  
    2626
    2727            QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester");
    28            
    29 
    30            long[] ids = client.GetRunIds(qm.Content);
     28
     29
     30            long[] ids = client.GetRunIds(qm.Content);
    3131
    3232            Response.Write("Found <" + ids.Count() + "> Runs.");
     
    5252        /// <returns></returns>
    5353        public ActionResult AddFilterAnd(FormCollection collection)
    54         {       
     54        {
    5555            FilterModel fm = new FilterModel((CombinedFilter)Session["Content"]);
    5656
    5757
    5858            // Add Filter
    59            
     59
    6060            String idKey = null;
    6161            String parentIdKey = null;
     
    135135        {
    136136            // Get Content from Session
    137             FilterModel fm = new FilterModel((CombinedFilter)Session["Content"]); 
    138            
     137            FilterModel fm = new FilterModel((CombinedFilter)Session["Content"]);
     138
    139139            // Remove Filter
    140            bool filterRemoved = fm.RemoveFilter(id);
    141        
     140            bool filterRemoved = fm.RemoveFilter(id);
     141
    142142            // Set Content
    143143            Session["Content"] = fm.Content;
    144            
     144
    145145            return View("Index", fm);
    146146        }
     
    181181        public ActionResult Index()
    182182        {
    183            
     183
    184184            // Set submenu
    185185            Session["SelectedSubMenu"] = "Filter";
     
    201201            CombinedFilter f = (CombinedFilter)Session["Content"];
    202202            fm.Content = f;
    203            
    204            
     203
     204
    205205            return View(fm);
    206206        }
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/HLWebOKBQueryPlugin.csproj

    r6141 r6190  
    103103    <Compile Include="Models\ChartModel.cs" />
    104104    <Compile Include="Models\Filter.cs" />
     105    <Compile Include="ViewModels\ComparisonItem.cs" />
     106    <Compile Include="ViewModels\ComparisonsHelper.cs" />
    105107    <Compile Include="ViewModels\FilterModel.cs" />
    106108    <Compile Include="Models\QueryModel.cs" />
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/ViewModels/FilterModel.cs

    r6170 r6190  
    55using HLWebOKBQueryPlugin.OKBQueryService;
    66using HLWebOKBQueryPlugin.Helpers;
     7using HLWebOKBQueryPlugin.ViewModels;
    78
    89namespace HLWebOKBQueryPlugin.Models
     
    1516    public class FilterModel
    1617    {
     18       
     19
    1720
    1821        public static string ComboboxName { get { return "filtersCombobox"; } }
     
    2023        public static string ValueTextbox { get { return "valueTextbox"; } }
    2124        public static string ValueDropDownList { get { return "valueDropDownList"; } }
    22 
     25        public static string ComparisonDropDownList { get { return "comparisonDropDownList"; } }
    2326
    2427        /// <summary>
     
    5356
    5457
     58        public static List<ComparisonItem> OrdinalComparisons
     59        {
     60            get { return ComparisonsHelper.ordinalComparisons; }
     61        }
     62
     63        public static List<ComparisonItem> StringComparisons
     64        {
     65            get { return ComparisonsHelper.stringComparisons; }
     66        }
     67       
     68
     69        //"<";
     70        //else if (Content.Comparison == OrdinalComparison.LessOrEqual)
     71        //  comparisonComboBox.SelectedItem = "<=";
     72        //else if (Content.Comparison == OrdinalComparison.Equal)
     73        //  comparisonComboBox.SelectedItem = "=";
     74        //else if (Content.Comparison == OrdinalComparison.GreaterOrEqual)
     75        //  comparisonComboBox.SelectedItem = ">=";
     76        //else if (Content.Comparison == OrdinalComparison.Greater)
     77        //  comparisonComboBox.SelectedItem = ">";
     78        //else if (Content.Comparison == OrdinalComparison.NotEqual)
     79        //  comparisonComboBox.SelectedItem = "<>"
     80
     81
     82
     83
     84
    5585        /// <summary>
    5686        /// Available Filters
     
    6191            {
    6292                QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester");
    63                 return client.GetFilters().ToList<Filter>();
     93                Filter[] filters = client.GetFilters();
     94
     95                if (filters == null)
     96                {
     97                    return new List<Filter>();
     98                }
     99                return filters.ToList<Filter>();
    64100            }
    65101        }
     
    87123        public CombinedFilter Content { get; set; }
    88124
    89      
     125
    90126
    91127        /// <summary>
     
    171207                                if (kvp.Key.Equals(FilterModel.ValueTextbox))
    172208                                {
    173                                     ((StringComparisonFilter)f).Value = kvp.Value;
     209                                    ((StringComparisonFilter)f).Value = kvp.Value + "111";
     210                                }
     211                                else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList))
     212                                {
     213                                    ((StringComparisonFilter)f).Value = ((StringComparisonFilter)f).Value + "222";
     214                                    ((StringComparisonFilter)f).Comparison = ComparisonsHelper.GetStringComparisonForValue(kvp.Value);
    174215                                }
    175216                                // To this for alle keys
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx

    r6170 r6190  
    4040    <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
    4141    <%: Html.Label(filter.Label)%>
    42     <%: Html.Label("=")%>
     42    <%: Html.DropDownList(f.Id + "." + FilterModel.ComparisonDropDownList, new SelectList(FilterModel.StringComparisons,"Value","Text", filter.Comparison))%>   
    4343    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, (filter.Value))%>
    4444    <% }
     
    4747    <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
    4848    <%: Html.Label(filter.Label)%>
    49     <%: Html.Label("=" + f.Id)%>
     49    <%: Html.Label("=")%>
    5050    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    5151    <% }
     
    6161    <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
    6262    <%: Html.Label(filter.Label)%>
     63      <%: Html.Label("teby")%>
    6364    <% }
    6465else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
     
    6768    %>
    6869    <%: Html.Label(filter.Label)%>
    69     <%: Html.Label("is")%>
     70    <%: Html.Label("is") %>
    7071    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(((FilterModel)Model).BoolStates, filter.Value))%>
    7172    <% }
     
    7475    <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f);   %>
    7576    <%: Html.Label(filter.Label)%>
    76     <%: Html.Label("is")%>
     77    <%: Html.DropDownList(f.Id + "." + FilterModel.ValueDropDownList, new SelectList(FilterModel.OrdinalComparisons,"Value","Text", filter.Comparison))%>
     78    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    7779    <% }
    7880else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
     
    8789    <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f);   %>
    8890    <%: Html.Label(filter.Label)%>
    89     <%: Html.Label("=")%>
     91    <%: Html.Label("<")%>
    9092    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    9193    <% }
     
    9496    <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f);   %>
    9597    <%: Html.Label(filter.Label)%>
    96     <%: Html.Label("=")%>
     98    <%: Html.Label("<")%>
    9799    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    98100    <% }
     
    101103    <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f);   %>
    102104    <%: Html.Label(filter.Label)%>
    103     <%: Html.Label("=")%>
     105    <%: Html.Label("<")%>
    104106    <%: Html.TextBox(f.Id + "." + FilterModel.ValueTextbox, filter.Value)%>
    105107    <% }                 
Note: See TracChangeset for help on using the changeset viewer.