Пример #1
0
        public override string ExpandWith(DbCommand command, SelectClauseDictionary expressions, string arguments)
        {
            StringBuilder sb          = new StringBuilder();
            int           currentYear = DateTime.Today.Year;

            for (int i = (currentYear - _startYear); (i <= (currentYear + _endYear)); i++)
            {
                DbParameter p  = CreateParameter(command);
                DbParameter p2 = CreateParameter(command);
                DateTime    startDate;
                DateTime    endDate;
                AssignRange(i, out startDate, out endDate);
                p.Value  = startDate;
                p2.Value = endDate;
                if (sb.Length > 0)
                {
                    sb.Append("or");
                }
                if (expressions.ContainsKey("_DataView_RowFilter_"))
                {
                    sb.AppendFormat("({0} >= {1} and {0} <= {2})", expressions[FirstArgument(arguments)], p.ParameterName, p2.ParameterName);
                }
                else
                {
                    sb.AppendFormat("({0} between {1} and {2})", expressions[FirstArgument(arguments)], p.ParameterName, p2.ParameterName);
                }
            }
            return(sb.ToString());
        }
Пример #2
0
        public override string ExpandWith(DbCommand command, SelectClauseDictionary expressions, string arguments)
        {
            DbParameter p = CreateParameter(command);

            p.Value = Controller.StringToValue(SecondArgument(arguments));
            DbParameter p2 = CreateParameter(command);

            p2.Value = Controller.StringToValue(ThirdArgument(arguments));
            if (expressions.ContainsKey("_DataView_RowFilter_"))
            {
                return(String.Format("{0} >= {1} and {0} <= {2}", expressions[FirstArgument(arguments)], p.ParameterName, p2.ParameterName));
            }
            else
            {
                return(String.Format("{0} between {1} and {2}", expressions[FirstArgument(arguments)], p.ParameterName, p2.ParameterName));
            }
        }