private void btn添加_Click(object sender, EventArgs e) { if (SaveFocusedRow()) { JobGrade item = new JobGrade(); item.薪酬体系 = salary_plan; item.序号 = currRows.Count + 1; currRows.Add(item); gridControl1.RefreshDataSource(); gridView1.FocusedRowHandle = gridView1.RowCount - 1; MyHelper.WriteLog(LogType.信息, "新增职等", item.ToString <JobGrade>()); } }
private void btn删除_Click(object sender, EventArgs e) { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { if (MessageBox.Show("确实删除当前记录吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes) { JobGrade currentItem = (JobGrade)colView.GetFocusedRow(); currRows.Remove(currentItem); currentItem.Delete(); MyHelper.WriteLog(LogType.信息, "删除职等", currentItem.ToString <JobGrade>()); gridControl1.RefreshDataSource(); MessageBox.Show("删除成功。", "删除提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }