Beispiel #1
0
        public (char letter, int number) GetFieldCoordinates()
        {
            var letter = FieldEnum.ToString()[0];
            var number = int.Parse(FieldEnum.ToString()[1].ToString());

            return(letter, number);
        }
Beispiel #2
0
        /// <summary>
        /// Getting simple predicate
        /// </summary>
        /// <param name="field">Predicate entity field</param>
        /// <param name="fieldValue">Predicate field value</param>
        /// <param name="operation">Predicate operation</param>
        /// <returns>Predicate</returns>
        public virtual Expression <Func <T, bool> > GetPredicate(FieldEnum field, object fieldValue, OperationEnum operation)
        {
            var parameter     = Expression.Parameter(typeof(T), "x");
            var property      = Expression.Property(parameter, field.ToString());
            var constantValue = GetConstantValue(fieldValue, property, operation);
            var expression    = GetOperationExpression(operation, property, constantValue);
            var lambda        = Expression.Lambda <Func <T, bool> >(expression, parameter);

            return(lambda);
        }
Beispiel #3
0
        /// <summary>
        /// Getting null-predicate
        /// </summary>
        /// <param name="field">Predicate field</param>
        /// <param name="fieldType">Predicate field type</param>
        /// <returns>Null-predicate</returns>
        public virtual Expression <Func <T, bool> > GetNullPredicate(FieldEnum field, Type fieldType)
        {
            var parameter     = Expression.Parameter(typeof(T), "x");
            var property      = Expression.Property(parameter, field.ToString());
            var constantValue = Expression.Constant(null, fieldType);

            var expression = Expression.Equal(property, constantValue);
            var lambda     = Expression.Lambda <Func <T, bool> >(expression, parameter);

            return(lambda);
        }
Beispiel #4
0
 private static string SimpleValueExtractor(IStatisticalUnit unit, FieldEnum field)
 {
     return(unit.GetType().GetProperty(field.ToString())?.GetValue(unit, null)?.ToString() ?? string.Empty);
 }