private void btn保存_Click(object sender, EventArgs e) { if (YiKang.Common.IsInteger(text半年调资额.Text) == false) { MessageBox.Show("必须录入半年调资额。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } JobGrade jGrade = grade.职等; jGrade.对比的职等 = (string)cb对比的职等.EditValue; jGrade.职等数 = txt职等数.Text.Trim() == "" ? 1 : Convert.ToInt32(txt职等数.Text.Trim()); jGrade.Save(); //检查级差是否相同 int prev_diff = 0; int x = 0; RankSalaryStandardInput prev_row = null; List <RankSalaryStandardInput> rows = GetRows().OrderBy(a => a.序号).ToList(); foreach (RankSalaryStandardInput row in rows) { if (prev_row != null) { int diff = row.月薪 - prev_row.月薪; if (x > 1 && diff != prev_diff && grade.薪酬体系 != "软件开发") { MessageBox.Show("级差不一致,请重新录入"); return; } prev_diff = row.月薪 - prev_row.月薪; } x++; prev_row = row; row.序号 = x; //重置序号,使其从1开始,步长为1 } //保存(必须调用,否则并没有实际存入数据库,VGridControl 不像 GridControl 会自动存) Session.DefaultSession.Save(rows); //保存更新职等信息 gsa.职等数 = jGrade.职等数; gsa.对比的职等 = jGrade.对比的职等; gsa.半年调资额 = Convert.ToInt32(text半年调资额.Text); //统计 gsa.Calculate(); gsa.Save(); //刷新 grade.Refresh(); //触发完成事件 if (OnFinished != null) { OnFinished(grade, gsa, rows); } this.Close(); }
private void btn保存_Click(object sender, EventArgs e) { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { JobGrade currentItem = (JobGrade)colView.GetFocusedRow(); if (currentItem != null) { currentItem.Save(); } MessageBox.Show("保存成功!"); LoadData(); } MyHelper.WriteLog(LogType.信息, "修改职等", null); }
private bool SaveFocusedRow() { try { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { JobGrade currentItem = (JobGrade)colView.GetFocusedRow(); if (currentItem != null) { currentItem.Save(); } } return(true); } catch { return(false); } }