private void OnEmployeeSelectd(object sender, EmployeeInfo emp) { if (currEntryRows.Find(a => a.员工编号 == emp.员工编号) == null) { MonthlyWageLoanItemEntry item = MonthlyWageLoanItemEntry.AddMonthlyWageLoanItemEntry(emp.员工编号, emp.姓名, year, month, isCheck); //如果记录已生效,清除生效标记 if (item.已生效) { item.生效时间 = DateTime.MinValue; item.Save(); MonthlyWageLoanItemEntry opposite = item.另一人录入的记录; if (opposite != null) { opposite.生效时间 = DateTime.MinValue; opposite.Save(); } } currEntryRows.Add(item); gridControl1.RefreshDataSource(); bandedGridView1.FocusedRowHandle = bandedGridView1.RowCount - 1; MyHelper.WriteLog(LogType.信息, "新增员工每月报账工资录入记录", item.ToString <MonthlyWageLoanItemEntry>()); } }
public EditMonthlyWageLoanItemForm(MonthlyWageLoanItemEntry entry) { // This call is required by the Windows Form Designer. InitializeComponent(); // TODO: Add any initialization after the InitializeComponent call this.currMonthlyWageLoanItemEntry = entry; }
private void bandedGridView1_CellValueChanging(object sender, CellValueChangedEventArgs e) { MonthlyWageLoanItemEntry row = bandedGridView1.GetRow(e.RowHandle) as MonthlyWageLoanItemEntry; if (row != null) { } }
private void bandedGridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { MonthlyWageLoanItemEntry item = bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle) as MonthlyWageLoanItemEntry; if (item != null && e.Column.Caption == "录入") { Edit(item); } }
private void bandedGridView1_DoubleClick(object sender, EventArgs e) { MonthlyWageLoanItemEntry item = bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle) as MonthlyWageLoanItemEntry; if (item != null) { Edit(item); } }
private void bandedGridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { MonthlyWageLoanItemEntry row = bandedGridView1.GetRow(e.PrevFocusedRowHandle) as MonthlyWageLoanItemEntry; if (row != null) { row.GetModifiyFields(); } }
protected void LoadData() { showDifferent = false; //清除原来的数据 currEntryRows = MonthlyWageLoanItemEntry.GetEditingRows(year, month, isCheck); currEntryRows = currEntryRows.OrderBy(a => a.录入时间).ThenBy(a => a.员工编号).ToList(); gridControl1.DataSource = currEntryRows; gridControl1.RefreshDataSource(); gridControl1.Refresh(); }
private void Edit(MonthlyWageLoanItemEntry item) { EditMonthlyWageLoanItemForm form = new EditMonthlyWageLoanItemForm(item); //如果录入成功 if (form.ShowDialog() == DialogResult.OK) { LoadData(); } }
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) { MonthlyWageLoanItemEntry currentItem = (MonthlyWageLoanItemEntry)colView.GetFocusedRow(); currEntryRows.Remove(currentItem); MyHelper.WriteLog(LogType.信息, "删除员工每月报账工资录入记录", currentItem.ToString <MonthlyWageLoanItemEntry>()); gridControl1.RefreshDataSource(); MonthlyWageLoanItemEntry.ClearMonthlyWageLoanItemEntry(currentItem.员工编号, year, month); MessageBox.Show("删除成功。", "删除提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void bandedGridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { if (showDifferent == false) { return; } e.Appearance.ForeColor = Color.Black; e.Appearance.BackColor = Color.Transparent; MonthlyWageLoanItemEntry row = bandedGridView1.GetRow(e.RowHandle) as MonthlyWageLoanItemEntry; if (row != null) { foreach (ModifyField field in row.内容不同的字段) { if (field.称 == e.Column.FieldName) { e.Appearance.ForeColor = Color.Yellow; e.Appearance.BackColor = Color.Red; } } } }
private void Submit() { bool isSameEditor = false; List <MonthlyWageLoanItemEntry> ssList = MonthlyWageLoanItemEntry.GetEditingRows(year, month, false); List <MonthlyWageLoanItemEntry> ssList_opposite = MonthlyWageLoanItemEntry.GetEditingRows(year, month, true); //检查是否录入完成 foreach (MonthlyWageLoanItemEntry mrs in ssList) { if (mrs.实际借款金额 == 0) { MessageBox.Show("请全部录入完成以后再提交"); return; } } //检查是否同一人录入 foreach (MonthlyWageLoanItemEntry mrs in ssList) { if (mrs.另一人录入的记录 != null) { mrs.CompareInputContent(); string editor = mrs.录入人; string editor_opposite = mrs.另一人录入的记录.录入人.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 (MonthlyWageLoanItemEntry wle in ssList) { if (!wle.另一人已录入 || wle.内容不同的字段.Count > 0) { all_same = false; break; } } } if (all_same) { //转成正式 foreach (MonthlyWageLoanItemEntry wle in ssList) { wle.UpdateToFormalTable(); } MessageBox.Show("双人录入成功"); this.DialogResult = DialogResult.OK; LoadData(); Close(); } else { MessageBox.Show("双人录入失败:双人录入不一致或者另外一个人还没有录入"); } }