Exemple #1
0
        public Insert Set(ColumnPredicate columnPredicate)
        {
            if (columnPredicate.Comparison != Comparison.Equal)
            {
                throw new NotSupportedException("Only Equal (==) comparisons are supported for this method.");
            }

            if (columnPredicate.NextInGroup != null)
            {
                throw new NotSupportedException("Multiple comparison operators are not supported for this method.");
            }

            ColumnValues.Add(columnPredicate.Column, columnPredicate.Value);
            return(this);
        }
Exemple #2
0
        public Solver(List <List <int> > puzzle)
        {
            for (var i = 0; i < 9; i++)
            {
                RowValues.Add(new List <bool> {
                    false, false, false, false, false, false, false, false, false, false
                });
                ColumnValues.Add(new List <bool> {
                    false, false, false, false, false, false, false, false, false, false
                });
                SquareValues.Add(new List <bool> {
                    false, false, false, false, false, false, false, false, false, false
                });
            }

            this.Puzzle = puzzle;
            this.ConfigureInitialPossibilities();
            this.Solve();
        }
Exemple #3
0
        public void GetValues(string propName)
        {
            Task.Run(() =>
            {
                for (int i = 0; i < _ranges.Length; i++)
                {
                    var lowBound  = Convert.ToDouble(_ranges[i]);
                    int highBound = 0;
                    int count     = 0;
                    string title  = "";


                    if (i != _ranges.Length - 1)
                    {
                        highBound = _ranges[i + 1];
                    }

                    var pacients = IoC.IoC.Container.Resolve <DataContext>().Pacients;
                    var param    = Expression.Parameter(typeof(Pacient));

                    if (i == 0)
                    {
                        //Creates lambda expresion
                        var condition =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.LessThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), lowBound.GetType()),
                                    Expression.Constant(lowBound)
                                    ),
                                param
                                ).Compile();

                        count = pacients.ToList().Count(condition);
                        title = $"less then {lowBound}";
                    }

                    else if (i == _ranges.Length - 1)
                    {
                        //Creates lambda expresion
                        var condition =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.GreaterThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), lowBound.GetType()),
                                    Expression.Constant(lowBound)
                                    ),
                                param
                                ).Compile();

                        count = pacients.ToList().Count(condition);

                        title = $"more then {lowBound}";
                    }
                    else
                    {
                        var lessCond =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.GreaterThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), lowBound.GetType()),
                                    Expression.Constant(lowBound)
                                    ),
                                param
                                ).Compile();

                        var greaterCond =
                            Expression.Lambda <Func <Pacient, bool> >(
                                Expression.LessThanOrEqual(
                                    Expression.Convert(Expression.Property(param, propName), highBound.GetType()),
                                    Expression.Constant(highBound)
                                    ),
                                param
                                ).Compile();

                        count = pacients.ToList().Where(lessCond).Where(greaterCond).Count();


                        title = $"{lowBound} - {highBound}";
                    }


                    ColumnValues.Add(count);
                    ColumnLabels[i] = title;
                }
            });
        }
Exemple #4
0
            public void AddColumn(String headerName, String value)
            {
                CsvColumn csc = new CsvColumn(headerName, value);

                ColumnValues.Add(csc);
            }
Exemple #5
0
 public Insert Set(IQueryableColumn column, object value)
 {
     ColumnValues.Add(column, value);
     return(this);
 }