/// <summary> /// 新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_add_Click(object sender, EventArgs e) { if (combo_one.Items.Count == 0) { MessageBox.Show("请先添加一级指标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (combo_two.Items.Count == 0) { MessageBox.Show("请先添加二级指标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (combo_three.Items.Count == 0) { MessageBox.Show("请先添加三级指标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (ChangeIndicatorFour dialog = new ChangeIndicatorFour()) { dialog.ChangeTitle = $"新增 四级指标 : {combo_one.SelectedItem} > {combo_two.SelectedItem} > {combo_three.SelectedItem}"; if (dialog.ShowDialog() == DialogResult.OK) { BasicFourModule fourModule = dialog.GetModule; fourModule.ParentId = dataHelper.GetCurrentId(modules, combo_three.SelectedItem.ToString()); SqliteHelper.Insert(TableName.BasicFour, fourModule, out string msg); if (!string.IsNullOrEmpty(msg)) { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DataRefresh(); } } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RowUpdateClick(object sender, DataGridViewCellEventArgs e) { int id = (int)((DataGridView)sender).CurrentRow.Cells["ID"].Value; BasicFourModule preModule = null; foreach (var item in fourModules) { if (item.ID == id) { preModule = item; break; } } if (preModule == null) { return; } RefreshRemark(preModule); using (ChangeIndicatorFour dialog = new ChangeIndicatorFour(preModule)) { dialog.ChangeTitle = "修改 四级级指标"; if (dialog.ShowDialog() == DialogResult.OK) { BasicFourModule currentModule = dialog.GetModule; SqliteHelper.Update(TableName.BasicFour, preModule.ID, currentModule, out string msg); if (string.IsNullOrEmpty(msg)) { DataRefresh(); } else { MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }