예제 #1
0
        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;
        }
예제 #2
0
        /// <summary>
        /// Récupère une Competence à partir d'un identifiant de client
        /// </summary>
        /// <param name="Identifiant">Identifant de Competence</param>
        /// <returns>Un Competence </returns>
        public static Competence Get(Int32 identifiant)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"SELECT Identifiant, Libelle FROM Competence
                                WHERE Identifiant = @Identifiant";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Identifiant", identifiant);

            //Execution
            connection.Open();
            SqlDataReader dataReader = commande.ExecuteReader();

            dataReader.Read();

            //1 - Création du Competence
            Competence competence = new Competence();

            competence.Identifiant = dataReader.GetInt32(0);
            competence.Libelle = dataReader.GetString(1);

            dataReader.Close();
            connection.Close();
            return competence;
        }
예제 #3
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 "";
            }
        }
예제 #4
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;
 }
예제 #5
0
 public Evaluation()
 {
     _id = 0;
     _ecf = new ECF();
     _competence = new Competence();
     _stagiaire = new Stagiaire();
     _version = 0;
     _note = -1;
     _date = new DateTime();
 }
예제 #6
0
        public async Task <IActionResult> Create([Bind("CompetenceID,Name")] Competence competence)
        {
            if (ModelState.IsValid)
            {
                _context.Add(competence);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(competence));
        }
예제 #7
0
 private void cbbChucVu_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (var uow = new UnitOfWork())
     {
         Competence nv = uow.FindObject <Competence>(CriteriaOperator.Parse("CompetenceID = ?", lkChucVu.EditValue));
         if (nv != null)
         {
             txtPhuCapChucVu.Text = nv.Allowance;
         }
     }
 }
예제 #8
0
 public ActionResult Edit([Bind(Include = "ID,Name,Description,EnterpriseID")] Competence competence)
 {
     if (ModelState.IsValid)
     {
         db.Entry(competence).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EnterpriseID = new SelectList(db.Enterprises, "ID", "Name", competence.EnterpriseID);
     return(View(competence));
 }
예제 #9
0
 public void ModifyComp(int Id, string Nom, bool?Actif, Langue Lang)
 {
     using (var db = new MarcassinEntities1()) {
         Competence b = db.Competences.Find(Id);
         b.nomCompetence   = Nom;
         b.estActif        = Actif.Value;
         b.Langue          = db.Langues.Find(Lang.idLangue);
         db.Entry(b).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #10
0
        public ActionResult EditCompetence(Competence c1, int id)
        {
            Domain.Entity.Competence skill = cs.GetById(id);
            skill.Label     = c1.Label;
            skill.Dificulty = c1.Dificulty;


            cs.Update(skill);
            cs.Commit();
            return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
        }
예제 #11
0
 public ActionResult Edit([Bind(Include = "PositionId,CourseId,Description,IsRequired")] Competence competence)
 {
     if (ModelState.IsValid)
     {
         db.Entry(competence).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseId   = new SelectList(db.CoursesList, "Id", "Name", competence.CourseId);
     ViewBag.PositionId = new SelectList(db.PositionsList, "Id", "Name", competence.PositionId);
     return(View(competence));
 }
예제 #12
0
 // Check if a competence can be unlocked and unlock it if possible
 public void CanUnlockCompetence(Competence competence)
 {
     if (canUnlockComp)
     {
         if (competence.CanUnlockCompetence() && competence)
         {
             goldBar = 0;
             OnLossGold?.Invoke(goldToUnlockCompetence);
         }
     }
     OnTryUnlockCompetence?.Invoke(competence);
 }
예제 #13
0
        public async Task <IActionResult> AddCompetence([Bind("Id,DirectionCode,Code,Description")] Competence competence)
        {
            if (ModelState.IsValid)
            {
                _context.Add(competence);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Edit), new { id = competence.DirectionCode }));
            }
            ViewData["DirectionCode"] = new SelectList(_context.Direction, "Code", "Code", competence.DirectionCode);
            return(RedirectToAction(nameof(Index)));
        }
예제 #14
0
    private void MakeDictionnary()
    {
        _availableComp   = new Dictionary <CompetenceId, Type>();
        _competenceTypes = Assembly.GetAssembly(typeof(Competence)).GetTypes()
                           .Where(myType => !myType.IsAbstract && myType.IsSubclassOf(typeof(Competence)));

        object[] constructorParameter = new object[] { null, null };
        foreach (var type in _competenceTypes)
        {
            Competence tempInstance = Activator.CreateInstance(type, constructorParameter) as Competence;
            _availableComp.Add(tempInstance.id, type);
        }
    }
예제 #15
0
        private void AddNewExpButton_Click(object sender, EventArgs e)
        {
            CompetenceLevel competenceLevel;

            Enum.TryParse <CompetenceLevel>(LevelcomboBox.SelectedValue.ToString(), out competenceLevel);

            Competence competence = new Competence(ExperienceRichTextBox.Text, competenceLevel);

            competences.Add(competence);
            MessageBox.Show("Du har lagt till en ny kompetens");
            ExperienceRichTextBox.Clear();
            LoadCompetences();
        }
예제 #16
0
 public bool Create(Competence competence)
 {
     try
     {
         dbCompentence.Competences.Add(competence);
         dbCompentence.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #17
0
    public ArbreCompetence(int id, Competence [] abc)
    {
        _id = id;
        _competences = new Competence[20];
        _nbCompetences = 0;

        int i = 0;
        foreach (Competence c in abc)
        {
            _competences[i] = c;
            i++;
        }
    }
예제 #18
0
 public void setCompetences(Competence[] c)
 {
     int i =0;
     foreach (Competence cmp in c)
     {
         _competences[i] = cmp;
         i++;
     }
     for (int j = i; j < _competences.Length; j++)
     {
         _competences[j] = null;
     }
 }
        public void Set_Up_Unit_UI_From_Template_And_Pass_It_To_Manager()
        {
            ICompetenceButtonFactory factory             = A.CompetenceButtonFactory();
            CompetenceButton         newButton           = new GameObject().AddComponent <CompetenceButton>();
            Competence newCompetence                     = A.Competence();
            CompetenceButtonFactoryController controller = new CompetenceButtonFactoryController(factory);

            //Act
            controller.InitNewButton(newButton, newCompetence);

            //Assert
            Assert.AreEqual(newButton.dataToSend, newCompetence);
            Assert.IsTrue(factory.instanceManager.workers.Contains(newButton));
        }
예제 #20
0
        // GET: Competences/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Competence competence = db.Competences.Find(id);

            if (competence == null)
            {
                return(HttpNotFound());
            }
            return(View(competence));
        }
예제 #21
0
        public IHttpActionResult DeleteCompetence(int id)
        {
            Competence competence = db.Competence.Find(id);

            if (competence == null)
            {
                return(NotFound());
            }

            db.Competence.Remove(competence);
            db.SaveChanges();

            return(Ok(competence));
        }
예제 #22
0
    public Competence GetCompetenceInstanceFromTemplate(ICompetenceTemplate template)
    {
        if (!_availableComp.ContainsKey(template.id))
        {
            return(null);
        }

        Type competenceType = _availableComp[template.id];

        object[]   constructorParameter = new object[] { template, _caster };
        Competence toReturn             = Activator.CreateInstance(competenceType, constructorParameter) as Competence;

        return(toReturn);
    }
예제 #23
0
    public void OnReceiveEvent(Competence receivedComp)
    {
        if (receivedComp == _currentComp)
        {
            return;
        }

        StopCoroutine(Tick());
        ResetCaster();

        _currentComp = receivedComp;
        _currentComp.PreCast();
        _hasSelect = true;
        StartCoroutine(Tick());
    }
예제 #24
0
        // GET: Competences/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Competence competence = db.Competences.Find(id);

            if (competence == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EnterpriseID = new SelectList(db.Enterprises, "ID", "Name", competence.EnterpriseID);
            return(View(competence));
        }
예제 #25
0
        public ActionResult Delete(int id)
        {
            //    var competence = db.Competences.Where(c => c.ID == id).Include(c => c.CompotencesRatings).FirstOrDefault();
            var ratings = db.CompetencesRatings.Where(cr => cr.CompetenceID == id).ToList();

            foreach (var rating in ratings)
            {
                db.CompetencesRatings.Remove(rating);
            }
            Competence competence = db.Competences.Find(id);

            db.Competences.Remove(competence);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #26
0
        public async Task <IActionResult> AddOffreCompetance(int id, [FromBody] Competence competence)
        {
            var offre = await _context.Offre.FindAsync(id);

            if (offre != null)
            {
                competence.offre = offre;
                _context.Add(competence);
                _context.SaveChanges();
                return(Ok(new
                {
                    competence
                }));
            }
            return(NotFound());
        }
예제 #27
0
        public async Task <IActionResult> AddCompetence(string id, [FromBody] Competence comp)
        {
            Candidat user = (Candidat)await userManager.FindByIdAsync(id);

            if (user != null)
            {
                comp.candidat = user;
                _context.Add(comp);
                _context.SaveChanges();
                return(Ok(new
                {
                    comp = comp
                }));
            }
            return(NotFound());
        }
예제 #28
0
 public frmCompetenceView(string competenceID)
 {
     InitializeComponent();
     btnThem.Enabled     = false;
     txtMaChucVu.Enabled = false;
     using (var uow = new UnitOfWork())
     {
         Competence competence = uow.FindObject <Competence>(CriteriaOperator.Parse("CompetenceID = ?", competenceID));
         if (competence != null)
         {
             txtMaChucVu.Text   = competence.CompetenceID;
             txtTenChucVu.Text  = competence.CompetenceName;
             txtTienPhuCap.Text = competence.Allowance;
         }
     }
 }
예제 #29
0
        // GET: Competences/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Competence competence = db.CompetencesList.Find(id);

            if (competence == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CourseId   = new SelectList(db.CoursesList, "Id", "Name", competence.CourseId);
            ViewBag.PositionId = new SelectList(db.PositionsList, "Id", "Name", competence.PositionId);
            return(View(competence));
        }
    public static TooltipInformations GetUsableCompetenceTooltip(Competence competence, RectTransform forcedPosition, TooltipForcedPositionType tooltipForcedPositionType)
    {
        if (competence == null)
            return new TooltipInformations();

        TooltipInformations infos = new TooltipInformations();

        infos.tooltipName = competence.GetCompetenceName;
        infos.tooltipDescription = competence.GetCompetenceTooltip;
        infos.tooltipAdditionalInformationType = TooltipAdditionalInformationType.ActionPointsCost;
        infos.tooltipAdditionalInformationValue = competence.GetActionPointsCost;
        infos.forcedTooltipLPosition = forcedPosition;
        infos.tooltipForcedPositionType = tooltipForcedPositionType;

        return infos;
    }
예제 #31
0
        public ActionResult CreateCompetence(Competence skill)
        {
            Domain.Entity.Competence c = new Domain.Entity.Competence
            {
                idCompetence = skill.idCompetence,

                Label       = skill.Label,
                Dificulty   = skill.Dificulty,
                idRessource = skill.idRessource,
            };
            cs.Add(c);
            cs.Commit();
            //var path = Path.Combine(Server.MapPath("~/Content/Upload/"), Image.FileName);
            //Image.SaveAs(path);
            return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
        }
예제 #32
0
        public async Task <ActionResult <CompetenceViewModel> > Get(int id, bool includeConsultant = false)
        {
            try
            {
                Competence result = await repository.GetCompetenceAsync(id);

                if (result == null)
                {
                    return(NotFound());
                }
                return(mapper.Map <CompetenceViewModel>(result));
            }
            catch (Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Error in database"));
            }
        }
예제 #33
0
 public async Task <ActionResult <CompetenceViewModel> > Post(CompetenceViewModel model)
 {
     try
     {
         Competence result = mapper.Map <Competence>(model);
         repository.Add(result);
         if (await repository.SaveChangesAsync())
         {
             return(Created($"/api/camps/{result.CompetenceId}", mapper.Map <CompetenceViewModel>(result)));
         }
     }
     catch (Exception)
     {
         return(this.StatusCode(StatusCodes.Status500InternalServerError, "Error in database"));
     }
     return(BadRequest());
 }
예제 #34
0
    private void CompetenceHandler(Competence competence)
    {
        Sense goal = competence.Goals[0];

        if (CheckSense(0, goal) == 0)
        {
            ABOD3_Bridge.GetInstance().AletForElement(botNumber, competence.Name, "C");

            int numCEActivated = 0;
            foreach (CompetenceElement competenceElement in competence.Elements)
            {
                if (CompetenceElementsHandler(competenceElement))
                {
                    numCEActivated = numCEActivated + 1;
                }
            }
        }
    }
예제 #35
0
 public void InsertCours(string Nom, DateTime Date, bool?Finis, Competence Comp)
 {
     using (var db = new MarcassinEntities1()) {
         string name = Nom + " ChatRoom";
         db.ChatRooms.Add(new ChatRoom()
         {
             nomduRoom = name
         });
         db.SaveChanges();
         ChatRoom cr = db.ChatRooms.Where(m => m.nomduRoom == name).First();
         Cour     c  = new Cour()
         {
             nomCours = Nom, dateCours = Date, estFinit = Finis.Value, Competence = Comp, ChatRoom = cr
         };
         db.Cours.Add(c);
         db.SaveChanges();
     }
 }
예제 #36
0
        /// <summary>
        /// Processes this instance.
        /// </summary>
        internal override void Process()
        {
            Cards Card = CSV.Tables.Get(Gamefile.Cards).GetDataWithID(this.GlobalID) as Cards;

            if (Card != null)
            {
                Competence Competence = new Competence(this.GlobalID);
                Characters Character  = CSV.Tables.Get(Gamefile.Characters).GetData(Card.Target) as Characters;

                if (Character != null)
                {
                    this.CardType = Character.GetDataType();
                    this.CardID   = Character.GetID();

                    if (this.Device.Player.Deck.ContainsKey(this.GlobalID))
                    {
                        Card CardData = this.Device.Player.Deck[this.GlobalID];

                        if (CardData.Competences.ContainsKey(Competence.GlobalID))
                        {
                            CardData.Competences[Competence.GlobalID].Upgrade();
                        }
                        else
                        {
                            CardData.Competences.Add(Competence);
                        }
                    }
                    else
                    {
                        Card CardData = new Card(this.GlobalID);
                        this.Device.Player.Deck.Add(CardData);
                        CardData.Competences.Add(Competence);
                    }
                }
                else
                {
                    Logging.Error(this.GetType(), "Error when processing a card upgrade, the Character instance was null for the card n°" + this.GlobalID + ".");
                }
            }
            else
            {
                Logging.Error(this.GetType(), "Error when upgrading a card, with id " + this.GlobalID + ".");
            }
        }
예제 #37
0
        public ActionResult AddOrEditCompetence(CompetenceVM competence)
        {
            int userId = int.Parse(HttpContext.User.Identity.Name);


            if (ModelState.IsValid) //Despite its name, it doesn't actually know anything about any model classes.
                                    //The ModelState represents a Enumerable of name and value pairs that were submitted to the server during a POST.
                                    //It also contains a Enumerable of error messages for each value submitted
            {
                if (competence.FormAction == "AjoutTraitement")
                {
                    Competence compet = new Competence();

                    compet.Label      = competence.Label;
                    compet.Details    = competence.Details;
                    compet.PersonneId = userId;

                    using (Context context = new Context())
                    {
                        context.Competences.Add(compet);
                        context.SaveChanges();
                    }
                }
                else if (competence.FormAction == "EditionTraitement")
                {
                    using (Context context = new Context())
                    {
                        var result = (from c in context.Competences
                                      where c.Id == competence.Id && c.PersonneId == userId
                                      select c).SingleOrDefault();

                        if (result != null)
                        {
                            result.Label   = competence.Label;
                            result.Details = competence.Details;

                            context.SaveChanges();
                        }
                    }
                }
            }

            return(RedirectToAction("Competences"));
        }
예제 #38
0
        public static void Insert(Competence Competence)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"INSERT INTO Competence (Libelle)
                                VALUES @Libelle";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Libelle", Competence.Libelle);

            //Execution
            connection.Open();

            commande.ExecuteNonQuery();
            connection.Close();
        }
예제 #39
0
        public static String ajouterCompetence(Competence comp)
        {
            //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", comp.Code.Trim());
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                connexion.Close();
                return "Ce code et déjà utilisé par une autre compétence";
            }
            connexion.Close();

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

            //Création de la competence
            connexion = ConnexionSQL.CreationConnexion();
            cmd = new SqlCommand(INSERT_COMP, connexion);

            cmd.Parameters.AddWithValue("@id", comp.Id);
            cmd.Parameters.AddWithValue("@code", comp.Code);
            cmd.Parameters.AddWithValue("@libelle", comp.Libelle);

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

            return "";
        }
예제 #40
0
        public static List<Competence> getListCompetences()
        {
            List<Competence> lesCompetences = new List<Competence>();
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = null;
            cmd = new SqlCommand(SELECT_COMPETENCES, connexion);
            SqlDataReader reader =cmd.ExecuteReader();

            while (reader.Read())
            {
                Competence compTemp = new Competence();
                compTemp.Id = reader.GetInt32(reader.GetOrdinal("idCompetence"));
                compTemp.Code = reader.GetString(reader.GetOrdinal("code")).Trim();
                compTemp.Libelle = reader.GetString(reader.GetOrdinal("libelle")).Trim();

                lesCompetences.Add(compTemp);
            }
            connexion.Close();

            return lesCompetences;
        }
        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;
        }
예제 #42
0
 public Evaluation donneNote(SessionECF pSession, Stagiaire pStag, Competence pComp)
 {
     return EvaluationsDAL.donneNote(pSession, pStag, pComp);
 }
 public String supprimerCompetence(Competence pComp)
 {
     return CompetencesDAL.supprimerCompetence(pComp);
 }
예제 #44
0
        /// <summary>
        /// Récupère une liste de Competence à partir de la base de données
        /// </summary>
        /// <returns>Une liste de client</returns>
        public static List<Competence> List()
        {
            //Récupération de la chaine de connexion
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = "SELECT Identifiant, Libelle FROM Competence";
            connection.Open();
            SqlCommand commande = new SqlCommand(requete, connection);
            //execution

            SqlDataReader dataReader = commande.ExecuteReader();

            List<Competence> list = new List<Competence>();
            while (dataReader.Read())
            {

                //1 - Créer un Competence à partir des donner de la ligne du dataReader
                Competence competence = new Competence();
                competence.Identifiant = dataReader.GetInt32(0);
                competence.Libelle = dataReader.GetString(1);

                //2 - Ajouter ce Competence à la list de client
                list.Add(competence);
            }
            dataReader.Close();
            connection.Close();
            return list;
        }
 public String ajouterCompetence(Competence pComp)
 {
     return CompetencesDAL.ajouterCompetence(pComp);
 }
예제 #46
0
        public static void Update(Competence Competence)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"UPDATE Competence
                               SET Libelle = @Libelle
                               WHERE Identifiant = @Identifiant";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Libelle", Competence.Libelle);
            commande.Parameters.AddWithValue("Identifiant", Competence.Identifiant);
            //Execution
            connection.Open();
            commande.ExecuteNonQuery();
            connection.Close();
        }
예제 #47
0
파일: ECF.cs 프로젝트: rlion/ApplicationENI
 public void ajouterCompetence(ECF pECF, Competence pCompetence)
 {
     pECF._competences.Add(pCompetence);
 }
 public String ajouterLienCompetence(ECF pECF, Competence pComp)
 {
     return ECFDAL.ajouterLienCompetence(pECF, pComp);
 }
예제 #49
0
        public static String supprimerCompetence(Competence comp)
        {
            //Vérif s'il y a des liens ECF-Competence
            SqlConnection connexion = ConnexionSQL.CreationConnexion();
            SqlCommand cmd = new SqlCommand(SELECT_LIENS, connexion);
            cmd.Parameters.AddWithValue("@idCompetence", comp.Id);
            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                connexion.Close();
                return "Il existe des liens entre cette compétence (" + comp.Code + " - " + comp.Libelle +
                    ") et (au moins) un ECF";
            }
            connexion.Close();

            //Suppr d'une competence
            connexion = ConnexionSQL.CreationConnexion();
            cmd = new SqlCommand(DELETE_COMPETENCE, connexion);

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

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

            return "";
        }
예제 #50
0
 public void addCompetence(Competence c)
 {
     _competences[_nbCompetences] = c;
     _nbCompetences++;
 }
예제 #51
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;
        }