Example #1
0
        protected override void ReadFormToEntity()
        {
            Formateur Stagiaire  = (Formateur)this.Entity;
            bool      validation = true;

            // etat Civil
            Stagiaire.Nom           = nomTextBox.Text;
            Stagiaire.Prenom        = prenomTextBox.Text;
            Stagiaire.Cin           = cinTextBox.Text;
            Stagiaire.Sexe          = radioButtonHomme.Checked;
            Stagiaire.DateNaissance = dateNaissanceDateTimePicker.Value;



            //Coordonnées
            Stagiaire.Telephone = telephoneTextBox.Text;
            Stagiaire.Adress    = adressTextBox.Text;
            Stagiaire.Email     = emailTextBox.Text;



            if (Combo_Filiere.SelectedItem != null)
            {
                Stagiaire.Filiere = (Filiere)Combo_Filiere.SelectedItem;
            }

            //Identification
            Stagiaire.Login    = txt_login.Text;
            Stagiaire.Password = txt_password.Text;
            if (txt_password.Text != txt_password2.Text)
            {
                validation = false;
            }
        }
        /// <summary>
        /// Afficher l'objet formateur dans l'interface
        /// </summary>
        public override void Afficher()
        {
            Formateur formateur = (Formateur)this.Entity;

            // Etat civil
            nomTextBox.Text    = formateur.Nom;
            prenomTextBox.Text = formateur.Prenom;
            cinTextBox.Text    = formateur.Cin;
            if (formateur.Sexe)
            {
                radioButtonHomme.Checked = true;
            }
            else
            {
                radioButtonFamme.Checked = true;
            }
            dateNaissanceDateTimePicker.Value = formateur.DateNaissance;

            // Coordonnées
            telephoneTextBox.Text = formateur.Telephone;
            adressTextBox.Text    = formateur.Adress;
            emailTextBox.Text     = formateur.Email;

            // Affectation
            Combo_Filiere.SelectedItem = formateur.Filiere;
        }
Example #3
0
        public override void WriteEntityToField()
        {
            Formateur Stagiaire  = (Formateur)this.Entity;
            bool      validation = true;

            // Création d'un stagiaire en cas d'un nouvelle enregistrement
            if (Stagiaire == null)
            {
                Stagiaire = new Formateur();
            }

            // Etat civil
            nomTextBox.Text    = Stagiaire.Nom;
            prenomTextBox.Text = Stagiaire.Prenom;
            cinTextBox.Text    = Stagiaire.Cin;
            if (Stagiaire.Sexe)
            {
                radioButtonHomme.Checked = true;
            }
            else
            {
                radioButtonFamme.Checked = true;
            }
            dateNaissanceDateTimePicker.Value = Stagiaire.DateNaissance;

            // Coordonnées
            telephoneTextBox.Text = Stagiaire.Telephone;
            adressTextBox.Text    = Stagiaire.Adress;
            emailTextBox.Text     = Stagiaire.Email;

            // Affectation
            Combo_Filiere.SelectedItem = Stagiaire.Filiere;
        }
Example #4
0
        public IHttpActionResult PutFormateur(int id, Formateur formateur)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != formateur.FormateurID)
            {
                return(BadRequest());
            }

            _db.Entry(formateur).State = System.Data.Entity.EntityState.Modified;

            try
            {
                _db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FormateurExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #5
0
        private void btn_ajoutFormation_Click(object sender, RoutedEventArgs e)
        {
            this.SwipeMessages();
            List <Nameable> lstMatieresNameable = ((MutliSelectPickList)(this.MultiSelect.Content)).GetSelectedObjects();
            List <Matiere>  lstMatieres         = new List <Matiere>();

            foreach (Nameable mat in lstMatieresNameable)
            {
                lstMatieres.Add((Matiere)mat);
            }
            String nom    = this.tb_nomFormateur.Text;
            String prenom = this.tb_prenomFormateur.Text;
            String mail   = this.tb_mailFormateur.Text;
            String tel    = this.tb_telFormateur.Text;

            try
            {
                Formateur formateur = FormateurDAO.CreerFormateur(nom, prenom, mail, tel, lstMatieres);
            }
            catch (Exception error)
            {
                this.tbk_error.Text       = "Erreur : " + error.Message;
                this.tbk_error.Visibility = Visibility.Visible;
                return;
            }
            this.tbk_statut.Text       = "Formateur Ajouté.";
            this.tbk_statut.Visibility = Visibility.Visible;
        }
        public ActionResult Create(FormationViewModel FVM)
        {
            try
            {
                Formation f = new Formation();

                f.CodeFormateur = FVM.FormateurViewModel.CodeFormateur;
                //taw narj3oulha
                Formateur formateur = FrS.GetById(FVM.FormateurViewModel.CodeFormateur);
                f.Formateur      = formateur;
                f.Date           = FVM.Date;
                f.Description    = FVM.Description;
                f.Duree          = FVM.Duree;
                f.Prix           = FVM.Prix;
                f.TypeFormation  = FVM.TypeFormation;
                f.NomFormation   = FVM.NomFormation;
                f.NbParticipants = FVM.NbParticipants;

                FS.Add(f);
                FS.Commit();
                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        private void br_enregistrer_Click(object sender, EventArgs e)
        {
            Formateur Stagiaire  = (Formateur)this.Entity;
            bool      validation = true;

            // Création d'un stagiaire en cas d'un nouvelle enregistrement
            if (Stagiaire == null)
            {
                Stagiaire = new Formateur();
            }

            // etat Civil
            Stagiaire.Nom           = nomTextBox.Text;
            Stagiaire.Prenom        = prenomTextBox.Text;
            Stagiaire.Cin           = cinTextBox.Text;
            Stagiaire.Sexe          = radioButtonHomme.Checked;
            Stagiaire.DateNaissance = dateNaissanceDateTimePicker.Value;



            //Coordonnées
            Stagiaire.Telephone = telephoneTextBox.Text;
            Stagiaire.Adress    = adressTextBox.Text;
            Stagiaire.Email     = emailTextBox.Text;

            //Affectation


            if (Combo_Filiere.SelectedItem != null)
            {
                Stagiaire.Filiere = (Filiere)Combo_Filiere.SelectedItem;
            }

            //Identification
            Stagiaire.Login    = txt_login.Text;
            Stagiaire.Password = txt_password.Text;
            if (txt_password.Text != txt_password2.Text)
            {
                validation = false;
            }

            // Lancement de l'événement Clic si la validation est correct
            if (validation)
            {
                if (new FormateursService().Save(Stagiaire) > 0)
                {
                    MessageBox.Show("Le Stagiaire :" + Stagiaire.ToString() + " a été bien enregistrer");
                }
                else
                {
                    MessageBox.Show("Le Stagiaire :" + Stagiaire.ToString() + " n'est pas enregistrer car il n'y a pas des modifications");
                }
                onEnregistrerClick(this, e);
            }
            else
            {
                MessageBox.Show("Le mote de passe n'est pas correct");
            }
        }
Example #8
0
 public Formation(int id, Formateur formateur, Module module, Groupe groupe, AnneeFormation anneformation)
 {
     this.id            = id;
     this.formateur     = formateur;
     this.module        = module;
     this.groupe        = groupe;
     this.anneformation = anneformation;
 }
        private async void SendEmailMessage()
        {
            Formateur formateur = DataContext as Formateur;

            var emailMessage = new Windows.ApplicationModel.Email.EmailMessage();

            emailMessage.To.Add(new Windows.ApplicationModel.Email.EmailRecipient(formateur.Courriel));

            await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage);
        }
Example #10
0
        public IHttpActionResult GetFormateur(int id)
        {
            Formateur formateur = _db.Formateurs.Include(f => f.Civilite).FirstOrDefault(f => f.FormateurID == id);

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

            return(Ok(formateur));
        }
Example #11
0
        public IHttpActionResult PostFormateur(Formateur formateur)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _db.Formateurs.Add(formateur);
            _db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = formateur.FormateurID }, formateur));
        }
Example #12
0
        public IHttpActionResult DeleteFormateur(int id)
        {
            Formateur formateur = _db.Formateurs.Find(id);

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

            _db.Formateurs.Remove(formateur);
            _db.SaveChanges();

            return(Ok(formateur));
        }
Example #13
0
        public async Task <IActionResult> DeleteFormateur([FromBody] Formateur item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _formationService.DeleteFormateurAsync(item.Id);

            if (result)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound());
            }
        }
Example #14
0
        public async Task <IActionResult> SaveFormateur([FromBody] Formateur item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (item.Id == Guid.Empty)
            {
                item.Id = Guid.NewGuid();
            }
            var result = await _formationService.SaveFormateurAsync(item);

            if (result != null)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound());
            }
        }
 private void ShowFormateur(Formateur formateur)
 {
     this.Frame.Navigate(typeof(FormateurDetailsView), formateur);
 }
Example #16
0
        public static Formateur CreerFormateur(String nom, String prenom, String mail, String telephone, List <Matiere> lstMatieres)
        {
            Formateur formateur;

            if (nom == null || nom == "")
            {
                throw new FormationDAOException("Le nom du formateur n'est pas renseigné.");
            }

            if (prenom == null || prenom == "")
            {
                throw new FormationDAOException("Le prénom du formateur n'est pas renseignée.");
            }

            if (mail == null || mail == "")
            {
                throw new FormationDAOException("Le mail du formateur n'est pas renseignée.");
            }

            if (telephone == null || telephone == "")
            {
                throw new FormationDAOException("Le numéro de téléphone du formateur n'est pas renseignée.");
            }

            if (lstMatieres.Count < 1)
            {
                throw new FormationDAOException("Le formateur doit avoir au moins une matière.");
            }


            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "INSERT INTO Formateur (Nom, Prenom, mail, Telephone) output INSERTED.Id VALUES (@Nom, @Prenom, @mail, @Telephone);";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = Outils.ConnexionBase.GetInstance().Conn;

            SqlParameter paramNom = new SqlParameter("Nom", SqlDbType.VarChar);

            paramNom.Value = nom;
            cmd.Parameters.Add(paramNom);

            SqlParameter paramPrenom = new SqlParameter("Prenom", SqlDbType.VarChar);

            paramPrenom.Value = prenom;
            cmd.Parameters.Add(paramPrenom);

            SqlParameter paramMail = new SqlParameter("Mail", SqlDbType.VarChar);

            paramMail.Value = mail;
            cmd.Parameters.Add(paramMail);

            SqlParameter paramTel = new SqlParameter("Telephone", SqlDbType.VarChar);

            paramTel.Value = telephone;
            cmd.Parameters.Add(paramTel);

            int idFormateur = (int)cmd.ExecuteScalar();

            formateur = new Formateur(idFormateur, nom, prenom, mail, telephone, lstMatieres);

            cmd = new SqlCommand();

            cmd.CommandText = "INSERT INTO Formateur_matiere (Formateur_id, Matiere_id) VALUES ";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = Outils.ConnexionBase.GetInstance().Conn;

            int i = 0;

            foreach (Matiere mat in formateur.ListMatiere)
            {
                String formateurIdParamName = "@Formateur_id" + i;
                String MatiereIdParamName   = "@Matiere_id" + i;

                cmd.CommandText += "(" + formateurIdParamName + ", " + MatiereIdParamName + "),";

                SqlParameter paramFormateurId = new SqlParameter(formateurIdParamName, SqlDbType.Int);
                paramFormateurId.Value = formateur.Id;
                cmd.Parameters.Add(paramFormateurId);

                SqlParameter paramMatiereId = new SqlParameter(MatiereIdParamName, SqlDbType.Int);
                paramMatiereId.Value = mat.Id;
                cmd.Parameters.Add(paramMatiereId);
                i++;
            }
            cmd.CommandText  = cmd.CommandText.Remove(cmd.CommandText.Length - 1);
            cmd.CommandText += ";";
            //throw new FormationDAOException(cmd.CommandText);

            cmd.ExecuteReader();

            return(formateur);
        }
 private void FormateursDetails(Formateur aFormateur)
 {
     this.Frame.Navigate(typeof(FormateurDetailsView), aFormateur);
 }
Example #18
0
        static void Main(string[] args)
        {
            Cursus c = new Cursus();

            using (BDDContext context = new BDDContext())
            {
                c = new Cursus
                {
                    titre = "Concepteur Developpeur "
                };
                context.Cursuss.Add(c);
                context.SaveChanges();
            }

            Formation form = new Formation();

            using (BDDContext context = new BDDContext())
            {
                form = new Formation
                {
                    titre = "java "
                };
                context.Formations.Add(form);
                context.SaveChanges();
            }

            Stagiaire st = new Stagiaire();

            using (BDDContext context = new BDDContext())
            {
                st = new Stagiaire
                {
                    Nom = "Premier stagiaire"
                };
                context.Stagiaires.Add(st);
                context.SaveChanges();
            }

            Formateur f = new Formateur();

            using (BDDContext context = new BDDContext())
            {
                f = new Formateur
                {
                    Nom = "Christopher"
                };
                context.Formateurs.Add(f);
                context.SaveChanges();
            }

            Session_De_Cursus Sc = new Session_De_Cursus();

            using (BDDContext context = new BDDContext())
            {
                Sc = new Session_De_Cursus
                {
                    Description = "Ce cursus  consiste à travailler sur le profil de développeurs web  "
                };
                context.SessionCursus.Add(Sc);
                context.SaveChanges();
            }

            Session_De_Formation Sf = new Session_De_Formation();

            using (BDDContext context = new BDDContext())
            {
                Sf = new Session_De_Formation
                {
                    Description = "Cette formation consiste à former  "
                };
                context.SessionFormations.Add(Sf);
                context.SaveChanges();
            }
        }
Example #19
0
        public Session creeerSession(Promotion promotion, Formateur formateur, Matiere matiere, Salle salle, DateTime dateDebut, DateTime dateFin)
        {
            if (promotion == null)
            {
                throw new SessionDAOException("La promotion n'est pas renseignée.");
            }

            if (matiere == null)
            {
                throw new SessionDAOException("La matière n'est pas renseignée.");
            }

            if (salle == null)
            {
                throw new SessionDAOException("La salle n'est pas renseignée.");
            }

            if (dateDebut == null)
            {
                throw new SessionDAOException("La date du début de la session n'est pas renseignée.");
            }

            if (dateFin == null)
            {
                throw new SessionDAOException("La date du fin de la session n'est pas renseignée.");
            }

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "Session_edt (Promotion_id,";
            if (formateur != null)
            {
                cmd.CommandText += " Formateur_id,";
            }
            cmd.CommandText += " Matiere_id, Salle_id, DateDebut, DateFin) output INSERTED.Id VALUES (@Promotion_id,";
            if (formateur != null)
            {
                cmd.CommandText += " @Formateur_id,";
            }
            cmd.CommandText += " @Matiere_id, @Salle_id, @DateDebut, @DateFin);";
            cmd.CommandType  = CommandType.Text;
            cmd.Connection   = Outils.ConnexionBase.GetInstance().Conn;

            SqlParameter paramPromotionId = new SqlParameter("Promotion_id", SqlDbType.VarChar);

            paramPromotionId.Value = promotion.Id;
            cmd.Parameters.Add(paramPromotionId);

            SqlParameter paramMatiereId = new SqlParameter("Matiere_id", SqlDbType.VarChar);

            paramMatiereId.Value = matiere.Id;
            cmd.Parameters.Add(paramMatiereId);

            SqlParameter paramSalleId = new SqlParameter("Salle_id", SqlDbType.VarChar);

            paramSalleId.Value = salle.Id;
            cmd.Parameters.Add(paramSalleId);

            SqlParameter paramDateDebut = new SqlParameter("DateDebut", SqlDbType.Int);

            paramDateDebut.Value = dateDebut;
            cmd.Parameters.Add(paramDateDebut);

            SqlParameter paramDateFin = new SqlParameter("DateFin", SqlDbType.Int);

            paramDateFin.Value = dateFin;
            cmd.Parameters.Add(paramDateFin);

            if (formateur != null)
            {
                SqlParameter paramFormateurId = new SqlParameter("Formateur_id", SqlDbType.Int);
                paramFormateurId.Value = formateur.Id;
                cmd.Parameters.Add(paramFormateurId);
            }

            int idEleve = (int)cmd.ExecuteScalar();

            return(new Session(dateDebut, dateFin, promotion, matiere, salle, formateur));
        }