private void btn保存_Click(object sender, EventArgs e) { ColumnView colView = (ColumnView)gridControl1.MainView; if (colView != null) { for (int i = 0; i < colView.RowCount; i++) { OtherMoney currentItem = colView.GetRow(i) as OtherMoney; if (currentItem != null) { currentItem.Save(); } } MessageBox.Show("保存成功!"); LoadData(); } }
private void btn保存_Click(object sender, EventArgs e) { CreateWaitDialog("正在保存导入的奖扣项数据...", "请稍等"); foreach (OtherMoneyData row in currRows) { OtherMoney newItem = OtherMoney.AddOtherMoney(row.员工编号, row.姓名, row.年, row.月, row.类型, row.项目名称); newItem.金额 = row.金额; newItem.录入人 = AccessController.CurrentUser.姓名; newItem.录入时间 = DateTime.Now; newItem.Save(); } CloseWaitDialog(); MyHelper.WriteLog(LogType.信息, "导入其他奖项和扣项", null); MessageBox.Show("保存成功!"); }
private void OnEmployeeSelectd(object sender, EmployeeInfo emp) { OtherMoney item = new OtherMoney(); item.类型 = type; item.年 = Convert.ToInt32(year.Value); item.月 = Convert.ToInt32(month.Text); item.录入人 = AccessController.CurrentUser.姓名; item.员工编号 = emp.员工编号; item.姓名 = emp.姓名; try { item.Save(); currRows.Add(item); gridControl1.RefreshDataSource(); gridView1.FocusedRowHandle = gridView1.RowCount - 1; } catch (Exception err) { MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }