Ejemplo n.º 1
0
        private void updateTable()
        {
            DataTable     newEditTable = new DataTable();
            BindingSource SBind        = new BindingSource();

            bool location = false, date = false;

            location = origin_dest_checkbox.Checked;
            date     = date_checkbox.Checked;

            bool multiPassTableSort = false;

            if (location && date)
            {
                multiPassTableSort = true;
            }

            if (location && !multiPassTableSort)
            {
                string origin      = origin_combobox.Text;
                string destination = dest_combobox.Text;

                if (origin_combobox.SelectedItem != null && dest_combobox.SelectedItem != null)
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(origin, destination);
                }
                else if (origin_combobox.SelectedItem != null && dest_combobox.SelectedItem == null)
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(origin, null);
                }
                else if (origin_combobox.SelectedItem == null && dest_combobox.SelectedItem != null)
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(null, destination);
                }
                else
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(null, null);
                }
            }
            else if (date && !multiPassTableSort)
            {
                DateTime before = beforeDate_DTP.Value.Date;
                DateTime after  = afterDate_DTP.Value.Date;

                if (date_after_checkbox.Checked && date_before_checkbox.Checked)
                {
                    newEditTable = FormDatabaseHelper.updateGridViewTableWithDate(true, true, before, after);
                }
                else if (!date_after_checkbox.Checked && date_before_checkbox.Checked)
                {
                    newEditTable = FormDatabaseHelper.updateGridViewTableWithDate(true, false, before);
                }
                else if (date_after_checkbox.Checked && !date_before_checkbox.Checked)
                {
                    newEditTable = FormDatabaseHelper.updateGridViewTableWithDate(false, true, default, after);