Exemple #1
0
        private void NumberFilter(FilterCriteria filter)
        {
            var paramName = String.Format("@{0}{1}", filter.ColumnToSearch, FilterIndex);
            var param     = new SqlParameter
            {
                ParameterName = paramName,
                Direction     = ParameterDirection.Input,
                SqlDbType     = SqlDbType.Float,
                Value         = filter.SearchNumber,
                Size          = filter.SearchNumber.Length
            };

            switch (filter.SearchOperatorNumber)
            {
            case "isequalto":
                Where = String.Format("[{0}] = {1}", filter.ColumnToSearch, paramName);
                break;

            case "greaterthan":
                Where = String.Format("[{0}] > {1}", filter.ColumnToSearch, paramName);
                break;

            case "greaterthanequalto":
                Where = String.Format("[{0}] >= {1}", filter.ColumnToSearch, paramName);
                break;

            case "lessthan":
                Where = String.Format("[{0}] < {1}", filter.ColumnToSearch, paramName);
                break;

            case "lessthanequalto":
                Where = String.Format("[{0}] <= {1}", filter.ColumnToSearch, paramName);
                break;
            }
            Param = param;
        }
Exemple #2
0
        private void TextFilter(FilterCriteria filter)
        {
            var paramName = String.Format("@{0}{1}", filter.ColumnToSearch, FilterIndex);
            var param     = new SqlParameter
            {
                ParameterName = paramName,
                Direction     = ParameterDirection.Input,
                SqlDbType     = SqlDbType.VarChar
            };

            switch (filter.SearchOperator)
            {
            case "contains":
                param.Value = String.Format("%{0}%", filter.SearchText.ToLower());
                Where       = String.Format("lower([{0}]) like {1}", filter.ColumnToSearch, paramName);
                break;

            case "isequalto":
                param.Value = filter.SearchText.ToLower();
                Where       = String.Format("lower([{0}]) = {1}", filter.ColumnToSearch, paramName);
                break;
            }
            Param = param;
        }