private void bandedGridView1_CellValueChanging(object sender, CellValueChangedEventArgs e) { WageLoanEntry row = bandedGridView1.GetRow(e.RowHandle) as WageLoanEntry; if (row != null) { } }
public EditWageLoanForm(WageLoanEntry entry) { // This call is required by the Windows Form Designer. InitializeComponent(); // TODO: Add any initialization after the InitializeComponent call this.currWageLoanEntry = entry; }
private void bandedGridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { WageLoanEntry item = bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle) as WageLoanEntry; if (item != null && e.Column.Caption == "录入") { Edit(item); } }
private void bandedGridView1_DoubleClick(object sender, EventArgs e) { WageLoanEntry item = bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle) as WageLoanEntry; if (item != null) { Edit(item); } }
private void bandedGridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { WageLoanEntry row = bandedGridView1.GetRow(e.PrevFocusedRowHandle) as WageLoanEntry; if (row != null) { row.GetModifiyFields(); } }
protected void LoadData() { showDifferent = false; //清除原来的数据 currEntryRows = WageLoanEntry.GetEditingRows(isCheck); currEntryRows = currEntryRows.OrderBy(a => a.录入时间).ThenBy(a => a.员工编号).ToList(); gridControl1.DataSource = currEntryRows; gridControl1.RefreshDataSource(); gridControl1.Refresh(); }
private void Edit(WageLoanEntry item) { EditWageLoanForm form = new EditWageLoanForm(item); //如果录入成功 if (form.ShowDialog() == DialogResult.OK) { LoadData(); } }
private void OnEmployeeSelectd(object sender, EmployeeInfo emp) { WageLoanEntry item = new WageLoanEntry(); item.标识 = Guid.NewGuid(); item.员工编号 = emp.员工编号; item.是验证录入 = false; item.Save(); currEntryRows.Add(item); gridControl1.RefreshDataSource(); bandedGridView1.FocusedRowHandle = bandedGridView1.RowCount - 1; MyHelper.WriteLog(LogType.信息, "新增员工工资借款录入记录", item.ToString <WageLoanEntry>()); }
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) { WageLoanEntry currentItem = (WageLoanEntry)colView.GetFocusedRow(); currEntryRows.Remove(currentItem); MyHelper.WriteLog(LogType.信息, "删除员工工资借款录入记录", currentItem.ToString <WageLoanEntry>()); gridControl1.RefreshDataSource(); WageLoanEntry.ClearWageLoanEntry(currentItem.员工编号); 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; WageLoanEntry row = bandedGridView1.GetRow(e.RowHandle) as WageLoanEntry; 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 <WageLoanEntry> ssList = WageLoanEntry.GetEditingRows(false); List <WageLoanEntry> ssList_opposite = WageLoanEntry.GetEditingRows(true); //检查是否录入完成 foreach (WageLoanEntry wle in ssList) { if (wle.开始时间 == DateTime.MinValue) { MessageBox.Show("请全部录入完成以后再提交"); return; } } //检查是否同一人录入 foreach (WageLoanEntry wle in ssList) { if (wle.另一人录入的记录 != null) { wle.CompareInputContent(); string editor = wle.录入人; string editor_opposite = wle.另一人录入的记录.录入人.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 (WageLoanEntry wle in ssList) { if (!wle.另一人已录入 || wle.内容不同的字段.Count > 0) { all_same = false; break; } } } if (all_same) { //转成正式 foreach (WageLoanEntry wle in ssList) { wle.UpdateToFormalTable(); } MessageBox.Show("双人录入成功"); this.DialogResult = DialogResult.OK; LoadData(); Close(); } else { MessageBox.Show("双人录入失败:双人录入不一致或者另外一个人还没有录入"); } }