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 LodaData() { DataTable dt = _action.Query(); if (dt != null) { if (dataGridViewList.Columns.Count == 0) { DataGridViewHelper.SetDataGridViewHead(dataGridViewList, DataViewGridColumnsConfig.StoreSettings); } dataGridViewList.DataSource = dt; } }
private void InitData() { StoreAction storeAction = new StoreAction(); DataTable dtstore = storeAction.Query(); if (dtstore != null && dtstore.Rows.Count > 0) { DataRow dr = dtstore.NewRow(); dr["ID"] = Guid.Empty; dr["NAME"] = "---"; dtstore.Rows.InsertAt(dr, 0); comboBoxStore.DataSource = dtstore; comboBoxStore.DisplayMember = "Name"; //comboBoxStore.ValueMember = "ID"; } }