/// <summary> /// 刷新数据 /// </summary> public void DataRefresh() { modules.Clear(); tableLayoutPanel1.Controls.Clear(); List <BasicDataModule> obj = (List <BasicDataModule>)SqliteHelper.Select(TableName.BasicData); if (obj != null && obj.Count > 0) { foreach (var item in obj) { if (item.Level != 1) { continue; } modules.Add(item.ID, item); IndicatorControl control = new IndicatorControl(); control.IndicatorName = item.Name; control.IndicatorGrade = item.Grade.ToString(); control.UpdateClick += Control_UpdateClick; control.DeleteClick += Control_DeleteClick; control.Name = item.ID.ToString(); tableLayoutPanel1.Controls.Add(control); } } }
/// <summary> /// 一级指标改变事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void combo_one_SelectedIndexChanged(object sender, EventArgs e) { tableLayoutPanel1.Controls.Clear(); int id = -1; id = dataHelper.GetCurrentId(modules, ((ComboBox)sender).SelectedItem.ToString()); if (id == -1) { return; } foreach (var item in modules) { if (item.Value.ParentId == id) { IndicatorControl control = new IndicatorControl(); control.IndicatorName = item.Value.Name; control.IndicatorGrade = item.Value.Grade.ToString(); control.UpdateClick += Control_UpdateClick; control.DeleteClick += Control_DeleteClick; control.Name = item.Value.ID.ToString(); tableLayoutPanel1.Controls.Add(control); } } }