/** * Init * This method will take care of getting all the Time Offs for an employee * * @pram int id * @return none * */ public void init(int employee_id) { DatabaseHandler handler = new DatabaseHandler(); handler.setSQL("SELECT * FROM Time_off WHERE employee = @employee_id"); handler.addParameter("@employee_id", employee_id.ToString()); handler.queryExecute(); while (handler.reader.Read()) { int id = int.Parse(handler.reader["time_off_id"].ToString()); DateTime startDate = DateTime.Parse(handler.reader["time_off_start_date"].ToString()); DateTime endDate = DateTime.Parse(handler.reader["time_off_end_date"].ToString()); string type = handler.reader["time_off_type"].ToString(); int paidDays = int.Parse(handler.reader["time_off_paid_days"].ToString()); bool approved = (handler.reader["time_off_approved"].ToString() == "1"); TimeOff t = new TimeOff(id, startDate, endDate, paidDays, type, approved); items.Add(t); } }
/** * Init * This method will take care of getting all the Time Offs for an employee * * @pram int id * @return none * */ public void init(int employee_id) { DatabaseHandler handler = new DatabaseHandler(); handler.setSQL("SELECT * FROM Time_off WHERE employee = @employee_id"); handler.addParameter("@employee_id", employee_id.ToString()); handler.queryExecute(); while (handler.reader.Read()) { int id = int.Parse(handler.reader["time_off_id"].ToString()); DateTime startDate = DateTime.Parse(handler.reader["time_off_start_date"].ToString()); DateTime endDate = DateTime.Parse(handler.reader["time_off_end_date"].ToString()); string type = handler.reader["time_off_type"].ToString(); int paidDays = int.Parse(handler.reader["time_off_paid_days"].ToString()); bool approved = (handler.reader["time_off_approved"].ToString() == "1"); TimeOff t = new TimeOff(id,startDate,endDate,paidDays,type,approved); items.Add(t); } }