예제 #1
0
        private void GetDataFilter(List <FilterRow> listFilter)
        {
            // Get data DateTime checked
            if (ckbDateTime1.Checked)
            {
                AddDateTimeFilter(ref listFilter, cmbDateHeader1, cmbAMPMFrom1, cmbAMPMTo1, dtpFrom1, dtpTo1);
            }

            if (ckbDateTime2.Checked)
            {
                AddDateTimeFilter(ref listFilter, cmbDateHeader2, cmbAMPMFrom2, cmbAMPMTo2, dtpFrom2, dtpTo2);
            }

            // Get data grid filter
            foreach (DataGridViewRow row in gridViewFilter.Rows)
            {
                if (row.Cells[0].Value == null || row.Cells[1].Value == null || row.Cells[2].Value == null)
                {
                    continue;
                }
                int    valueCmb = (int)row.Cells[0].Value;
                string textCmb  = row.Cells[0].FormattedValue.ToString();

                FilterRow rowFilter = new FilterRow();
                rowFilter.IsComboboxDateTime  = false;
                rowFilter.ColumnFilter        = new HeaderNameZPEAK();
                rowFilter.ColumnFilter.Column = valueCmb;
                rowFilter.ColumnFilter.Name   = textCmb;
                rowFilter.Compare             = row.Cells[1].Value.ToString();
                rowFilter.Value = row.Cells[2].Value.ToString();
                listFilter.Add(rowFilter);
            }
        }
예제 #2
0
        private void AddDateTimeFilter(ref List <FilterRow> listFilter, ComboBox cmbDateTime, ComboBox cmbAMPMFrom, ComboBox cmbAMPMTo, DateTimePicker dtpFrom, DateTimePicker dtpTo)
        {
            if ((int)cmbDateTime.SelectedValue != -1)
            {
                FilterRow rowFilter = new FilterRow();
                rowFilter.IsComboboxDateTime  = true;
                rowFilter.ColumnFilter        = new HeaderNameZPEAK();
                rowFilter.ColumnFilter.Column = (int)cmbDateTime.SelectedValue;
                rowFilter.ColumnFilter.Name   = cmbDateTime.AccessibilityObject.Value;
                rowFilter.DateTime            = new FilterDateTime();
                rowFilter.DateTime.FromDate   = dtpFrom.Value;
                rowFilter.DateTime.ToDate     = dtpTo.Value;
                rowFilter.DateTime.AMPMFrom   = cmbAMPMFrom.AccessibilityObject.Value;
                rowFilter.DateTime.AMPMTo     = cmbAMPMTo.AccessibilityObject.Value;

                if (rowFilter.ColumnFilter.Column != -1)
                {
                    listFilter.Add(rowFilter);
                }
            }
        }