示例#1
0
 public DateFilter(ExCell exCell) : base()
 {
     {
         From = DateTime.Now.AddDays(-1);
         To   = DateTime.Now;
     }
 }
示例#2
0
        public FilterProto()
        {
            var FilterRng = Current.CurRegion.ActiveCell;
            int col       = FilterRng.Column - Current.CurRegion.TblRange.FirstCol;

            Setter = new TableFilterSetter(this, true);
            Name   = Current.CurRegion.ActiveRow.ExCells[col].ColName;
            var tmpCell = new ExCell(FilterRng, true);

            ValueList  = tmpCell.ValList;
            _canFilter = true;
            _enabled   = true;
        }
示例#3
0
        public static void AddFilter(Range activeCell)
        {
            if (activeCell == null)
            {
                return;
            }
            var cell = new ExCell(activeCell, true);
            var flt  = CreateFilter(cell);

            if (flt != null && !Filters.Contains(flt))
            {
                Filters.Add(flt);
            }
        }
示例#4
0
        public NumericFilter(ExCell exCell) : base()
        {
            var values = exCell.ValList.Where(v => v.Type == CellValue.CellValType.Numeric).
                         Select(v => v.ValDouble).ToArray();

            if (values.Any())
            {
                _from = values.Min();
                _to   = values.Max();
            }
            else
            {
                From = _from = _to;
            }
        }
示例#5
0
 public TimeFilter(ExCell exCell) : base()
 {
     ValList = exCell.ValList.Where(v => v.Type == CellValue.CellValType.Time).
               Select(v => v.ValTime).OrderBy(v => v).ToArray();
     if (ValList.Any())
     {
         _from = ValList.Min();
         _to   = ValList.Max();
     }
     else
     {
         _from = new TimeSpan(0);
         _to   = new TimeSpan(23, 59, 59);
     }
 }
示例#6
0
        private static FilterProto CreateFilter(ExCell activeExCell)
        {
            switch (activeExCell.Value.Type)
            {
            case CellValue.CellValType.String:
                return(new StrFilter(activeExCell));

            case CellValue.CellValType.Numeric:
                return(new NumericFilter(activeExCell));

            case CellValue.CellValType.Date:
                return(new DateFilter(activeExCell));

            case CellValue.CellValType.Time:
                return(new TimeFilter(activeExCell));

            default:
                return(new StrFilter(activeExCell));
            }
        }
示例#7
0
 public StrFilter(ExCell exCell) : base()
 {
     _patt = "";
 }