public List <Tache> getTachesByProjet(int id_projet) { TacheDataTable tacheDataTable = new TacheDataTable(); List <Tache> taches = new List <Tache>(); using (TacheTableAdapter tacheTableAdapter = new TacheTableAdapter()) { tacheDataTable = tacheTableAdapter.getTachesByProjet(id_projet); foreach (TacheRow row in tacheDataTable) { Tache tache = new Tache(row.id, row.libelle, row.description, row.date_debut, row.duree, row.id_tache_precente, row.id_responsable, row.id_jalon, row.avancement); if (row["date_reelle_debut"] != DBNull.Value) { tache.Date_reelle_debut = row.date_reelle_debut; } taches.Add(tache); } return(taches); } }
public Tache getTacheById(int id) { TacheDataTable tacheDataTable = new TacheDataTable(); using (TacheTableAdapter tacheTableAdapter = new TacheTableAdapter()) { tacheDataTable = tacheTableAdapter.getTacheById(id); TacheRow row = tacheDataTable[0]; Tache tache = new Tache(row.id, row.libelle, row.description, row.date_debut, row.duree, row.id_tache_precente, row.id_responsable, row.id_jalon, row.avancement); if (row.id_tache_precente > 0) { Tache tache_precedente = FactoryServicesDA.createTacheServices().getTacheById(row.id_tache_precente); tache.Tache_precedente = tache_precedente; } Utilisateur responsable = FactoryServicesDA.createUtilisateurServices().getUtilisateurById(row.id_responsable); tache.Responsable = responsable; Jalon jalon = FactoryServicesDA.createJalonServices().getJalonById(row.id_jalon); tache.Jalon = jalon; return(tache); } }