Example #1
0
        public static String ajouterLienCompetence(ECF ecf, Competence comp)
        {
            //Verifier que l'ECF n'a pas deja ete evalue
            // Si c'est le cas, on ne peut plus en modifier les competences rattachees
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(SELECT_EVAL_ECF, connexion);
            cmd.Parameters.AddWithValue("@idECF", ecf.Id);
            SqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                connexion.Close();

                return "Vous ne pouvez plus modifier les compétences de cet ECF car il a déjà été évalué";
            }
            else
            {
                connexion.Close();

                connexion = ConnexionSQL.CreationConnexion();
                cmd = new SqlCommand(INSERT_LIEN_COMPETENCE, connexion);

                cmd.Parameters.AddWithValue("@idECF", ecf.Id);
                cmd.Parameters.AddWithValue("@idCompetence", comp.Id);

                cmd.ExecuteReader();
                connexion.Close();

                return "";
            }
        }
Example #2
0
 public SessionECF()
 {
     _id = 0;
     _ecf = null;
     _date = DateTime.MinValue;
     _participants = new List<Stagiaire>();
     _version = 0;
 }
Example #3
0
 public SessionECF(ECF ecf, DateTime date, int version)
 {
     _id = 0;
     _ecf = ecf;
     _date = date;
     _version = version;
     _participants = new List<Stagiaire>();
 }
Example #4
0
 public SessionECF(int id, ECF ecf, DateTime date)
 {
     _id = id;
     _ecf = ecf;
     _date = date;
     _version = 0;
     _participants= new List<Stagiaire>();
 }
Example #5
0
 public SessionECF(ECF ecf, DateTime date, int version,List<Stagiaire> lesParticipants)
 {
     _id = 0;
     _ecf = ecf;
     _date = date;
     _version = version;
     _participants = lesParticipants;
 }
Example #6
0
 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;
 }
Example #7
0
 public Evaluation()
 {
     _id = 0;
     _ecf = new ECF();
     _competence = new Competence();
     _stagiaire = new Stagiaire();
     _version = 0;
     _note = -1;
     _date = new DateTime();
 }
Example #8
0
        public static String ajouterECF(ECF ecf)
        {
            //Verifier que ce code n'existe pas deja dans la base
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(SELECT_CODE, connexion);
            cmd.Parameters.AddWithValue("@code", ecf.Code.Trim());
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                connexion.Close();
                return "Ce code et déjà utilisé par un autre ECF";
            }
            connexion.Close();

            //Récup de l'id max dans la table ECF
            connexion = ConnexionSQL.CreationConnexion();
            cmd = new SqlCommand(SELECT_MAX, connexion);
            reader = cmd.ExecuteReader();
            int idMaxECF=0;
            if (reader.Read())
            {
                if (reader[0] != DBNull.Value) {
                    idMaxECF = reader.GetInt32(0);
                }
            }
            ecf.Id = idMaxECF + 1;
            connexion.Close();

            //Création de l'ECF
            connexion = ConnexionSQL.CreationConnexion();
            cmd = new SqlCommand(INSERT_ECF, connexion);

            cmd.Parameters.AddWithValue("@idECF", ecf.Id);
            cmd.Parameters.AddWithValue("@code", ecf.Code.Trim());
            cmd.Parameters.AddWithValue("@libelle", ecf.Libelle.Trim());
            cmd.Parameters.AddWithValue("@coefficient", 1);
            cmd.Parameters.AddWithValue("@typeNotation", 0);
            cmd.Parameters.AddWithValue("@nbreVersions", 1);

            cmd.ExecuteReader();
            connexion.Close();

            return "";
        }
Example #9
0
        //recupere la liste de toutes sessions d'un ECF dans une version precise
        public static List<SessionECF> getListSessionsECFVersion(ECF pECF, int pVersion)
        {
            List<SessionECF> lesSessionsECFs = new List<SessionECF>();
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(SELECT_SESSIONSECFVERSION, connexion);
            cmd.Parameters.AddWithValue("@idECF", pECF.Id);
            cmd.Parameters.AddWithValue("@version", pVersion);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                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"));

                //participants
                List<Stagiaire> lesParticipants = new List<Stagiaire>();
                SqlConnection c2 = ConnexionSQL.CreationConnexion();
                SqlCommand cmd2 = new SqlCommand(SELECT_PARTICIPANTS, c2);
                cmd2.Parameters.AddWithValue("@idSessionECF", sessionECFTemp.Id);
                SqlDataReader reader2 = cmd2.ExecuteReader();

                while (reader2.Read())
                {
                    int idStag = reader2.GetInt32(reader2.GetOrdinal("idStagiaire"));
                    Stagiaire participant = StagiairesDAL.getStagiaire(idStag);

                    sessionECFTemp.Participants.Add(participant);
                }
                c2.Close();

                lesSessionsECFs.Add(sessionECFTemp);
            }
            connexion.Close();

            return lesSessionsECFs;
        }
Example #10
0
        //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;
        }
Example #11
0
        public static int donneIdSessionECF(ECF pEcf, DateTime pDate, int pVersion)
        {
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(SELECT_ID_SESSIONECF, connexion);
            cmd.Parameters.AddWithValue("@idECF", pEcf.Id);
            cmd.Parameters.AddWithValue("@date", pDate);
            cmd.Parameters.AddWithValue("@version", pVersion);
            SqlDataReader reader = cmd.ExecuteReader();

            int idSessionECF = 0;
            if (reader.Read())
            {
                if (reader[0] != DBNull.Value)
                {
                    idSessionECF = reader.GetInt32(0);
                }
            }
            connexion.Close();

            return idSessionECF;
        }
 public List<SessionECF> getListSessionsECFVersion(ECF pECF, int pVersion)
 {
     return SessionECFDAL.getListSessionsECFVersion(pECF, pVersion);
 }
 public void ajouterLienFormation(ECF pECF, Formation pForm)
 {
     ECFDAL.ajouterLienFormation(pECF, pForm);
 }
 public List<SessionECF> getListSessionsECF(ECF pECF)
 {
     return SessionECFDAL.getListSessionsECF(pECF);
 }
Example #15
0
 public void ajouterCompetence(ECF pECF, Competence pCompetence)
 {
     pECF._competences.Add(pCompetence);
 }
Example #16
0
 public void ajouterFormation(ECF pECF, Formation pForm)
 {
     pECF._formations.Add(pForm);
 }
Example #17
0
        public static String modifierECF(ECF ecf)
        {
            String reponse="";
            SqlConnection connexion;
            SqlCommand cmd;
            SqlDataReader reader;

            ECF AncienECF=getECF(ecf.Id);

            //Si on souhaite changer le type de notation mais qu'il y a deja des notes
            if(AncienECF.NotationNumerique!=ecf.NotationNumerique)
            {
                connexion = ConnexionSQL.CreationConnexion();
                cmd = new SqlCommand(SELECT_EVAL_ECF, connexion);
                cmd.Parameters.AddWithValue("@idECF", ecf.Id);
                reader = cmd.ExecuteReader();
                if(reader.Read())
                {
                    reponse = "Modification du type de notation impossible, certains stagiaires ont déjà été évalués selon l'ancien type de notation";
                    return reponse;
                }
            }

            //Si on souhaite reduire le nombre de versions mais qu'il y a deja des notes
            if(AncienECF.NbreVersion>ecf.NbreVersion)
            {
                connexion = ConnexionSQL.CreationConnexion();
                cmd = new SqlCommand(SELECT_EVAL_VERSIONECF, connexion);
                cmd.Parameters.AddWithValue("@idECF", ecf.Id);
                cmd.Parameters.AddWithValue("@version", ecf.NbreVersion);
                reader = cmd.ExecuteReader();
                if(reader.Read())
                {
                    reponse = "Modification du nombre de versions impossible, certains stagiaires ont déjà été évalués selon des versions d'ECF supplémentaires";
                    return reponse;
                }
            }

            //MAJ de l'ECF
            connexion = ConnexionSQL.CreationConnexion();
            cmd = new SqlCommand(UPDATE_ECF, connexion);

            cmd.Parameters.AddWithValue("@idECF", ecf.Id);
            cmd.Parameters.AddWithValue("@libelleECF", ecf.Libelle);
            cmd.Parameters.AddWithValue("@coefficient", ecf.Coefficient);
            int typeNotation = Ressources.CONSTANTES.NOTATION_ACQUISITION;
            if (ecf.NotationNumerique) typeNotation = Ressources.CONSTANTES.NOTATION_NUMERIQUE;
            cmd.Parameters.AddWithValue("@typeNotation", typeNotation);
            cmd.Parameters.AddWithValue("@nbreVersions", ecf.NbreVersion);
            cmd.Parameters.AddWithValue("@commentaire", ecf.Commentaire);

            cmd.ExecuteReader();
            connexion.Close();

            bool memesCompetences = false;
            if (ecf.Competences!=null && AncienECF.Competences!=null && ecf.Competences.Count==AncienECF.Competences.Count)
            {
                foreach (Competence comp in ecf.Competences)
                {
                    int indexAncienneComp = AncienECF.Competences.IndexOf(comp);
                    if (indexAncienneComp == -1)
                    {
                        memesCompetences = false;
                        break;
                    }
                    else
                    {
                        if (comp.Equals(AncienECF.Competences[indexAncienneComp]))
                        {
                            memesCompetences = true;
                        }
                        else
                        {
                            memesCompetences = false;
                            break;
                        }
                    }
                }
            }

            if (!memesCompetences)
            {
                //Suppr des liens ECF-Competences si pas deja d'evaluation sur l'ECF
                reponse = supprimerLiensCompetences(ecf);

                if (reponse != "")
                {
                    return reponse;
                }
                else
                {
                    //Création des liens ECF-Competences
                    if (ecf.Competences != null)
                    {
                        foreach (Competence compTemp in ecf.Competences)
                        {
                            ajouterLienCompetence(ecf, compTemp);
                        }
                    }
                }
            }

            //Suppr des liens ECF-Formations
            supprimerLiensFormations(ecf);

            //Création des liens ECF-Competences
            if (ecf.Formations!=null)
            {
                foreach (Formation formTemp in ecf.Formations)
                {
                    ajouterLienFormation(ecf, formTemp);
                }
            }

            return "";
        }
Example #18
0
        public static List<ECF> getListECFs()
        {
            List<ECF> lesECFs = new List<ECF>();

            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(SELECT_ECFS, connexion);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                ECF ecfTemp = new ECF();
                ecfTemp.Id = reader.GetInt32(reader.GetOrdinal("idECF"));
                ecfTemp.Code = reader.GetString(reader.GetOrdinal("code")).Trim();
                ecfTemp.Libelle = reader.GetString(reader.GetOrdinal("libelle")).Trim();

                if (reader["coefficient"] != DBNull.Value) ecfTemp.Coefficient = reader.GetDouble(reader.GetOrdinal("coefficient"));
                ecfTemp.NotationNumerique = true;
                if ((reader["typeNotation"] != DBNull.Value) && (reader.GetInt16(reader.GetOrdinal("typeNotation")) == Ressources.CONSTANTES.NOTATION_ACQUISITION))
                {
                    ecfTemp.NotationNumerique = false;
                }
                if (reader["nbreVersions"] != DBNull.Value) ecfTemp.NbreVersion = reader.GetInt32(reader.GetOrdinal("nbreVersions"));
                if (reader["commentaire"] != DBNull.Value) ecfTemp.Commentaire = reader.GetString(reader.GetOrdinal("commentaire")).Trim();

                //Competences
                SqlConnection c2 = ConnexionSQL.CreationConnexion();
                SqlCommand cmd2 = new SqlCommand(SELECT_COMPS, c2);
                cmd2.Parameters.Add(new SqlParameter("@lienECFComp",ecfTemp.Id));
                SqlDataReader reader2 = cmd2.ExecuteReader();
                List<Competence> lesComp = new List<Competence>();
                while (reader2.Read())
                {
                    Competence compTemp = new Competence();
                    compTemp.Id = reader2.GetInt32(reader2.GetOrdinal("idCompetence"));
                    compTemp.Code = reader2.GetString(reader2.GetOrdinal("code")).Trim();
                    compTemp.Libelle = reader2.GetString(reader2.GetOrdinal("libelle")).Trim();
                    lesComp.Add(compTemp);
                }
                c2.Close();
                ecfTemp.Competences = lesComp;

                //Formations
                SqlConnection c3 = ConnexionSQL.CreationConnexion();
                SqlCommand cmd3 = new SqlCommand(SELECT_FORMS, c3);
                cmd3.Parameters.Add(new SqlParameter("@lienECFForm", ecfTemp.Id));
                SqlDataReader reader3 = cmd3.ExecuteReader();
                List<Formation> lesFormations = new List<Formation>();
                while (reader3.Read())
                {
                    Formation formTemp = new Formation();
                    formTemp.Code = reader3.GetString(reader3.GetOrdinal("CodeFormation"));
                    formTemp.Libelle = reader3.GetString(reader3.GetOrdinal("LibelleCourt")).Trim();
                    lesFormations.Add(formTemp);
                }
                c3.Close();
                ecfTemp.Formations = lesFormations;

                lesECFs.Add(ecfTemp);
            }
            connexion.Close();

            return lesECFs;
        }
 public String supprimerLiensCompetences(ECF pECF)
 {
     return ECFDAL.supprimerLiensCompetences(pECF);
 }
 public String ajouterLienCompetence(ECF pECF, Competence pComp)
 {
     return ECFDAL.ajouterLienCompetence(pECF, pComp);
 }
 public void supprimerLiensFormations(ECF pECF)
 {
     ECFDAL.supprimerLiensFormations(pECF);
 }
 public int donneIdSessionECF(ECF pECF, DateTime pDate, int pVersion)
 {
     return SessionECFDAL.donneIdSessionECF(pECF, pDate, pVersion);
 }
 public List<SessionECF> donneSessionsECFJour(ECF pECF, DateTime pDate)
 {
     return SessionECFDAL.donneSessionsECFJour(pECF, pDate);
 }
 public String ajouterECF(ECF pECF)
 {
     return ECFDAL.ajouterECF(pECF);
 }
Example #25
0
        public static void supprimerLiensFormations(ECF ecf)
        {
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(DELETE_LIENS_FORMATIONS, connexion);

            cmd.Parameters.AddWithValue("@idECF", ecf.Id);

            cmd.ExecuteReader();
            connexion.Close();
        }
Example #26
0
 public void changerNbreVersion(ECF pECF, int pNbreVersion)
 {
     pECF._nbreVersion=pNbreVersion;
 }
Example #27
0
        public static void supprimerECF(ECF ecf)
        {
            //Suppr des liens ECF-Competences
            supprimerLiensCompetences(ecf);
            //Suppr des liens ECF-Formations
            supprimerLiensFormations(ecf);

            //Suppr d'un ECF
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(DELETE_ECF, connexion);

            cmd.Parameters.AddWithValue("@id", ecf.Id);

            cmd.ExecuteReader();
            connexion.Close();
        }
Example #28
0
        public static void supprimerLienFormation(ECF ecf, Formation form)
        {
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(DELETE_LIEN_FORMATION, connexion);

            cmd.Parameters.AddWithValue("@idECF", ecf.Id);
            cmd.Parameters.AddWithValue("@codeFormation", form.Code);

            cmd.ExecuteReader();
            connexion.Close();
        }
Example #29
0
 public void supprimerLienFormation(ECF pECF, Formation pForm)
 {
     ECFDAL.supprimerLienFormation(pECF, pForm);
 }
        private bool _ecfAdd; //si true on est en train d'ajouter un ECF sinon une Competence

        #endregion Fields

        #region Constructors

        public CtrlAjoutECF_Competence()
        {
            _ecfAdd = false;
            _ECF = null;
            _competence = null;
        }