protected void LoadData() { showDifferent = false; //清除原来的数据 currEntryRows = SalaryStructureEntry.GetEditingRows(isCheck); currEntryRows = currEntryRows.OrderBy(a => a.录入时间).ThenBy(a => a.员工编号).ToList(); gridControl1.DataSource = currEntryRows; gridControl1.RefreshDataSource(); gridControl1.Refresh(); }
private void Submit() { bool isSameEditor = false; List <SalaryStructureEntry> ssList = SalaryStructureEntry.GetEditingRows(false); List <SalaryStructureEntry> ssList_opposite = SalaryStructureEntry.GetEditingRows(true); //检查是否录入完成 foreach (SalaryStructureEntry sse in ssList) { if (sse.开始执行日期 == DateTime.MinValue) { MessageBox.Show("请全部录入完成以后再提交"); return; } } //检查是否同一人录入 foreach (SalaryStructureEntry sse in ssList) { if (sse.另一人录入的记录 != null) { sse.CompareInputContent(); string editor = sse.录入人; string editor_opposite = sse.另一人录入的记录.录入人.Trim(); if (editor == editor_opposite && editor_opposite != "") { isSameEditor = true; break; } } } gridControl1.Refresh(); if (isSameEditor) { MessageBox.Show("两次录入不能是同一个人"); return; } //检查差异 bool all_same = true; if (ssList.Count != ssList_opposite.Count) { all_same = false; } else { foreach (SalaryStructureEntry sse in ssList) { if (!sse.另一人已录入 || sse.内容不同的字段.Count > 0) { all_same = false; break; } } } if (all_same) { //转成正式 foreach (SalaryStructureEntry sse in ssList) { sse.UpdateToFormalTable(); } MessageBox.Show("双人录入成功"); this.DialogResult = DialogResult.OK; LoadData(); Close(); } else { MessageBox.Show("双人录入失败:双人录入不一致或者另外一个人还没有录入"); } }