Beispiel #1
0
 /// <summary>
 /// 绑定屏幕数据
 /// </summary>
 private void BindData()
 {
     if (this.TargetRoleId.Length > 0)
     {
         this.txtRoleName.Tag  = this.TargetRoleId;
         this.txtRoleName.Text = this.TargetRoleName;
     }
     // 加载员工数据主键
     // 往DataTable中添加选择列
     BasePageLogic.DataTableAddColumn(this.DTUser, "colSelected");
     this.dgvInfo.AutoGenerateColumns = false;
     this.dgvInfo.DataSource          = this.DTUser.DefaultView;
 }
 /// <summary>
 /// 往DataTable里面添加一列
 /// </summary>
 private void DataTableAddColumn(DataTable dt)
 {
     if (!dt.Columns.Contains(BusinessLogic.SelectedColumn))
     {
         BasePageLogic.DataTableAddColumn(dt, BusinessLogic.SelectedColumn, typeof(bool));
     }
     //设置表主键
     DataColumn[] primaryKey = new DataColumn[] { dt.Columns[PiUserTable.FieldId] };
     dt.PrimaryKey = primaryKey;
     // 未必选中状态
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         DTUserList.Rows[i][BusinessLogic.SelectedColumn] = false;
     }
     dt.AcceptChanges();
 }