private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { PayRateInput row = gridView1.GetRow(e.RowHandle) as PayRateInput; if (row != null) { row.GetModifiyFields(); } }
private void btn确定_Click(object sender, EventArgs e) { if (dateEdit1.DateTime == DateTime.MinValue) { MessageBox.Show("请输入执行日期"); return; } if (currInputRows.Count == 0) { MessageBox.Show("没有找到职级工资记录"); return; } foreach (PayRateInput input in currInputRows) { if (input.工资额 == 0) { MessageBox.Show("请输入职级工资后重试"); return; } } List <PayRateInput> otherInputRows = PayRateInput.GetEditingRows(currSalaryGrade.标识, !是验证录入); bool allOK = currInputRows.Count == otherInputRows.Count; //遍历当前录入的行 foreach (PayRateInput input in currInputRows) { string comparingResult = input.Compare(); if (comparingResult != "两人录入完全一致") { allOK = false; } } //如果所有录入一致 if (allOK) { //将录入内容转到正式表 foreach (PayRateInput input in currInputRows) { BecomeEffective(input); } MessageBox.Show("职级工资录入成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (otherInputRows.Count > 0) { MessageBox.Show("初次录入和验证录入的职级工资不一致,请纠正后再试!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e) { PayRateInput row = e.Row as PayRateInput; if (row != null) { if (row.工资额 == 0) { e.Valid = false; } } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { //清除原来的数据 currInputRows.Clear(); btn确定.Enabled = false; currSalaryGrade = null; if (e.Node.Tag != null) { currSalaryGrade = e.Node.Tag as SalaryNode; if (AccessController.CheckGrade(currSalaryGrade.标识)) { btn确定.Enabled = true; //创建当前薪等下的所有薪级的录入记录 foreach (SalaryNode step in currSalaryGrade.子节点) { if (step.已撤销) { continue; } PayRateInput pInput = PayRateInput.GetEditing(step.标识, this.是验证录入); //如果没有初次录入 if (pInput == null) { pInput = new PayRateInput(); pInput.执行日期 = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); pInput.薪等标识 = currSalaryGrade.标识; pInput.薪级标识 = step.标识; pInput.是验证录入 = this.是验证录入; pInput.双人录入结果 = ""; //找验证录入 PayRateInput pInputOther = PayRateInput.GetEditing(step.标识, !this.是验证录入); if (pInputOther != null) { pInput.编号 = pInputOther.编号; } pInput.Save(); } currInputRows.Add(pInput); dateEdit1.DateTime = pInput.执行日期; } } else { MessageBox.Show("你没有权限设置该薪等的职级工资。"); } } gridControl1.DataSource = currInputRows; gridControl1.RefreshDataSource(); }
private void AddRow_Click(object sender, EventArgs e) { EmployeePayroll employeePayRoll = new EmployeePayroll(); employeePayRoll.EmployeeFirstName = FirstNameInput.Text; employeePayRoll.EmployeeLastName = LastNameInput.Text; employeePayRoll.EmployeeEmail = EmailInput.Text; double PayRate = 0; double.TryParse(PayRateInput.Text, out PayRate); employeePayRoll.EmployeePayRate = PayRate; double Quantity = 0; double.TryParse(QtyInput.Text, out Quantity); employeePayRoll.TaskQty = Quantity; double ExtraPay = 0; double.TryParse(ExtraInput.Text, out ExtraPay); employeePayRoll.EmployeeExtraPay = ExtraPay; double TotalPay = 0; double.TryParse(TotalPayInput.Text, out TotalPay); employeePayRoll.EmployeeTotalPay = TotalPay; employeePayRoll.EmployeeComments = CommentsInput.Text; // Display the new information in the grid from the field. dataGridView1.Rows.Add(FirstNameInput.Text, LastNameInput.Text, EmailInput.Text, PayRate, Quantity, ExtraPay, TotalPay, CommentsInput.Text); dataGridView1.Columns[0].DisplayIndex = 0; // Clear out the input fields FirstNameInput.Clear(); LastNameInput.Clear(); EmailInput.Clear(); PayRateInput.Clear(); QtyInput.Clear(); ExtraInput.Clear(); TotalPayInput.Clear(); CommentsInput.Clear(); }
//编程正式数据 private static void BecomeEffective(PayRateInput input) { StepPayRate stepPayRate = StepPayRate.AddStepPayRate(input.薪等标识, input.薪级标识, input.执行日期); stepPayRate.工资额 = input.工资额; stepPayRate.设定时间 = DateTime.Now; PayRateInput anotherInput = input.另一人录入的记录 as PayRateInput; stepPayRate.录入人 = !input.是验证录入 ? input.录入人 : anotherInput.录入人; stepPayRate.录入时间 = !input.是验证录入 ? input.录入时间 : anotherInput.录入时间; stepPayRate.验证人 = input.是验证录入 ? input.录入人 : anotherInput.录入人; stepPayRate.验证时间 = input.是验证录入 ? input.录入时间 : anotherInput.录入时间; stepPayRate.Save(); input.UpdateCompareResult(); }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { e.Appearance.ForeColor = Color.Black; e.Appearance.BackColor = Color.Transparent; PayRateInput row = gridView1.GetRow(e.RowHandle) as PayRateInput; if (row != null) { foreach (ModifyField field in row.内容不同的字段) { if (field.称 == e.Column.FieldName) { e.Appearance.ForeColor = Color.Yellow; e.Appearance.BackColor = Color.Red; } } } }