private void InitData() { comboBoxTime.Items.AddRange(_defineTimeDic.Keys.ToArray <Object>()); DataDicAction action = new DataDicAction(); DataTable dt = action.GetList("交易来源"); if (dt != null) { DataRow dr = dt.NewRow(); dr["ID"] = Guid.Empty; dr["CODE"] = "--"; dt.Rows.InsertAt(dr, 0); comboBoxSource.ValueMember = "ID"; comboBoxSource.DisplayMember = "CODE"; comboBoxSource.DataSource = dt; } StoreAction storeAction = new StoreAction(); DataTable store = storeAction.Query(); if (store != null) { DataRow dr = store.NewRow(); dr["ID"] = Guid.Empty; dr["Name"] = "--"; store.Rows.InsertAt(dr, 0); comboBoxStore.ValueMember = "ID"; comboBoxStore.DisplayMember = "NAME"; comboBoxStore.DataSource = store; } }
private void LoadData() { DataTable dt = _action.GetList(); if (dt != null) { if (dataGridViewList.Columns.Count == 0) { DataGridViewHelper.SetDataGridViewHead(dataGridViewList, DataViewGridColumnsConfig.DataDicSettings); } dataGridViewList.DataSource = dt; } }