Exemplo n.º 1
0
        private void BindGridView(string dgvName)
        {
            string    sqlstr = "SELECT * FROM B_ColumnVisibleSetting WHERE cvsFormName='" + dgvName + "'";
            DataTable dt     = Com.YKDataClass.getDataTable(sqlstr);

            _Info = GetDGV(dgvName);
            foreach (DataGridViewColumn col in _Info.dgv.Columns)
            {
                if (dt.Select("cvsColName='" + col.Name + "'").Length == 0)
                {
                    DataRow row = dt.NewRow();
                    row["cvsID"]         = 0;
                    row["cvsFormName"]   = _Info.dgvName;
                    row["cvsFormText"]   = _Info.dgvText;
                    row["cvsColName"]    = col.Name;
                    row["cvsColText"]    = col.HeaderText;
                    row["cvsVisible"]    = col.Visible == true ? 1 : 0;
                    row["cvsOldVisible"] = col.Visible == true ? 1 : 0;
                    dt.Rows.Add(row);
                }
            }
            dt.AcceptChanges();
            dgvColumns.DataSource = dt;
            foreach (DataGridViewRow row in dgvColumns.Rows)
            {
                if (row.Cells["cvsOldVisible"].Value != DBNull.Value &&
                    Convert.ToInt32(row.Cells["cvsOldVisible"].Value) == 0)
                {
                    row.Visible = false;
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Info"></param>
 public FrmSetColumnVisible(SetDgvColumnInfo Info)
     : this()
 {
     _listInfos.Add(Info);
 }