public static Stagiaire ajouterParticipant(SessionECF pSessionECF, Stagiaire pStagiaire) { //verifier que le stagiaire n a pas deja de date planifiee pour cet ECF dans cette version SqlConnection connexion=ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_EVAL_STAG_PART, connexion); cmd.Parameters.AddWithValue("@idECF", pSessionECF.Ecf.Id); cmd.Parameters.AddWithValue("@idStagiaire", pStagiaire._id); cmd.Parameters.AddWithValue("@version", pSessionECF.Version); SqlDataReader reader=cmd.ExecuteReader(); //SI oui if(reader.Read()) { connexion.Close(); return pStagiaire; } //SINON else { connexion.Close(); connexion = ConnexionSQL.CreationConnexion(); cmd = new SqlCommand(INSERT_PARTICIPANT, connexion); cmd.Parameters.AddWithValue("@idSessionECF", pSessionECF.Id); cmd.Parameters.AddWithValue("@idStagiaire", pStagiaire._id); cmd.ExecuteReader(); connexion.Close(); return null; } }
public CtrlSyntheseECF() { _evaluationSelectionnee = null; _lesSessionsECFsStag = null; _sessionSelectionnee = null; _stagiaireEncours = null; }
public static List<Observation> getListObservations(Stagiaire pStg) { try { List<Observation> listeDesObservations = new List<Observation>(); SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_INFOS_OBSERVATIONS, connexion); cmd.Parameters.AddWithValue("@num_stagiaire", pStg._id); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Observation obsTemp = new Observation(); obsTemp._id = reader.GetInt32(reader.GetOrdinal("id_observation")); if (reader.GetDateTime(reader.GetOrdinal("date")).ToString().Length > 0) { obsTemp._date = reader.GetDateTime(reader.GetOrdinal("date")); } obsTemp._nomAuteur = reader.GetSqlString(2).IsNull ? string.Empty : reader.GetString(2); obsTemp._type = reader.GetSqlString(3).IsNull ? string.Empty : reader.GetString(3); obsTemp._titre = reader.GetSqlString(4).IsNull ? string.Empty : reader.GetString(4); obsTemp._texte = reader.GetSqlString(5).IsNull ? string.Empty : reader.GetString(5); obsTemp._stagiaire = pStg; listeDesObservations.Add(obsTemp); } connexion.Close(); return listeDesObservations; } catch (Exception e) { System.Windows.MessageBox.Show("Impossible d'éxécuter la requête : " + e.Message, "Echec de la requête", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return null; } }
public static List<Absence> getListeAbsences(Stagiaire pS) { SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_INFOS_ABSENCES, connexion); cmd.Parameters.AddWithValue("@num_stagiaire", pS._id); List<Absence> listeAbsences = new List<Absence>(); try { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Absence absTemp = new Absence(); absTemp._id = reader.GetInt32(reader.GetOrdinal("id_absence")); if (!reader.GetSqlDateTime(3).IsNull) { absTemp._dateDebut = reader.GetDateTime(3); } if (!reader.GetSqlDateTime(4).IsNull) { absTemp._dateFin = reader.GetDateTime(4); } else { absTemp._dateFin = DateTime.Now; } absTemp._raison = reader.GetSqlString(1).IsNull ? String.Empty : reader.GetString(1); absTemp._commentaire = reader.GetSqlString(2).IsNull ? String.Empty : reader.GetString(2); if (!reader.GetSqlBoolean(5).IsNull) { absTemp._valide = reader.GetBoolean(5); } if (!reader.GetSqlBoolean(6).IsNull) { absTemp._isAbsence = reader.GetBoolean(6); } try{absTemp._duree = absTemp._dateFin - absTemp._dateDebut;}catch (Exception){absTemp._duree = new TimeSpan(0);} absTemp._stagiaire = pS; listeAbsences.Add(absTemp); } } catch (Exception e) { System.Windows.MessageBox.Show("Impossible d'éxécuter la requête : " + e.Message, "Echec de la requête", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return null; } connexion.Close(); return listeAbsences; }
public static Evaluation donneNote(SessionECF pSession, Stagiaire pStag, Competence pComp) { Evaluation eval = new Evaluation(pSession.Ecf, pComp, pStag, pSession.Version, -1, pSession.Date); SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_NOTE_STAG, connexion); cmd.Parameters.AddWithValue("@idECF", pSession.Ecf.Id); cmd.Parameters.AddWithValue("@version", pSession.Version); cmd.Parameters.AddWithValue("@date", pSession.Date); cmd.Parameters.AddWithValue("@idStagiaire", pStag._id); cmd.Parameters.AddWithValue("@idCompetence", pComp.Id); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { eval = new Evaluation(); eval.Id = reader.GetInt32(reader.GetOrdinal("idEvaluation")); eval.Ecf = pSession.Ecf; eval.Stagiaire = pStag; eval.Competence = pComp; eval.Note = (float)reader.GetDouble(reader.GetOrdinal("note")); eval.Version = reader.GetInt32(reader.GetOrdinal("version")); eval.Date = reader.GetDateTime(reader.GetOrdinal("date")); } connexion.Close(); return eval; }
public SessionECF(ECF ecf, DateTime date, int version,Stagiaire stagiaire) { _id = 0; _ecf = ecf; _date = date; _version = version; _participants = new List<Stagiaire>(); _participants.Add(stagiaire); }
public Evaluation() { _id = 0; _ecf = new ECF(); _competence = new Competence(); _stagiaire = new Stagiaire(); _version = 0; _note = -1; _date = new DateTime(); }
public Observation(String pAuteur, String pType, String pTitre, String pTexte, Stagiaire pStagiaire) { this._nomAuteur = pAuteur; this._date = DateTime.Now; this._id = 1; this._texte = pTexte; this._titre = pTitre; this._type = pType; this._stagiaire = pStagiaire; }
public Evaluation(ECF pEcf, Competence pComp, Stagiaire pStag, int pVersion, float pNote, DateTime pDate) { _id = 0; _ecf =pEcf; _competence = pComp; _stagiaire = pStag; _version = pVersion; _note = pNote; _date = pDate; }
public Absence(String pRaison, String pCommentaire, DateTime pDateDebut, DateTime pDateFin, TimeSpan pDuree, bool pValide, Stagiaire pStagiaire, bool pIsAbsence) { this._commentaire = pCommentaire; this._dateDebut = pDateDebut; this._dateFin = pDateFin; this._duree = pDuree; this._raison = pRaison; this._valide = pValide; this._stagiaire = pStagiaire; this._isAbsence = pIsAbsence; }
public static List<Stagiaire> getListeStagiaires() { try { SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_LISTE_STAGIAIRES, connexion); List<Stagiaire> listeStagiaires = new List<Stagiaire>(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Stagiaire s = new Stagiaire(); s._id = reader.GetInt32(reader.GetOrdinal("CodeStagiaire")); s._civilité = reader.GetSqlString(1).IsNull ? string.Empty : reader.GetString(1); s._nom = reader.GetSqlString(2).IsNull ? string.Empty : reader.GetString(2); s._prenom = reader.GetSqlString(3).IsNull ? string.Empty : reader.GetString(3); s._adresse1 = reader.GetSqlString(4).IsNull ? string.Empty : reader.GetString(4); s._adresse2 = reader.GetSqlString(5).IsNull ? string.Empty : reader.GetString(5); s._adresse3 = reader.GetSqlString(6).IsNull ? string.Empty : reader.GetString(6); s._cp = reader.GetSqlString(7).IsNull ? string.Empty : reader.GetString(7); s._ville = reader.GetSqlString(8).IsNull ? string.Empty : reader.GetString(8); s._telephoneFixe = reader.GetSqlString(9).IsNull ? string.Empty : reader.GetString(9); s._telephonePortable = reader.GetSqlString(10).IsNull ? string.Empty : reader.GetString(10); s._email = reader.GetSqlString(11).IsNull ? string.Empty : reader.GetString(11); if (!reader.GetSqlDateTime(12).IsNull) { s._dateNaissance = reader.GetDateTime(12); } s._codeRegion = reader.GetSqlString(13).IsNull ? string.Empty : reader.GetString(13); s._codeNationalité = reader.GetSqlString(14).IsNull ? string.Empty : reader.GetString(14); s._codeOrigineMedia = reader.GetSqlString(15).IsNull ? string.Empty : reader.GetString(15); if (!reader.GetSqlDateTime(16).IsNull) { s._datePremierEnvoiDoc = reader.GetDateTime(16); } if (!reader.GetSqlDateTime(17).IsNull) { s._dateCreation = reader.GetDateTime(17); } s._repertoire = reader.GetSqlString(18).IsNull ? string.Empty : reader.GetString(18); if (reader.GetBoolean(19)) { s._permis = reader.GetBoolean(19); } s._photo = reader.GetSqlString(20).IsNull ? string.Empty : reader.GetString(20); if (reader.GetBoolean(21)) { s._envoiDocEnCours = reader.GetBoolean(21); } s._historique = reader.GetSqlString(22).IsNull ? string.Empty : reader.GetString(22); listeStagiaires.Add(s); } connexion.Close(); return listeStagiaires; } catch (Exception e) { System.Windows.MessageBox.Show("Impossible d'éxécuter la requête : " + e.Message, "Echec de la requête", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); return null; } }
public static bool ajouterAbsenceTemporaire(Absence pA, Stagiaire pStagiaire) { try { SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(INSERT_ABSENCE_TEMPORAIRE, connexion); cmd.Parameters.AddWithValue("@dateDebut", pA._dateDebut); cmd.Parameters.AddWithValue("@num_stagiaire", pStagiaire._id); cmd.ExecuteNonQuery(); // maintenant il faut mettre à jour l'objet Absence en lui assignant son numéro SqlCommand cmd2 = new SqlCommand(GET_NUM_ABSENCE, connexion); int idDernierAbsence = Convert.ToInt32(cmd2.ExecuteScalar()); pA._id = Convert.ToInt32(idDernierAbsence); connexion.Close(); return true; } catch (Exception) { System.Windows.MessageBox.Show("Cette absence ne peut être ajoutée.", "Ajout Absence impossible", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Stop); return false; } }
public List<Absence> getListAbsences(Stagiaire pStg) { return DAL.AbsencesDAL.getListeAbsences(pStg); }
public CtrlModifNoteECF() { _evaluation = null; _stagaire = null; }
public static List<ECF> getListeECFsNonCorriges(Stagiaire pStag) { //recup la liste des ECF planifies pour un stagiaire List<SessionECF> lesSessionsECFStag = SessionECFDAL.getListSessionsECFStagiaire(pStag); //dans cette liste on récupère les ECFs déjà passés (date de passage<aujourd'hui) List<SessionECF> lesSessionsECFPassees = null; if (lesSessionsECFStag!=null) { foreach (SessionECF sess in lesSessionsECFStag) { if (sess.Date < DateTime.Now) { if (lesSessionsECFPassees == null) lesSessionsECFPassees = new List<SessionECF>(); lesSessionsECFPassees.Add(sess); } } } //pour ceux dont la date est passée il faut vérifier si toutes les compétences ont été évaluées List<ECF> lesECFsNonCorriges = null; if (lesSessionsECFPassees!=null) { foreach (SessionECF sessionEcfPassee in lesSessionsECFPassees) { if (!SessionECFDAL.SessionECFCorrigee(sessionEcfPassee, pStag)) { if (lesECFsNonCorriges == null) lesECFsNonCorriges = new List<ECF>(); lesECFsNonCorriges.Add(sessionEcfPassee.Ecf); } } } return lesECFsNonCorriges; }
public static List<Contact> rechercherContacts(Stagiaire pStagiaire) { SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_CONTACT_PAR_STAGIAIRE, connexion); cmd.Parameters.AddWithValue("@num_stagiaire", pStagiaire._id); List<Contact> listeContacts = new List<Contact>(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Contact contact = new Contact(); Entreprise ent = new Entreprise(); contact._codeContact = reader.GetInt32(reader.GetOrdinal("CODECONTACT")); contact._nom = reader.GetSqlString(1).IsNull ? String.Empty : reader.GetString(1); contact._prenom = reader.GetSqlString(2).IsNull ? String.Empty : reader.GetString(2); contact._telFixe = reader.GetSqlString(3).IsNull ? String.Empty : reader.GetString(3); contact._telMobile = reader.GetSqlString(4).IsNull ? String.Empty : reader.GetString(4); contact._email = reader.GetSqlString(5).IsNull ? String.Empty : reader.GetString(5); contact._codeFonction = reader.GetSqlString(6).IsNull ? String.Empty : reader.GetString(6); ent._raisonSociale = reader.GetSqlString(7).IsNull ? String.Empty : reader.GetString(7); contact._Entreprise = ent; listeContacts.Add(contact); } connexion.Close(); return listeContacts; }
public List<Observation> listeObservation(Stagiaire stg) { return DAL.ObservationsDAL.getListObservations(stg); }
// Cette méthode permet d'ajouter des absences à la volée afin de répondre au besoin de rapidité le matin. Les absences sont ensuite retouchées et les champs manquants sont précisés. public bool AjouterAbsenceTemporaire(Stagiaire pStagiaire) { DateTime dateDebut = DateTime.Now; Absence a = new Absence(dateDebut, pStagiaire); return DAL.AbsencesDAL.ajouterAbsenceTemporaire(a, pStagiaire); }
public Evaluation donneNote(SessionECF pSession, Stagiaire pStag, Competence pComp) { return EvaluationsDAL.donneNote(pSession, pStag, pComp); }
public static String modifierDateSessionECF_Stagiaire(Stagiaire pStagiaire, SessionECF pSessionECF, DateTime pDate) { //Verif que cette version d'ECF n'a pas deja ete evaluee pour le stagiaire SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_EVAL_STAG, connexion); cmd.Parameters.AddWithValue("@idECF", pSessionECF.Ecf.Id); cmd.Parameters.AddWithValue("@idStagiaire", pStagiaire._id); cmd.Parameters.AddWithValue("@version", pSessionECF.Version); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { connexion.Close(); return "Vous ne pouvez plus modifier la date, le stagiaire a déjà été noté sur cette version d'ECF"; } connexion.Close(); //Supprimer lien SessionECF-stagiaire de la table ParticipantsSessionECF connexion = ConnexionSQL.CreationConnexion(); cmd = new SqlCommand(DELETE_PARTICIPANT_SESSIONECF, connexion); cmd.Parameters.AddWithValue("@idSessionECF", pSessionECF.Id); cmd.Parameters.AddWithValue("@idStagiaire", pStagiaire._id); reader = cmd.ExecuteReader(); connexion.Close(); //SI la date existe pour cet ECF dans la même version connexion = ConnexionSQL.CreationConnexion(); cmd = new SqlCommand(SELECT_SESSIONECF_DATE_VERSION, connexion); cmd.Parameters.AddWithValue("@idECF", pSessionECF.Ecf.Id); cmd.Parameters.AddWithValue("@date", pDate); cmd.Parameters.AddWithValue("@version", pSessionECF.Version); reader = cmd.ExecuteReader(); int idNEWSession; if(reader.Read()) { //on recupere l'id de cette session idNEWSession=reader.GetInt32(reader.GetOrdinal("idSessionECF")); connexion.Close(); //puis on cree ce lien connexion = ConnexionSQL.CreationConnexion(); cmd = new SqlCommand(INSERT_PARTICIPANT, connexion); cmd.Parameters.AddWithValue("@idSessionECF", idNEWSession); cmd.Parameters.AddWithValue("@idStagiaire", pStagiaire._id); cmd.ExecuteReader(); connexion.Close(); }else{ connexion.Close(); //SINON //On cree une nouvelle session SessionECF NEWSessionECF=new SessionECF(pSessionECF.Ecf, pDate,pSessionECF.Version,pStagiaire); ajouterSessionECF(NEWSessionECF); } return ""; }
//recupere la liste de toutes sessions d'un ECF d'un stagiaire public static List<SessionECF> getListSessionsECFStagiaire(Stagiaire pStag) { List<SessionECF> lesECFsPlanifiesStagiaire = null; SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_SESSIONSECF_STAG, connexion); cmd.Parameters.AddWithValue("@idStagiaire", pStag._id); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { if (lesECFsPlanifiesStagiaire == null) lesECFsPlanifiesStagiaire = new List<SessionECF>(); SessionECF sessionECFTemp = new SessionECF(); ECF ecfTemp = new ECF(); ecfTemp.Id = reader.GetInt32(reader.GetOrdinal("idECF")); sessionECFTemp.Id = reader.GetInt32(reader.GetOrdinal("idSessionECF")); sessionECFTemp.Ecf = ECFDAL.getECF(ecfTemp.Id); sessionECFTemp.Date = reader.GetDateTime(reader.GetOrdinal("date")); sessionECFTemp.Version = reader.GetInt32(reader.GetOrdinal("version")); lesECFsPlanifiesStagiaire.Add(sessionECFTemp); } connexion.Close(); return lesECFsPlanifiesStagiaire; }
public static List<Stagiaire> getListParticipants(SessionECF pSessionECF) { SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_PARTICIPANTS_SESSIONECF, connexion); cmd.Parameters.AddWithValue("@idSessionECF", pSessionECF.Id); SqlDataReader reader = cmd.ExecuteReader(); List<Stagiaire> listeStagiaires = new List<Stagiaire>(); while (reader.Read()) { Stagiaire s = new Stagiaire(); s._id = reader.GetInt32(reader.GetOrdinal("CodeStagiaire")); s = StagiairesDAL.getStagiaire(s._id); listeStagiaires.Add(s); } return listeStagiaires; }
public static List<Stagiaire> getListeStagiaires(Formation pFormation, int pTypeFormation, String pFiltreNomPrenom) { String requete = "SELECT Stagiaire.CodeStagiaire FROM Stagiaire, PlanningIndividuelFormation "; requete += " WHERE Stagiaire.CodeStagiaire=PlanningIndividuelFormation.CodeStagiaire "; //filtre formation if (pFormation != null && (pFormation.Code!="0" && pFormation.Libelle!="Toutes")) { requete += " AND PlanningIndividuelFormation.CodeFormation=@CodeFormation "; } //filtre type formation if (pTypeFormation != 0) { if (pTypeFormation==Ressources.CONSTANTES.TYPE_FORMATION_CP) { requete += " AND PlanningIndividuelFormation.CodePromotion is null "; } else if (pTypeFormation==Ressources.CONSTANTES.TYPE_FORMATION_FC) { requete += " AND PlanningIndividuelFormation.CodePromotion is not null "; } } //filtre nom/prenom if (pFiltreNomPrenom != "") { requete += " AND (Stagiaire.Nom like ('%" + pFiltreNomPrenom.Trim() + "%') OR Stagiaire.Prenom like ('%" + pFiltreNomPrenom.Trim() + "%')) "; } requete += " ORDER BY Stagiaire.Nom, Stagiaire.Prenom"; SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(requete, connexion); if (pFormation != null) cmd.Parameters.AddWithValue("@CodeFormation", pFormation.Code.Trim()); SqlDataReader reader = cmd.ExecuteReader(); List<Stagiaire> listeStagiaires = new List<Stagiaire>(); while (reader.Read()) { Stagiaire s = new Stagiaire(); s._id = reader.GetInt32(reader.GetOrdinal("CodeStagiaire")); s = getStagiaire(s._id); listeStagiaires.Add(s); } return listeStagiaires; }
public void ajouterObservation(String pTypeObs, String pTitre, String pTexte, Stagiaire pStg) { Observation obs = new Observation(Parametres.Instance.login, pTypeObs, pTitre, pTexte, pStg); DAL.ObservationsDAL.ajouterObservation(obs); }
public Absence(DateTime pDateDebut, Stagiaire pStg) { this._dateDebut = pDateDebut; this._stagiaire = pStg; }
public CtrlModifDateECF() { _sessionECF = null; _stagaire = null; }
public String modifierDateSessionECF_Stagiaire(Stagiaire pStagiaire, SessionECF pSessionECF, DateTime pDate) { return SessionECFDAL.modifierDateSessionECF_Stagiaire(pStagiaire, pSessionECF, pDate); }
public List<SessionECF> getListSessionsECFStagiaire(Stagiaire pStag) { return SessionECFDAL.getListSessionsECFStagiaire(pStag); }
public static bool SessionECFCorrigee(SessionECF pSessionECF, Stagiaire pStag) { bool b = true; if (pSessionECF.Ecf.Competences!=null) { foreach (Competence comp in pSessionECF.Ecf.Competences) { SqlConnection connexion = ConnexionSQL.CreationConnexion(); SqlCommand cmd = new SqlCommand(SELECT_NOTES_SESSIONSECF, connexion); cmd.Parameters.AddWithValue("@idECF", pSessionECF.Ecf.Id); cmd.Parameters.AddWithValue("@idStagiaire", pStag._id); cmd.Parameters.AddWithValue("@idCompetence", comp.Id); cmd.Parameters.AddWithValue("@date", pSessionECF.Date); SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { b = false; } } } return b; }