- Timestamp:
- 05/07/11 15:37:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Controllers/FilterController.cs
r6141 r6163 26 26 27 27 QueryServiceClient client = Query.GetClientFactory("okbtester", "okbtester"); 28 29 28 30 long[] ids = client.GetRunIds(qm.Content); 29 31 … … 49 51 public ActionResult AddFilterAnd(FormCollection collection) 50 52 { 53 Response.Write("AddFilterAnd"); 54 51 55 CombinedFilter content = (CombinedFilter)Session["Content"]; 52 56 FilterModel fm = new FilterModel(content); … … 150 154 // Add the new filter 151 155 filterList.Add(filter); 156 Response.Write("addx:" + filter.Id); 157 152 158 parent.Filters = filterList.ToArray<Filter>(); 153 159 … … 157 163 content.Filters = orFilters.ToArray<Filter>(); 158 164 165 166 167 Response.Write("content add:" + content.Filters[0].Id); 168 169 159 170 // Set Content 160 171 Session["Content"] = content; … … 163 174 164 175 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; 165 226 } 166 227
Note: See TracChangeset
for help on using the changeset viewer.