/// <summary> /// /// </summary> /// <returns></returns> public List <HREmployee> FindByWhere(string id, string name, string jobId, string deptId) { string whereSql = ""; if (!EmptyUtils.EmptyStr(id)) { whereSql += " and e.id=@Id"; } if (!EmptyUtils.EmptyStr(name)) { whereSql += " and e.name=@name"; } if (!EmptyUtils.EmptyStr(deptId)) { whereSql += " and e.dept_id=@deptId"; } string baseSql = @"SELECT e.*, d.name as DEPT_NAME, j.name as JOB_NAME FROM HR_EMPLOYEE e, HR_DEPT d, HR_JOB j where e.Dept_Id = d.ID and e.JOB_ID = j.ID"; if (whereSql != "") { baseSql = string.Format("{0}{1}", baseSql, whereSql); } return(conn.Query <HREmployee>(baseSql, new { Id = id, name = name, jobId = jobId, deptId = deptId }).ToList()); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyStr(txtUserName.Text)) { MessageBoxEx.Show(this, "请输入用户名"); txtUserName.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtPwd.Text)) { MessageBoxEx.Show(this, "请输入密码"); txtPwd.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboEmp.SelectedValue)) { MessageBoxEx.Show(this, "请选择员工"); cboEmp.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboUserType.SelectedValue)) { MessageBoxEx.Show(this, "请选择用户类型"); cboUserType.Focus(); return(false); } return(true); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyObj(cboLeaveType.SelectedValue)) { MessageBoxEx.Show(this, "请选择请假类型"); cboLeaveType.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtLeaveDay.Text)) { MessageBoxEx.Show(this, "请输入请假天数"); txtLeaveDay.Focus(); return(false); } if (EmptyUtils.IsNaN(txtLeaveDay.Text)) { MessageBoxEx.Show(this, "请假天数格式不合法,请输入数字。"); txtLeaveDay.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtCause.Text)) { MessageBoxEx.Show(this, "请输入请假原因"); txtCause.Focus(); return(false); } return(true); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyStr(txtOldPwd.Text)) { lblError.Text = "请输入原始密码"; txtOldPwd.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtNewPwd.Text)) { lblError.Text = "请输入新密码"; txtNewPwd.Focus(); return(false); } if (txtNewPwd.Text.Length < 5) { lblError.Text = "密码长度最低5位数"; txtNewPwd.Focus(); return(false); } if (txtNewPwd.Text != txtNewPwdS.Text) { lblError.Text = "两次密码输入不一致,请重新输入"; txtNewPwdS.Focus(); return(false); } return(true); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyObj(cboEmp.SelectedValue)) { MessageBoxEx.Show(this, "请选择员工"); cboEmp.Focus(); return(false); } if (EmptyUtils.EmptyStr(dtSTime.Text)) { MessageBoxEx.Show(this, "请选择合同开始时间。"); txtSalary.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtProbation.Text)) { MessageBoxEx.Show(this, "请输入试用期"); txtProbation.Focus(); return(false); } if (EmptyUtils.IsNaN(txtProbation.Text)) { MessageBoxEx.Show(this, "试用期格式不正确,请重新输入。"); txtProbation.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtSalary.Text)) { MessageBoxEx.Show(this, "请输入工资"); txtSalary.Focus(); return(false); } if (EmptyUtils.IsNaN(txtSalary.Text)) { MessageBoxEx.Show(this, "试用期格式不正确,请重新输入。"); txtSalary.Focus(); return(false); } if (EmptyUtils.EmptyStr(dtETime.Text)) { MessageBoxEx.Show(this, "请选择合同结束时间。"); txtSalary.Focus(); return(false); } DateTime sDt = Convert.ToDateTime(dtSTime.Text); DateTime eDt = Convert.ToDateTime(dtETime.Text); if (DateTime.Compare(sDt, eDt) > 0) { MessageBoxEx.Show(this, "合同开始时间不能大于合同结束时间。"); dtSTime.Focus(); return(false); } return(true); }
public List <HRContract> FindByWhere(HRContract vo) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.Id)) { whereSql += " and c.id=@Id"; } if (vo.Salary > 0) { whereSql += " and c.Salary=@Salary"; } if (vo.Probation > 0) { whereSql += " and c.Probation=@Probation"; } if (!EmptyUtils.EmptyStr(vo.EmpId)) { whereSql += " and c.EMP_ID=@EmpId"; } string sql = "SELECT c.*, e.name as EMP_NAME FROM HR_CONTRACT c ,HR_EMPLOYEE e where c.EMP_ID = e.ID"; return(conn.Query <HRContract>(sql + whereSql, new { Id = vo.Id, Salary = vo.Salary, Probation = vo.Probation, EmpId = vo.EmpId }).ToList()); }
/// <summary> /// 按条件查询 /// </summary> /// <returns></returns> public List <HRUser> FindByWhere(HRUser vo) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.Id)) { whereSql += " and u.id=@Id"; } if (!EmptyUtils.EmptyStr(vo.EmpId)) { whereSql += " and u.Emp_Id=@EmpId"; } if (!EmptyUtils.EmptyStr(vo.UserName)) { whereSql += " and u.UserName=@UserName"; } if (vo.UserType > 0) { whereSql += " and u.User_Type=@UserType"; } string baseSql = @"SELECT u.*, e.name as EMP_NAME FROM HR_USER u , HR_EMPLOYEE e where u.emp_id = e.id"; return(conn.Query <HRUser>(baseSql + whereSql, new { Id = vo.Id, EmpId = vo.EmpId, UserName = vo.UserName, UserType = vo.UserType, }).ToList()); }
public List <HRLeave> FindByWhereForMgr(HRLeave vo, string mgrDeptId, string mgrEmpId) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.Id)) { whereSql += " and id=@Id"; } if (vo.Status > 0) { whereSql += " and Status=@Status"; } if (!EmptyUtils.EmptyStr(vo.EmpId)) { whereSql += " and EMP_ID=@EmpId"; } string sql = "SELECT * FROM HR_LEAVE WHERE EMP_ID != @MgrEmpId "; sql = sql += whereSql; sql = sql += " AND EMP_ID IN (SELECT EMP_ID FROM HR_EMPLOYEE WHERE DEPT_ID = @mgrDeptId) "; return(conn.Query <HRLeave>(sql, new { Id = vo.Id, Status = vo.Status, EmpId = vo.EmpId, MgrEmpId = mgrDeptId, mgrDeptId = mgrDeptId }).ToList()); }
public List <HRLeave> FindByWhereForAdmin(HRLeave vo) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.Id)) { whereSql += " and id=@Id"; } if (vo.Status > 0) { whereSql += " and Status=@Status"; } if (!EmptyUtils.EmptyStr(vo.EmpId)) { whereSql += " and EMP_ID=@EmpId"; } string sql = "SELECT * FROM HR_LEAVE WHERE 1=1 "; sql = sql += whereSql; sql = sql += " AND EMP_ID IN(SELECT EMP_ID FROM HR_USER WHERE USER_TYPE = 2)"; return(conn.Query <HRLeave>(sql, new { Id = vo.Id, Status = vo.Status, EmpId = vo.EmpId }).ToList()); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyStr(txtName.Text)) { MessageBoxEx.Show(this, "请输入部门名称"); txtName.Focus(); return(false); } return(true); }
/// <summary> /// 输入转VO /// </summary> /// <returns></returns> private HRContract InputToVo() { HRContract vo = new HRContract(); vo.Id = txtId.Text; 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; return(vo); }
public List <HRDept> FindByWhere(HRDept vo) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.Id)) { whereSql += " and id=@Id"; } if (!EmptyUtils.EmptyStr(vo.Name)) { whereSql += " and Name=@Name"; } return(conn.Query <HRDept>("SELECT d.* FROM HR_DEPT d where 1=1 " + whereSql, new { Id = vo.Id, Name = vo.Name, }).ToList()); }
/// <summary> /// 根据工资单日期区间查询 /// </summary> /// <param name="id"></param> /// <returns></returns> public List <HRPayroll> FindByWhere(HRPayroll vo) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.PayrollDate)) { whereSql += " and PAYROLL_DATE=@PayrollDate"; } if (!EmptyUtils.EmptyStr(vo.EmpId)) { whereSql += " and EMP_ID=@EmpId"; } string baseSql = "select p.*, e.NAME as EMP_NAME from HR_PAYROLL p, HR_EMPLOYEE e where p.EMP_ID = e.ID "; List <HRPayroll> list = conn.Query <HRPayroll>(baseSql + whereSql, new { PayrollDate = vo.PayrollDate, EmpId = vo.EmpId }).ToList(); return(list); }
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(); }
/// <summary> /// /// </summary> /// <returns></returns> public List <HREmployee> FindByWhere(HREmployee vo) { string whereSql = ""; if (!EmptyUtils.EmptyStr(vo.Id)) { whereSql += " and e.id=@Id"; } if (!EmptyUtils.EmptyStr(vo.Name)) { whereSql += " and e.Name=@Name"; } if (vo.Sex > -1) { whereSql += " and e.Sex=@Sex"; } if (!EmptyUtils.EmptyStr(vo.IdCard)) { whereSql += " and e.ID_CARD=@IdCard"; } if (vo.Education > -1) { whereSql += " and e.Education=@Education"; } if (!EmptyUtils.EmptyStr(vo.School)) { whereSql += " and e.School=@School"; } if (!EmptyUtils.EmptyStr(vo.Profession)) { whereSql += " and e.Profession=@Profession"; } if (!EmptyUtils.EmptyStr(vo.Telephone)) { whereSql += " and e.Telephone=@Telephone"; } if (vo.PoliticalStatus > -1) { whereSql += " and e.POLITICAL_STATUS=@PoliticalStatus"; } if (!EmptyUtils.EmptyStr(vo.Address)) { whereSql += " and e.Address=@Address"; } if (!EmptyUtils.EmptyStr(vo.BankCard)) { whereSql += " and e.BANK_CARD=@BankCard"; } if (!EmptyUtils.EmptyStr(vo.Email)) { whereSql += " and e.Email=@Email"; } if (!EmptyUtils.EmptyStr(vo.JobId)) { whereSql += " and e.job_id=@jobId"; } if (!EmptyUtils.EmptyStr(vo.DeptId)) { whereSql += " and e.dept_id=@deptId"; } if (vo.Status > -1) { whereSql += " and e.Status=@Status"; } string baseSql = @"SELECT e.*, d.name as DEPT_NAME, j.name as JOB_NAME FROM HR_EMPLOYEE e, HR_DEPT d, HR_JOB j where e.Dept_Id = d.ID and e.JOB_ID = j.ID"; if (whereSql != "") { baseSql = string.Format("{0}{1}", baseSql, whereSql); } return(conn.Query <HREmployee>(baseSql, new { Id = vo.Id, Name = vo.Name, Sex = vo.Sex, IdCard = vo.IdCard, Education = vo.Education, School = vo.School, GraduationTime = vo.GraduationTime, Profession = vo.Profession, Telephone = vo.Telephone, PoliticalStatus = vo.PoliticalStatus, Address = vo.Address, BankCard = vo.BankCard, Email = vo.Email, DeptId = vo.DeptId, JobId = vo.JobId, Status = vo.Status }).ToList()); }
/// <summary> /// 验证输入 /// </summary> /// <returns></returns> private bool validateInput() { if (EmptyUtils.EmptyStr(txtName.Text)) { MessageBoxEx.Show(this, "请输入姓名"); txtName.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboSex.SelectedValue)) { MessageBoxEx.Show(this, "请选择性别"); cboSex.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboPo.SelectedValue)) { MessageBoxEx.Show(this, "请选择政治面貌"); cboPo.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboEdu.SelectedValue)) { MessageBoxEx.Show(this, "请选择学历"); cboEdu.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboEdu.SelectedValue)) { MessageBoxEx.Show(this, "请选择学历"); cboEdu.Focus(); return(false); } if (EmptyUtils.EmptyStr(dtTime.Text)) { MessageBoxEx.Show(this, "请选择毕业时间"); dtTime.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtPhone.Text)) { MessageBoxEx.Show(this, "请输入电话号码"); txtPhone.Focus(); return(false); } if (EmptyUtils.IsNaN(txtPhone.Text)) { MessageBoxEx.Show(this, "电话号码格式不正确"); txtPhone.Focus(); return(false); } if (EmptyUtils.EmptyStr(txtIdCard.Text)) { MessageBoxEx.Show(this, "请输入身份证号码"); txtIdCard.Focus(); return(false); } if (txtIdCard.Text.Length != 18) { MessageBoxEx.Show(this, "身份证号码长度不正确,请输入18位身份证号码。"); txtIdCard.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboDept.SelectedValue)) { MessageBoxEx.Show(this, "请选择部门"); cboDept.Focus(); return(false); } if (EmptyUtils.EmptyObj(cboJob.SelectedValue)) { MessageBoxEx.Show(this, "请选择职位"); cboJob.Focus(); return(false); } return(true); }