private void btnSave_Click(object sender, EventArgs e) { if (!validateInput()) { return; } btnSaveEnbaled(false); if (opration == OP_ADD) { HRContract vo = InputToVo(); int ret = dao.Add(vo); if (ret > 0) { listSource.Add(vo); } } else if (opration == OP_UPDATE) { HRContract vo = list[grid.CurrentRow.Index]; vo.Probation = !EmptyUtils.EmptyStr(txtProbation.Text) ? int.Parse(txtProbation.Text) : -1; vo.Salary = !EmptyUtils.EmptyStr(txtSalary.Text) ? float.Parse(txtSalary.Text) : -1; vo.EmpId = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? cboEmp.SelectedValue.ToString() : ""; vo.EmpName = !EmptyUtils.EmptyObj(cboEmp.SelectedValue) ? ((HREmployee)cboEmp.SelectedItem).Name : ""; vo.EndTime = dtETime.Text; vo.StartTime = dtSTime.Text; dao.Update(vo); grid.Refresh(); } CleanData(); }
public void Add(Contract value) { contractDao.Add(value); }