private void btnGetAttPrintRecord_Click(object sender, EventArgs e) { #region 打卡记录 //打卡记录时间格式带小时分钟,需特殊处理 string sql = @"select * from smthrm.t_hr_employeeclockinrecord c where c.employeeid='" + txtEmployeeId.Text + @"' and c.punchdate>=to_date('" + GlobalParameters.StartDate + @"','yyyy-mm-dd') and c.punchdate<=to_date('" + GlobalParameters.EndDate + @"','yyyy-mm-dd') order by c.punchdate"; DataTable dt = OracleHelp.getTable(sql); if (dt != null) { this.dtAttRecord.DataSource = dt; foreach (DataRow dr in dt.Rows) { T_HR_EMPLOYEECLOCKINRECORD entTemp = new T_HR_EMPLOYEECLOCKINRECORD(); entTemp.CLOCKINRECORDID = dr["CLOCKINRECORDID"].ToString(); entTemp.FINGERPRINTID = dr["FINGERPRINTID"].ToString(); entTemp.CLOCKID = dr["CLOCKID"].ToString(); entTemp.PUNCHDATE = DateTime.Parse(dr["PUNCHDATE"].ToString()); entTemp.PUNCHTIME = dr["PUNCHTIME"].ToString(); entTempListAgain.Add(entTemp); } OracleHelp.close(); //txtMessagebox.Text = "查询员工打卡记录完成,共:" + dt.Rows.Count.ToString() + "条数据" + System.Environment.NewLine + txtMessagebox.Text; } else { //txtMessagebox.Text = "查询员工打卡记录完成,共:0条数据" + System.Environment.NewLine + txtMessagebox.Text; } #endregion }
private void btnGetEmployeeId_Click(object sender, EventArgs e) { string sql = @"select e.employeeename,e.employeeid from smthrm.t_hr_employee e where e.employeecname like '%" + txtEmployeeName.Text + @"%'"; OracleHelp.Connect(); DataTable dt = OracleHelp.getTable(sql); if (dt.Rows.Count == 1) { txtEmployeeName.Text = dt.Rows[0]["employeeename"].ToString(); txtEmployeeId.Text = dt.Rows[0]["employeeid"].ToString(); } else { MessageBox.Show("员工有同名!"); } OracleHelp.close(); }