- Timestamp:
- 05/21/11 16:13:05 (14 years ago)
- Location:
- branches/WebApplication/MVC2/HLWebOKBQueryPlugin/ViewModels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/ViewModels/ComparisonsHelper.cs
r6191 r6245 22 22 private static String STRING_COMPARISONS_NOT_LIKE = "not like"; 23 23 24 private static String BOOL_COMPARISONS_EQUAL = "="; 25 private static String BOOL_COMPARISONS_NOT_EQUAL = "<>"; 26 27 public static List<ComparisonItem> boolComparisons = new List<ComparisonItem>() 28 { new ComparisonItem((int)OKBQueryService.EqualityComparison.Equal, BOOL_COMPARISONS_EQUAL), 29 new ComparisonItem((int)OKBQueryService.EqualityComparison.NotEqual, BOOL_COMPARISONS_NOT_EQUAL) 30 }; 24 31 public static List<ComparisonItem> ordinalComparisons = new List<ComparisonItem>() 25 32 { new ComparisonItem((int)OKBQueryService.OrdinalComparison.Less, ORDINAL_COMPARISONS_LESS), … … 40 47 41 48 42 public static String GetValueForStringComparision(OKBQueryService.StringComparison comparisionValue) 43 { 44 switch (comparisionValue) 45 { 46 case OKBQueryService.StringComparison.Equal: 47 return STRING_COMPARISONS_EQUAL; 48 case OKBQueryService.StringComparison.Contains: 49 return STRING_COMPARISONS_CONTAINS; 50 case OKBQueryService.StringComparison.Like: 51 return STRING_COMPARISONS_LIKE; 52 case OKBQueryService.StringComparison.NotContains: 53 return STRING_COMPARISONS_NOT_CONTAINS; 54 case OKBQueryService.StringComparison.NotEqual: 55 return STRING_COMPARISONS_NOT_EQUAL; 56 case OKBQueryService.StringComparison.NotLike: 57 return STRING_COMPARISONS_NOT_LIKE; 58 default: 59 return STRING_COMPARISONS_EQUAL; //TODO 60 } 61 } 49 //public static String GetValueForStringComparision(OKBQueryService.StringComparison comparisionValue) 50 //{ 51 // switch (comparisionValue) 52 // { 53 // case OKBQueryService.StringComparison.Equal: 54 // return STRING_COMPARISONS_EQUAL; 55 // case OKBQueryService.StringComparison.Contains: 56 // return STRING_COMPARISONS_CONTAINS; 57 // case OKBQueryService.StringComparison.Like: 58 // return STRING_COMPARISONS_LIKE; 59 // case OKBQueryService.StringComparison.NotContains: 60 // return STRING_COMPARISONS_NOT_CONTAINS; 61 // case OKBQueryService.StringComparison.NotEqual: 62 // return STRING_COMPARISONS_NOT_EQUAL; 63 // case OKBQueryService.StringComparison.NotLike: 64 // return STRING_COMPARISONS_NOT_LIKE; 65 // default: 66 // return STRING_COMPARISONS_EQUAL; //TODO 67 // } 68 //} 69 70 62 71 63 72 … … 85 94 } 86 95 } 96 97 public static OKBQueryService.EqualityComparison GetEqualityComparisonForValue(string comparisonValue) 98 { 99 int v = Int32.Parse(comparisonValue); 100 101 switch (v) 102 { 103 case (int)OKBQueryService.EqualityComparison.Equal: 104 return OKBQueryService.EqualityComparison.Equal; 105 case (int)OKBQueryService.EqualityComparison.NotEqual: 106 return OKBQueryService.EqualityComparison.NotEqual; 107 default: 108 return OKBQueryService.EqualityComparison.Equal; //TODO 109 } 110 } 111 112 public static OKBQueryService.OrdinalComparison GetOrdinalComparisonForValue(string comparisonValue) 113 { 114 int v = Int32.Parse(comparisonValue); 115 116 117 118 switch (v) 119 { 120 case (int)OKBQueryService.OrdinalComparison.Equal: 121 return OKBQueryService.OrdinalComparison.Equal; 122 case (int)OKBQueryService.OrdinalComparison.Greater: 123 return OKBQueryService.OrdinalComparison.Greater; 124 case (int)OKBQueryService.OrdinalComparison.GreaterOrEqual: 125 return OKBQueryService.OrdinalComparison.GreaterOrEqual; 126 case (int)OKBQueryService.OrdinalComparison.Less: 127 return OKBQueryService.OrdinalComparison.Less; 128 case (int)OKBQueryService.OrdinalComparison.NotEqual: 129 return OKBQueryService.OrdinalComparison.NotEqual; 130 case (int)OKBQueryService.OrdinalComparison.LessOrEqual: 131 return OKBQueryService.OrdinalComparison.LessOrEqual; 132 default: 133 return OKBQueryService.OrdinalComparison.Equal; //TODO 134 } 135 136 137 } 87 138 } 88 139 } -
branches/WebApplication/MVC2/HLWebOKBQueryPlugin/ViewModels/FilterModel.cs
r6191 r6245 56 56 57 57 58 public static List<ComparisonItem> BoolComparisons 59 { 60 get { return ComparisonsHelper.boolComparisons; } 61 } 62 58 63 public static List<ComparisonItem> OrdinalComparisons 59 64 { … … 67 72 68 73 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 74 84 75 85 76 /// <summary> … … 205 196 { 206 197 if ("StringComparisonFilter".Equals(f.GetType().Name)) 207 { 208 209 ((StringComparisonFilter)f).Value = kvp.Value; 210 211 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 212 { 213 ((StringComparisonFilter)f).Value = kvp.Value; // +"111"; 214 215 //((StringComparisonFilter)f).Value = ((StringComparisonFilter)f).Value; 216 // ((StringComparisonFilter)f).Comparison = ((StringComparisonFilter)f).Comparison; 217 218 219 } 220 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 221 { 222 // ((StringComparisonFilter)f).Value = ((StringComparisonFilter)f).Value; 223 ((StringComparisonFilter)f).Comparison = ComparisonsHelper.GetStringComparisonForValue(kvp.Value); 224 225 } 226 // To this for alle keys 227 228 } 198 { 199 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 200 { 201 ((StringComparisonFilter)f).Value = kvp.Value; 202 } 203 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 204 { 205 ((StringComparisonFilter)f).Comparison = ComparisonsHelper.GetStringComparisonForValue(kvp.Value); 206 } 207 } 208 else if ("NameStringComparisonFilter".Equals(f.GetType().Name)) 209 { 210 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 211 { 212 ((NameStringComparisonFilter)f).Value = kvp.Value; 213 } 214 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 215 { 216 ((NameStringComparisonFilter)f).Comparison = ComparisonsHelper.GetStringComparisonForValue(kvp.Value); 217 } 218 } 219 else if ("StringComparisonAvailableValuesFilter".Equals(f.GetType().Name)) 220 { 221 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 222 { 223 ((StringComparisonAvailableValuesFilter)f).Value = kvp.Value; 224 } 225 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 226 { 227 ((StringComparisonAvailableValuesFilter)f).Comparison = ComparisonsHelper.GetStringComparisonForValue(kvp.Value); 228 } 229 } 230 else if ("NameStringComparisonAvailableValuesFilter".Equals(f.GetType().Name)) 231 { 232 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 233 { 234 ((NameStringComparisonAvailableValuesFilter)f).Value = kvp.Value; 235 } 236 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 237 { 238 ((NameStringComparisonAvailableValuesFilter)f).Comparison = ComparisonsHelper.GetStringComparisonForValue(kvp.Value); 239 } 240 } 241 else if ("NameEqualityComparisonByteArrayFilter".Equals(f.GetType().Name)) 242 { 243 //TODO not supported 244 } 245 else if ("NameEqualityComparisonBoolFilter".Equals(f.GetType().Name)) 246 { 247 if (kvp.Key.Equals(FilterModel.ValueDropDownList)) 248 { 249 ((NameEqualityComparisonBoolFilter)f).Value = Boolean.Parse( kvp.Value); 250 } 251 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 252 { 253 ((NameEqualityComparisonBoolFilter)f).Comparison = ComparisonsHelper.GetEqualityComparisonForValue(kvp.Value); 254 } 255 } 256 else if ("NameOrdinalComparisonIntFilter".Equals(f.GetType().Name)) 257 { 258 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 259 { 260 try 261 { 262 ((NameOrdinalComparisonIntFilter)f).Value = Int32.Parse(kvp.Value); 263 } 264 catch (Exception) 265 { 266 //TOOD Fehler ausgeben 267 } 268 } 269 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 270 { 271 ((NameOrdinalComparisonIntFilter)f).Comparison = ComparisonsHelper.GetOrdinalComparisonForValue(kvp.Value); 272 } 273 } 274 else if ("NameOrdinalComparisonLongFilter".Equals(f.GetType().Name)) 275 { 276 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 277 { 278 try 279 { 280 ((NameOrdinalComparisonLongFilter)f).Value = Int64.Parse(kvp.Value); 281 } 282 catch (Exception) 283 { 284 //TOOD Fehler ausgeben 285 } 286 } 287 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 288 { 289 ((NameOrdinalComparisonLongFilter)f).Comparison = ComparisonsHelper.GetOrdinalComparisonForValue(kvp.Value); 290 } 291 } 292 293 else if ("NameOrdinalComparisonFloatFilter".Equals(f.GetType().Name)) 294 { 295 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 296 { 297 try 298 { 299 ((NameOrdinalComparisonFloatFilter)f).Value = float.Parse(kvp.Value); 300 } 301 catch (Exception) 302 { 303 //TOOD Fehler ausgeben 304 } 305 } 306 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 307 { 308 ((NameOrdinalComparisonFloatFilter)f).Comparison = ComparisonsHelper.GetOrdinalComparisonForValue(kvp.Value); 309 } 310 } 311 else if ("NameOrdinalComparisonDoubleFilter".Equals(f.GetType().Name)) 312 { 313 if (kvp.Key.Equals(FilterModel.ValueTextbox)) 314 { 315 try 316 { 317 ((NameOrdinalComparisonDoubleFilter)f).Value = Double.Parse(kvp.Value); 318 } 319 catch (Exception) 320 { 321 //TOOD Fehler ausgeben 322 } 323 } 324 else if (kvp.Key.Equals(FilterModel.ComparisonDropDownList)) 325 { 326 ((NameOrdinalComparisonDoubleFilter)f).Comparison = ComparisonsHelper.GetOrdinalComparisonForValue(kvp.Value); 327 } 328 } 329 330 229 331 else 230 332 { … … 234 336 235 337 } 236 StringComparisonFilter scf = (StringComparisonFilter)f; 237 //throw new Exception("Huhu ich bin doof"); 338 238 339 239 340 }
Note: See TracChangeset
for help on using the changeset viewer.