Exemplo n.º 1
0
 public DateFilter(FileDateType type, DateImplication dateImplication, DateTime dateValue)
 {
     _enabled = true;
     _dateType = type;
     _dateImplication = dateImplication;
     _dateValue = dateValue;
 }
Exemplo n.º 2
0
        private void SearchImpl()
        {
            // set options
            text = SearchTextbox.Text.Trim();
            matchCase = MatchCaseCheckbox.Checked;
            searchFailed = SearchFailedCheckbox.Checked;
            searchErrors = SearchErrorsCheckbox.Checked;

            filterText = text != "";
            filterDate = DateCheckbox.Checked;
            filterFailed = FailedCheckbox.Checked;
            filterError = ErrorCheckbox.Checked;

            if(filterDate) {
                switch(DateCombobox.SelectedIndex) {
                    case 0: {
                        dateImplication = DateImplication.OlderOrFrom;
                        break;
                    }
                    case 1: {
                        dateImplication = DateImplication.From;
                        break;
                    }
                    case 2: {
                        dateImplication = DateImplication.NewerOrFrom;
                        break;
                    }
                }

                dateValue = DateValue.Value;
            }

            if(filterFailed) {
                switch(FailedCombobox.SelectedIndex) {
                    case 0: {
                        failedImplication = SizeImplication.LessThan;
                        break;
                    }
                    case 1: {
                        failedImplication = SizeImplication.Equals;
                        break;
                    }
                    case 2: {
                        failedImplication = SizeImplication.GreaterThan;
                        break;
                    }
                }

                failedValue = (int)FailedNumber.Value;
            }

            if(filterError) {
                switch(ErrorCombobox.SelectedIndex) {
                    case 0: {
                        errorImplication = SizeImplication.LessThan;
                        break;
                    }
                    case 1: {
                        errorImplication = SizeImplication.Equals;
                        break;
                    }
                    case 2: {
                        errorImplication = SizeImplication.GreaterThan;
                        break;
                    }
                }

                errorValue = (int)ErrorNumber.Value;
            }

            reportModule.ReportList.Items.Clear();

            // filter all reports
            foreach(KeyValuePair<Guid, ReportCategory> category in _reportManager.Categories) {
                foreach(KeyValuePair<long, ReportInfo> info in category.Value.Reports) {
                    if(FilterReport(info.Value)) {
                        // add to the list
                        reportModule.AddReport(info.Value);
                    }
                }
            }
        }