Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6163


Ignore:
Timestamp:
05/07/11 15:37:20 (13 years ago)
Author:
dhohl
Message:

additional functions vor query plugin
-delte
-gui components

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

Legend:

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

    r6141 r6163  
    2626
    2727            QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester");
     28           
     29
    2830           long[] ids =  client.GetRunIds(qm.Content);
    2931
     
    4951        public ActionResult AddFilterAnd(FormCollection collection)
    5052        {
     53            Response.Write("AddFilterAnd");
     54
    5155            CombinedFilter content = (CombinedFilter)Session["Content"];
    5256            FilterModel fm = new FilterModel(content);
     
    150154            // Add the new filter
    151155            filterList.Add(filter);
     156            Response.Write("addx:" + filter.Id); 
     157
    152158            parent.Filters = filterList.ToArray<Filter>();
    153159
     
    157163            content.Filters = orFilters.ToArray<Filter>();
    158164
     165
     166
     167            Response.Write("content add:" + content.Filters[0].Id);
     168
     169
    159170            // Set Content
    160171            Session["Content"] = content;
     
    163174
    164175            return View("Index", fm);
     176        }
     177
     178
     179        public ActionResult DeleteFilter(Guid id)
     180        {
     181            //Response.Write("Delete id:" + id);
     182
     183            CombinedFilter masterFilter = (CombinedFilter)Session["Content"];
     184
     185            Response.Write("content del:" + masterFilter.Filters[0].Id);
     186
     187            FilterModel fm = new FilterModel(masterFilter); 
     188            RemoveFilterFromFilterModel(fm, id);
     189                 
     190            masterFilter.Filters = ((CombinedFilter)fm.Content).Filters.ToArray<Filter>();
     191           
     192            // Set Content
     193            Session["Content"] = masterFilter;
     194
     195         //   Response.Write("Delete id3:" + masterFilter.Filters.Length);
     196           
     197            return View("Index", fm);
     198        }
     199
     200
     201        private Filter GetFilterForId(Filter [] activeFilters, Guid id)
     202        {
     203            foreach (Filter f in activeFilters)
     204            {
     205                Response.Write(f.Id + " " + id);
     206
     207                if (f.Id.Equals(id))
     208                {
     209                    return f;
     210                }
     211            }
     212            return null;
     213        }
     214
     215        private FilterModel RemoveFilterFromFilterModel(FilterModel fm, Guid id)
     216        {
     217            Response.Write("content :" + fm.Content.Id);
     218            Filter filterToRemove = GetFilterForId(fm.Content.Filters, id);
     219            if (filterToRemove != null)
     220            {
     221                Response.Write("rrrrr:" + id);
     222                fm.Filters.Remove(filterToRemove);
     223            }
     224
     225            return fm;
    165226        }
    166227
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/ViewModels/FilterModel.cs

    r6141 r6163  
    1515    public class FilterModel
    1616    {
     17        private  List<bool> boolStates;
    1718
    1819        private List<Filter> _filters;
     
    4647        }
    4748
     49
     50        public List<Boolean> GetBoolStates()
     51        {
     52            if (boolStates == null)
     53            {
     54                boolStates = new List<Boolean>();
     55                boolStates.Add(true);
     56                boolStates.Add(false);
     57            }
     58            return boolStates;
     59        }
     60
    4861    }
    4962}
  • branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Filter/Filters.ascx

    r6141 r6163  
    3333    <%
    3434           
    35 // If type is StringComparisonFilter build thes controls
     35
    3636if ("StringComparisonFilter".Equals(f.GetType().Name))
    3737{  %>
    38     <%: Html.TextBox(f.Id + ".valueTextbox", ((StringComparisonFilter)f).Value)%>
    39     <%: Html.Label(f.GetType().Name)%>
     38    <% StringComparisonFilter filter = ((StringComparisonFilter)f); %>
     39
     40    <%: Html.Label(filter.Label)%>
     41    <%: Html.Label("=") %>
     42    <%: Html.TextBox(f.Id + ".valueTextbox", (filter.Value))%>
     43    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
    4044    <% }
    41 // If type is NameStringComparisonFilter build thes controls
    4245else if ("NameStringComparisonFilter".Equals(f.GetType().Name))
    4346{ %>
    44     <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id, new{((NameStringComparisonFilter)f).Value})%>
    45     <%: Html.Label(f.GetType().Name)%>
     47    <% NameStringComparisonFilter filter = ((NameStringComparisonFilter)f); %>
     48    <%: Html.Label(filter.Label)%>
     49    <%: Html.Label("= xxx" + f.Id)%>
     50    <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id,  filter.Value )%>
     51    <%: Html.ActionLink("-", "DeleteFilter", new { f.Id })%>
    4652    <% }
     53else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
     54{ %>
     55    <% StringComparisonAvailableValuesFilter filter = ((StringComparisonAvailableValuesFilter)f); %>
     56    <%: Html.Label(filter.Label)%>
     57    <%: Html.Label("=")%>
     58    <%: Html.DropDownList(f.Id + ".valueDropDownList", new SelectList(filter.AvailableValues,filter.Value))%>
     59    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     60<% }
     61else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name))
     62{ %>
     63    <% NameEqualityComparisonByteArrayFilter filter = ((NameEqualityComparisonByteArrayFilter)f); %>
     64    <%: Html.Label(filter.Label)%>   
     65    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     66<% } 
     67else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name))
     68{ %>
     69    <% NameEqualityComparisonBoolFilter filter = ((NameEqualityComparisonBoolFilter)f);
     70    %>
     71    <%: Html.Label(filter.Label)%>
     72    <%: Html.Label("is")%>
     73    <%: Html.DropDownList(f.Id + ".valueDropDownList", new SelectList(((FilterModel)Model).GetBoolStates(),filter.Value)) %>
     74    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     75<% }
     76else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name))
     77{ %>
     78    <% NameOrdinalComparisonIntFilter filter = ((NameOrdinalComparisonIntFilter)f);   %>
     79    <%: Html.Label(filter.Label)%>
     80    <%: Html.Label("is")%>   
    4781
    48 
     82    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     83<% }
     84else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name))
     85{ %>
     86    <% NameStringComparisonAvailableValuesFilter filter = ((NameStringComparisonAvailableValuesFilter)f);   %>
     87    <%: Html.Label(filter.Label)%>
     88    <%: Html.Label("=")%>
     89    <%: Html.DropDownList(f.Id + ".valueDropDownList", new SelectList(filter.AvailableValues,filter.Value))%>   
     90    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     91<% }
     92else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name))
     93{ %>
     94    <% NameOrdinalComparisonDoubleFilter filter = ((NameOrdinalComparisonDoubleFilter)f);   %>
     95    <%: Html.Label(filter.Label)%>
     96    <%: Html.Label("=")%>
     97    <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id,  filter.Value )%>   
     98    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     99<% }
     100else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
     101{ %>
     102    <% NameOrdinalComparisonFloatFilter filter = ((NameOrdinalComparisonFloatFilter)f);   %>
     103    <%: Html.Label(filter.Label)%>
     104    <%: Html.Label("=")%>
     105    <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id,  filter.Value )%>   
     106    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%>
     107<% } 
     108    else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name))
     109{ %>
     110    <% NameOrdinalComparisonLongFilter filter = ((NameOrdinalComparisonLongFilter)f);   %>
     111    <%: Html.Label(filter.Label)%>
     112    <%: Html.Label("=")%>
     113    <%: Html.TextBox(f.Id + ".valueTextbox" + f.Id,  filter.Value )%>
     114    <%: Html.ActionLink("-","DeleteFilter",  f.Id )%> 
     115<% }                 
     116                 
     117       
     118   
     119   
     120     
     121   
     122   
     123   
     124   
    49125else
    50126{ %>
Note: See TracChangeset for help on using the changeset viewer.