private static void GetValue(PropertyInfo valProperty, EntityFilter valItem, eBooleanOperatorType valBooleanOperatorType, ref object valValue1, ref object valValue2) { var vType = Nullable.GetUnderlyingType(valProperty.PropertyType) ?? valProperty.PropertyType; int vNumberOfValuesAcceptable = new FilterStatement <string>().NumberOfValuesAcceptable(valBooleanOperatorType); if (vNumberOfValuesAcceptable > 0) { if (vType == typeof(DateTime)) { valValue1 = Convert.ToDateTime(valValue1); } else if (vType == typeof(int)) { valValue1 = Convert.ToInt32(valValue1); } else if (vType == typeof(decimal)) { valValue1 = Convert.ToDecimal(valValue1); } else if (vType == typeof(bool)) { valValue1 = Convert.ToBoolean(valItem.Value3); } else if (vType.IsEnum) { valValue1 = Enum.ToObject(vType, Convert.ToInt32(valItem.Value3)); } } else { valValue1 = null; } if (vNumberOfValuesAcceptable == 2) { if (vType == typeof(DateTime)) { valValue2 = Convert.ToDateTime(valValue2); } else if (vType == typeof(int)) { valValue2 = Convert.ToInt32(valValue2); } else if (vType == typeof(decimal)) { valValue2 = Convert.ToDecimal(valValue2); } } else { valValue2 = null; } }
private static object ListValores(Type valPropertyType) { FilterStatement <string> vFilterStatement = new FilterStatement <string>(); List <eBooleanOperatorType> vList = vFilterStatement.SupportedOperations(valPropertyType); List <object> vResult = new List <object>(); foreach (var item in vList) { vResult.Add(new { Descripcion = item.GetDescription(), Value = item, NumeroDeParametros = vFilterStatement.NumberOfValuesAcceptable(item) }); } return(vResult); }
public void Add <TPropertyType>(string valPropertyName, eBooleanOperatorType valBooleanOperator, eLogicOperatorType valLogicOperator, TPropertyType value, TPropertyType value2) { IFilterStatement statement = new FilterStatement <TPropertyType>(valPropertyName, valBooleanOperator, value, value2, valLogicOperator); _Statements.Add(statement); }