/// <summary> /// Delete the specific EmployeeAile and update AILE table /// </summary> public void Delete() { try { MySqlCommand cmd = new MySqlCommand(); string query; m_Connection.Open(); cmd.Connection = m_Connection; query = "DELETE FROM employeeaile WHERE employeeaileid = " + m_EmployeeAileID; cmd.CommandText = query; cmd.ExecuteNonQuery(); m_Connection.Close(); // update AILE table Aile oAile = new Aile(); oAile.Update(m_EmplID, m_WkgID); } catch (Exception e) { m_Connection.Close(); throw (e); } }
/// <summary> /// Update the employee aile into database and update AILE table /// </summary> public void Update() { try { MySqlCommand cmd = new MySqlCommand(); string query; m_Connection.Open(); cmd.Connection = m_Connection; query = "UPDATE employeeaile SET ailecriteriaid =" + m_AileCriteriaID; query += " ,wkgid = " + m_WkgID; query += " ,motif = '" + SQL.escapeString(m_Motif) + "'"; query += " ,taux = " + m_Taux; query += " ,startdate = '" + m_StartDate.Year + "." + m_StartDate.Month + "." + m_StartDate.Day + "'"; query += " ,enddate = '" + m_EndDate.Year + "." + m_EndDate.Month + "." + m_EndDate.Day + "'"; query += " WHERE employeeaileID = " + m_EmployeeAileID; cmd.CommandText = query; cmd.ExecuteNonQuery(); m_Connection.Close(); // update AILE table Aile oAile = new Aile(); oAile.Update(m_EmplID, m_WkgID); } catch (Exception e) { m_Connection.Close(); throw (e); } }
/// <summary> /// Add the current object in the database and update AILE table /// </summary> public void Add() { try { MySqlCommand cmd = new MySqlCommand(); String sql; m_Connection.Open(); cmd.Connection = m_Connection; sql = "insert into employeeaile(wkgid, emplid, ailecriteriaID, motif, taux, startdate, enddate) values("; sql += m_WkgID; sql += ","; sql += m_EmplID; sql += ","; sql += m_AileCriteriaID; sql += ",'"; sql += SQL.escapeString(m_Motif); sql += "',"; sql += m_Taux; sql += ",'"; sql += m_StartDate.Year + "." + m_StartDate.Month + "." + m_StartDate.Day; sql += "','"; sql += m_EndDate.Year + "." + m_EndDate.Month + "." + m_EndDate.Day; sql += "')"; cmd.CommandText = sql; cmd.ExecuteNonQuery(); m_Connection.Close(); // update AILE table Aile oAile = new Aile(); oAile.Update(m_EmplID, m_WkgID); } catch (Exception e) { m_Connection.Close(); throw (e); } }