Ejemplo n.º 1
0
        ///筛选,使用DataTable的Select方法筛选
        private void linklblSift_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (Items == null)
            {
                Items = new SiftItem[_dtSource.Columns.Count];

                for (int i = 0; i < _dtSource.Columns.Count; i++)
                {
                    Items[i]          = new SiftItem();
                    Items[i].Display  = _dtSource.Columns[i].ColumnName;
                    Items[i].Value    = _dtSource.Columns[i].ColumnName;
                    Items[i].SiftType = SiftTypeEnum.Text;
                }
            }

            FrmSift frm = new FrmSift(Items);

            frm.Text = "筛选";
            frm.ShowDialog();

            if (frm.DialogResult != DialogResult.OK)
            {
                return;
            }
            _filter = frm.StrWhere;
            BindData();
        }
Ejemplo n.º 2
0
        public FrmMain()
        {
            InitializeComponent();

            dgvBLL = new DataGridViewBll(dataGridView1);

            btnSearch.Click += delegate
            {
                _strWhere = GetWhere();
                BindData();
            };

            btnFilter.Click += delegate
            {
                FrmSift      frm    = new FrmSift(this.dataGridView1, 1);
                DialogResult result = frm.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return;
                }
                _strWhere = frm.StrWhere;
                BindData();
            };

            chbxList.Click += delegate
            {
                FrmFilter frm = new FrmFilter();
                frm.Data = SqlHelper.GetData(string.Empty);
                DialogResult result = frm.ShowDialog();
                chbxList.Checked = false;

                if (result == DialogResult.OK)
                {
                    BindData();

                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        if (frm.CheckList.Contains(dataGridView1.Rows[i].Cells["GUID"].Value.ToString()))
                        {
                            dataGridView1.Rows[i].Selected = true;
                        }
                    }
                }
            };
        }
Ejemplo n.º 3
0
      ///筛选,使用DataTable的Select方法筛选
      private void linklblSift_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
      {
         if (Items == null)
         {
            Items = new SiftItem[_dtSource.Columns.Count];

            for (int i = 0; i < _dtSource.Columns.Count; i++)
            {
               Items[i] = new SiftItem();
               Items[i].Display = _dtSource.Columns[i].ColumnName;
               Items[i].Value = _dtSource.Columns[i].ColumnName;
               Items[i].SiftType = SiftTypeEnum.Text;
            }
         }

         FrmSift frm = new FrmSift(Items);
         frm.Text = "筛选";
         frm.ShowDialog();

         if (frm.DialogResult != DialogResult.OK) return;
         _filter = frm.StrWhere;
         BindData();
      }