public String GET_CURRENT_POSITION(non_static_dbcon usethisconnection) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); usethisconnection.SET_COMMAND_PARAMS(cmd, "EMP_POSITION_SELECT_LATEST_BY_ID"); cmd.Parameters.AddWithValue("_empid", empid); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); if (dt != null) { if (dt.Rows.Count > 0) { String pos = ""; pos = (dt.Rows[0].Field <String>("position_") != null) ? dt.Rows[0].Field <String>("position_") : ""; position = pos; return(pos); } else { return(""); } } else { return(""); } }
public Byte[] GET_IMAGE_BY_ID(non_static_dbcon usethisconnection) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); usethisconnection.SET_COMMAND_PARAMS(cmd, "EMP_PIC_SELECT_BY_ID"); cmd.Parameters.AddWithValue("_empid", empid); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); if (dt != null) { if (dt.Rows.Count > 0) { Byte[] image = dt.Rows[0].Field <Byte[]>("imagebyte"); pic = image; return(image); } else { return(null); } } else { return(null); } }
}//end select bween dates public String SELECT_STR_BY_EMPID_BY_DATE(DateTime thisdate, non_static_dbcon usethisconnection) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); usethisconnection.SET_COMMAND_PARAMS(cmd, "ATTENDANCE_STR_BY_EMPID_BY_DATE"); cmd.Parameters.AddWithValue("_empid", empid); cmd.Parameters.AddWithValue("_thisdate", thisdate); MySqlDataAdapter da = new MySqlDataAdapter(cmd); try { da.Fill(dt); if (dt != null) { return(dt.Rows[0].Field <String>("attendance")); } else { return(""); } //return dt; } catch (Exception e) { Logger.WriteErrorLog("ATTENDANCE_STR_BY_EMPID_BW_DATES MODULE:" + e.Message); return(""); } }//end str select bween dates
public Employee SELECT_BY_ID(non_static_dbcon usethisconnection) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); usethisconnection.SET_COMMAND_PARAMS(cmd, "EMP_SELECT_BY_ID"); cmd.Parameters.AddWithValue("_empid", empid); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); if (dt != null) { if (dt.Rows.Count > 0) { Employee e = new Employee(); foreach (DataRow r in dt.Rows) { e.empid = r["empid"].ToString(); e.fname = r["fname"].ToString(); e.lname = r["lname"].ToString(); e.mname = r["mname"].ToString(); e.address = r["address"].ToString(); e.birthdate = Convert.ToDateTime(r["birthday"].ToString()); e.contactno = r["contactno"].ToString(); e.gender = r["gender"].ToString(); e.COOP_MEMBERSHIP_ID = r["COOP_MEMBERSHIP_ID"].ToString(); e.tinno = r["tinno"].ToString(); } return(e); } else { return(null); } } else { return(null); } }
//for asychronous transaction public Emp_Sched SELECT_BY_EMPID(non_static_dbcon usethisconnection) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); usethisconnection.SET_COMMAND_PARAMS(cmd, "EMP_SCHED_SELECT_BY_EMPID"); cmd.Parameters.AddWithValue("_empid", empid); MySqlDataAdapter da = new MySqlDataAdapter(cmd); da.Fill(dt); if (dt != null) { if (dt.Rows.Count > 0) { DataRow r = dt.Rows[0]; Emp_Sched es = new Emp_Sched(); es.empid = r["empid"].ToString(); es.mon = r["mon"].ToString(); es.tue = r["tue"].ToString(); es.wed = r["wed"].ToString(); es.thu = r["thu"].ToString(); es.fri = r["fri"].ToString(); es.sat = r["sat"].ToString(); es.sun = r["sun"].ToString(); return(es); } else { return(null); } } else { return(null); } }
}//end select bween dates public DataTable SELECT_BY_EMPID_BW_DATES(DateTime from, DateTime to, non_static_dbcon usethisconnection) { DataTable dt = new DataTable(); MySqlCommand cmd = new MySqlCommand(); usethisconnection.SET_COMMAND_PARAMS(cmd, "ATTENDANCE_BY_EMPID_BW_DATES"); cmd.Parameters.AddWithValue("_empid", empid); cmd.Parameters.AddWithValue("_from", from); cmd.Parameters.AddWithValue("_to", to); MySqlDataAdapter da = new MySqlDataAdapter(cmd); try { da.Fill(dt); return(dt); } catch (Exception e) { Logger.WriteErrorLog("ATTENDANCE_BY_EMPID_BW_DATES MODULE:" + e.Message); return(null); } }//end select bween dates