Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Specialite specialite = db.Specialites.Find(id);

            db.Specialites.Remove(specialite);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public Ingenieur(int id, string nom, string prenom, string email, Specialite specialite, List <Affectation> affectations)
 {
     Id           = id;
     Nom          = nom;
     Prenom       = prenom;
     Email        = email;
     Specialite   = specialite;
     Affectations = affectations;
 }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "id,nom")] Specialite specialite)
 {
     if (ModelState.IsValid)
     {
         db.Entry(specialite).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(specialite));
 }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "id,nom")] Specialite specialite)
        {
            if (ModelState.IsValid)
            {
                db.Specialites.Add(specialite);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(specialite));
        }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("Specialite_id,Specialite_designation")] Specialite specialite)
        {
            if (ModelState.IsValid)
            {
                _context.Add(specialite);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(specialite));
        }
Beispiel #6
0
        public void DialogCreateSPE()
        {
            View        view        = LayoutInflater.Inflate(Resource.Layout.newSpecialiteDialogLayout, null);
            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetView(view);
            alertDialog.SetCanceledOnTouchOutside(false);

            Button   btnInsertSPE = view.FindViewById <Button>(Resource.Id.btnInsertSPE);
            Button   btnExit      = view.FindViewById <Button>(Resource.Id.btnExit);
            EditText txtCode      = view.FindViewById <EditText>(Resource.Id.txtCodeDialogINS);
            EditText txtLibelle   = view.FindViewById <EditText>(Resource.Id.txtLibelleDialogINS);

            txtCode.Hint = "Saisissez trois letres";

            btnExit.Click += delegate
            {
                alertDialog.Dismiss();
            };

            btnInsertSPE.Click += delegate
            {
                var codeSPE    = txtCode.Text;
                var libelleSPE = txtLibelle.Text;
                var checkCode  = lesSpecialites.Find(x => x.codeSPE == codeSPE);
                if (codeSPE != "" && libelleSPE != "")
                {
                    if (checkCode == null)
                    {
                        Uri url = new Uri("http://" + GetString(Resource.String.ip) + "insertSpecialite.php?codeSPE=" + codeSPE + "&libelleSPE=" + libelleSPE);
                        ws.DownloadDataAsync(url);
                        Specialite spe = new Specialite()
                        {
                            codeSPE = codeSPE, libelleSPE = libelleSPE
                        };
                        lesSpecialites.Add(spe);
                        alertDialog.Dismiss();
                        this.ListSpecialites();
                        Toast.MakeText(this, "La spécialité a été créée", ToastLength.Long).Show();
                    }
                    else
                    {
                        Toast.MakeText(this, "La spécialité avec le code \"" + codeSPE + "\" existe dèja!", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Veuillez saisir le code ou le nom !", ToastLength.Short).Show();
                }
            };

            alertDialog.Show();
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("Titre,Description,Id")] Specialite specialite)
        {
            if (ModelState.IsValid)
            {
                CliniqueDbContext context = _contextFactory.CreateDbContext();
                context.Add(specialite);
                await context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(specialite));
        }
        private void SelectMedecin(object sender, SelectionChangedEventArgs e)
        {
            Medecin    m = Manager.GetMedecin(listeMedecin.SelectedIndex);
            Specialite s = Manager.GetSpecialiteDuMedecin(m);

            AfficherId.Text          = m.Id.ToString();
            AfficherSpe.Text         = s.Spe.ToString();
            AfficherNom.Text         = m.Nom;
            AfficherPrenom.Text      = m.Prenom;
            AfficherAdresse.Text     = m.Adresse;
            AfficherDepartement.Text = m.Departement.ToString();
            AfficherTel.Text         = m.Tel;
        }
Beispiel #9
0
        // GET: Specialites/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Specialite specialite = db.Specialites.Find(id);

            if (specialite == null)
            {
                return(HttpNotFound());
            }
            return(View(specialite));
        }
        public ActionResult Create([Bind(Include = "Id,Libelle")] Specialite specialite, int Service)
        {
            if (ModelState.IsValid)
            {
                Service service = db.Services.Find(Service);
                specialite.Service = service;
                Specialite spExist = db.Specialites.SingleOrDefault(sp => sp.Libelle == (specialite.Libelle));
                if (spExist != null)
                {
                    return(RedirectToAction("Create"));
                }
                db.Specialites.Add(specialite);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(specialite));
        }
Beispiel #11
0
        public void DialogModifierSPE(Specialite spaIntent)
        {
            View        view        = LayoutInflater.Inflate(Resource.Layout.newSpecialiteDialogLayout, null);
            AlertDialog alertDialog = new AlertDialog.Builder(this).Create();

            alertDialog.SetView(view);
            alertDialog.SetCanceledOnTouchOutside(false);

            Button   btnInsertSPE = view.FindViewById <Button>(Resource.Id.btnInsertSPE);
            Button   btnExit      = view.FindViewById <Button>(Resource.Id.btnExit);
            EditText txtCode      = view.FindViewById <EditText>(Resource.Id.txtCodeDialogINS);
            EditText txtLibelle   = view.FindViewById <EditText>(Resource.Id.txtLibelleDialogINS);

            txtCode.Text    = spaIntent.codeSPE;
            txtLibelle.Text = spaIntent.libelleSPE;

            btnExit.Click += delegate
            {
                alertDialog.Dismiss();
            };

            btnInsertSPE.Click += delegate
            {
                var codeSPE    = txtCode.Text;
                var libelleSPE = txtLibelle.Text;
                if (codeSPE != "" && libelleSPE != "")
                {
                    Uri url = new Uri("http://" + GetString(Resource.String.ip) + "modifierSpecialite.php?codeSPE=" + codeSPE + "&libelleSPE=" + libelleSPE);
                    ws.DownloadDataAsync(url);
                    lesSpecialites.Where(s => s.codeSPE == codeSPE).First().libelleSPE = libelleSPE;
                    alertDialog.Dismiss();
                    this.ListSpecialites();
                    Toast.MakeText(this, "La spécialité a été modifée", ToastLength.Long).Show();
                }
                else
                {
                    Toast.MakeText(this, "Veuillez saisir le code ou le nom !", ToastLength.Short).Show();
                }
            };

            alertDialog.Show();
        }
        public ActionResult Ajouter(Specialite specialite)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0)
                {
                    var file = Request.Files[0];
                    if (file != null && file.ContentLength > 0)                                  //Vérifie que le fichier existe
                    {
                        var fileName = Path.GetFileName(file.FileName);                          //Récupération du nom du fichier
                        specialite.Url_Image = "/Fichier";
                        var path = Path.Combine(Server.MapPath(specialite.Url_Image), fileName); //Enregistrement du fichier dans le dossier Fichier
                        file.SaveAs(path);

                        specialite.ImageSpecialité = fileName;
                    }
                }
                db.Specialites.Add(specialite);
                db.SaveChanges();
            }
            return(RedirectToAction("Departement"));
        }
        private void ajout()
        {
            // ajout dans la base de données
            if (tbxNom.Text == "" || tbxPrenom.Text == "" || tbxEmail.Text == "" || tbxRue.Text == "" || tbxTel.Text == "" || tbxVille.Text == "")
            {
                MessageBox.Show("Vous devez renseigner les champs Nom, Prenom, Rue, Ville, Telephone et Email !");
            }
            else
            {
                // récupération de la spécialité
                Specialite uneSpecialite = (Specialite)cbxSpe.SelectedItem;

                // récupération du type
                TypePraticien unType = (TypePraticien)cbxType.SelectedItem;

                // récupération de la ville (pour le code postal)
                Ville uneVille = Globale.LesVilles.Find(x => x.Nom == tbxVille.Text);

                Passerelle.ajouterPraticien(tbxNom.Text, tbxPrenom.Text, tbxRue.Text, uneVille.Code, tbxVille.Text, tbxTel.Text, tbxEmail.Text, unType.Id, uneSpecialite.Id, out string message);
                MessageBox.Show("Praticien ajouté");
            }
        }
Beispiel #14
0
 internal Recruteur(string name, Specialite specialite, TimeSpan jourDexperience)
 {
     this.nom        = name;
     this.specialite = specialite;
     this.experience = jourDexperience;
 }
        public ActionResult Ajouter(Specialite specialite)
        {
            if (ModelState.IsValid)
            {
                if (Request.Files.Count > 0)
                {
                    var file = Request.Files[0];
                    if (file != null && file.ContentLength > 0)         //Vérifie que le fichier existe
                    {
                        var fileName = Path.GetFileName(file.FileName); //Récupération du nom du fichier
                        var ext      = Path.GetExtension(fileName).ToLower();
                        if (ext == ".jpg" || ext == ".png" || ext == ".jpeg" || ext == ".gif")
                        {
                            specialite.Url_Image = "/Fichier";
                            var path = Path.Combine(Server.MapPath(specialite.Url_Image), fileName);//Enregistrement du fichier dans le dossier Fichier
                            file.SaveAs(path);
                            specialite.ImageSpecialite = fileName;
                        }
                        else
                        {
                            ViewData["SetError"] = "Le fichier selectionné doit etre une image*";
                            return(View());
                        }
                    }
                }
                // Verification des champs du formulaire
                #region Verification des champs du formulaire
                if (specialite.SpecialiteName != null)
                {
                    db.Specialites.Add(specialite);
                }
                else
                {
                    ViewData["NameError"] = "Le nom de la Spécialité est requis*";
                    return(View());
                }
                if (specialite.SpecialiteInfo != null)
                {
                    db.Specialites.Add(specialite);
                }
                else
                {
                    ViewData["InfoError"] = "La description de la Spécialité est requise";
                    return(View());
                }
                if (specialite.ImageSpecialite != null)
                {
                    db.Specialites.Add(specialite);
                }
                else
                {
                    ViewData["ImageError"] = "L'image de la Spécialité est requise";
                    return(View());
                }
                if (specialite.SpecialiteColor != null)
                {
                    db.Specialites.Add(specialite);
                }
                else
                {
                    ViewData["ColorError"] = "La couleur de la Spécialité est requise";
                    return(View());
                }
                #endregion
                db.SaveChanges();
                ModelState.Clear();

                ViewBag.Message = "Succès";
            }
            return(View());
        }
Beispiel #16
0
        static public bool modifierPraticien(int id, string nom, string prenom, string rue, string codePostal, string ville, string telephone, string email, string unType, Specialite uneSpecialite, out string message)
        {
            message = string.Empty;

            // Ouverture de la connection a la base
            cnx.Open();


            MySqlCommand cmd = new MySqlCommand()
            {
                Connection  = cnx,
                CommandText = "modifierPraticien",
                CommandType = CommandType.StoredProcedure
            };

            // Définition des parametres à transmettre
            cmd.Parameters.AddWithValue("id", id);
            cmd.Parameters.AddWithValue("nom", nom);
            cmd.Parameters.AddWithValue("prenom", prenom);
            cmd.Parameters.AddWithValue("rue", rue);
            cmd.Parameters.AddWithValue("codePostal", codePostal);
            cmd.Parameters.AddWithValue("ville", ville);
            cmd.Parameters.AddWithValue("telephone", telephone);
            cmd.Parameters.AddWithValue("email", email);
            cmd.Parameters.AddWithValue("idType", unType);

            if (uneSpecialite == null)
            {
                cmd.Parameters.AddWithValue("idSpecialite", null);
            }
            else
            {
                cmd.Parameters.AddWithValue("idSpecialite", uneSpecialite.Id);
            }


            try
            {
                cmd.ExecuteNonQuery();
                cnx.Close();
                return(true);
            }
            catch (MySqlException e)
            {
                message = e.Message;
                //message += e.ToString().Split('\n')[0];
                cnx.Close();
                return(false);
            }
        }
        public static void Initialize(MyCompanyContext context, UserManager <User> userManager, RoleManager <IdentityRole> roleManager)
        {
            if (context.Members.Any())
            {
                return;
            }

            CreateRoles(roleManager);
            context.SaveChanges();

            var equipes = new Equipe[]
            {
                new Equipe {
                    Label = "Infrastructure"
                },
                new Equipe {
                    Label = "Developpement"
                }
            };

            for (int i = 0; i < equipes.Length; i++)
            {
                context.Equipes.Add(equipes[i]);
            }
            context.SaveChanges();

            var specialites = new Specialite[]
            {
                new Specialite {
                    Label = "OS", EquipeID = equipes.Single(e => e.Label == "Infrastructure").EquipeID
                },
                new Specialite {
                    Label = "Reseau", EquipeID = equipes.Single(e => e.Label == "Infrastructure").EquipeID
                },
                new Specialite {
                    Label = "Securite", EquipeID = equipes.Single(e => e.Label == "Infrastructure").EquipeID
                },
                new Specialite {
                    Label = "Web", EquipeID = equipes.Single(e => e.Label == "Developpement").EquipeID
                },
                new Specialite {
                    Label = "Mainframe", EquipeID = equipes.Single(e => e.Label == "Developpement").EquipeID
                },
                new Specialite {
                    Label = "Client lourd", EquipeID = equipes.Single(e => e.Label == "Developpement").EquipeID
                }
            };

            foreach (Specialite s in specialites)
            {
                context.Specialites.Add(s);
            }
            context.SaveChanges();

            CreateDirecteur(userManager);
            context.SaveChanges();

            CreateResponsables(userManager, equipes);
            context.SaveChanges();

            CreateCollaborateur(userManager, equipes, specialites);
            context.SaveChanges();

            var congesTypes = new CongeType[]
            {
                new CongeType {
                    Label = Types.Absence
                },
                new CongeType {
                    Label = Types.Conge
                },
                new CongeType {
                    Label = Types.Maladie
                }
            };

            foreach (CongeType t in congesTypes)
            {
                context.CongeTypes.Add(t);
            }
            context.SaveChanges();

            var statuts = new Statut[]
            {
                new Statut {
                    Label = Statuts.Accepte
                },
                new Statut {
                    Label = Statuts.Attente
                },
                new Statut {
                    Label = Statuts.Refuse
                },
                new Statut {
                    Label = Statuts.Suppression
                }
            };

            foreach (Statut s in statuts)
            {
                context.Statuts.Add(s);
            }
            context.SaveChanges();

            var colla1 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla2 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla3 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla4 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla5 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla6 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla7 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla8 = userManager.FindByNameAsync("*****@*****.**").Result;
            var colla9 = userManager.FindByNameAsync("*****@*****.**").Result;

            var conges = new Conge[]
            {
                // CONGES PORTANT SUR UN JOUR
                new Conge {
                    EnvoiDate = DateTime.Parse("15/05/2019"), DateDebut = DateTime.Parse("26/07/2019"), DateFin = DateTime.Parse("26/07/2019"), CollaborateurID = colla1.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("20/04/2019"), DateDebut = DateTime.Parse("26/07/2019"), DateFin = DateTime.Parse("26/07/2019"), CollaborateurID = colla2.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("03/05/2019"), DateDebut = DateTime.Parse("26/07/2019"), DateFin = DateTime.Parse("26/07/2019"), CollaborateurID = colla3.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                // DEMANDES DE CONGES REFUSEES
                new Conge {
                    EnvoiDate = DateTime.Parse("17/05/2019"), DateDebut = DateTime.Parse("15/07/2019"), DateFin = DateTime.Parse("20/07/2019"), CollaborateurID = colla4.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Refuse).StatutID, Commentaire = "Wow, tu prends un peu trop de congé à mon gout, tu vas te calmer tout de suite mon p'tit gars !"
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("12/05/2019"), DateDebut = DateTime.Parse("21/11/2019"), DateFin = DateTime.Parse("02/12/2019"), CollaborateurID = colla2.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Refuse).StatutID, Commentaire = "Trop d'absences pendant cette période."
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("10/05/2019"), DateDebut = DateTime.Parse("04/10/2019"), DateFin = DateTime.Parse("14/10/2019"), CollaborateurID = colla5.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Refuse).StatutID, Commentaire = "Pas d'inspiration, ton congé est refusé !"
                },
                // DEMANDES DE CONGES EN ATTENTE
                new Conge {
                    EnvoiDate = DateTime.Parse("20/05/2019"), DateDebut = DateTime.Parse("12/09/2019"), DateFin = DateTime.Parse("16/09/2019"), CollaborateurID = colla4.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("18/05/2019"), DateDebut = DateTime.Parse("15/09/2019"), DateFin = DateTime.Parse("20/09/2019"), CollaborateurID = colla6.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("26/04/2019"), DateDebut = DateTime.Parse("03/08/2019"), DateFin = DateTime.Parse("13/08/2019"), CollaborateurID = colla7.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                // DEMANDES DE CONGES PORTANT SUR 15 JOURS
                new Conge {
                    EnvoiDate = DateTime.Parse("11/05/2019"), DateDebut = DateTime.Parse("15/10/2019"), DateFin = DateTime.Parse("29/10/2019"), CollaborateurID = colla5.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("09/05/2019"), DateDebut = DateTime.Parse("01/09/2019"), DateFin = DateTime.Parse("15/09/2019"), CollaborateurID = colla1.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                // ABSENCES MALADIE
                new Conge {
                    EnvoiDate = DateTime.Parse("20/05/2019"), DateDebut = DateTime.Parse("27/06/2019"), DateFin = DateTime.Parse("28/06/2019"), CollaborateurID = colla7.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Maladie).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("21/05/2019"), DateDebut = DateTime.Parse("01/07/2019"), DateFin = DateTime.Parse("01/07/2019"), CollaborateurID = colla1.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Maladie).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("22/05/2019"), DateDebut = DateTime.Parse("01/07/2019"), DateFin = DateTime.Parse("05/07/2019"), CollaborateurID = colla3.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Maladie).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("23/05/2019"), DateDebut = DateTime.Parse("02/07/2019"), DateFin = DateTime.Parse("03/07/2019"), CollaborateurID = colla6.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Maladie).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                // CONGES ACCEPTES ET PASSES
                new Conge {
                    EnvoiDate = DateTime.Parse("20/03/2019"), DateDebut = DateTime.Parse("02/04/2019"), DateFin = DateTime.Parse("10/04/2019"), CollaborateurID = colla1.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("14/02/2019"), DateDebut = DateTime.Parse("20/03/2019"), DateFin = DateTime.Parse("25/03/2019"), CollaborateurID = colla7.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Maladie).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                // CREATION D'UN CONFLIT
                new Conge {
                    EnvoiDate = DateTime.Parse("20/05/2019"), DateDebut = DateTime.Parse("02/01/2020"), DateFin = DateTime.Parse("20/01/2020"), CollaborateurID = colla2.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Attente).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("20/05/2019"), DateDebut = DateTime.Parse("15/01/2020"), DateFin = DateTime.Parse("20/01/2020"), CollaborateurID = colla8.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Conge).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                },
                new Conge {
                    EnvoiDate = DateTime.Parse("20/05/2019"), DateDebut = DateTime.Parse("25/12/2019"), DateFin = DateTime.Parse("15/01/2020"), CollaborateurID = colla9.Id, CongeTypeID = congesTypes.Single(t => t.Label == Types.Maladie).CongeTypeID, StatutID = statuts.Single(s => s.Label == Statuts.Accepte).StatutID
                }
            };

            foreach (Conge c in conges)
            {
                context.Conges.Add(c);
            }
            context.SaveChanges();
        }
Beispiel #18
0
 internal Candidat(string nom, Specialite specialite, TimeSpan jourDexperience)
 {
     this.nom        = nom;
     this.specialite = specialite;
     this.experience = jourDexperience;
 }
Beispiel #19
0
 public Ingenieur(Specialite specialite)
 {
     Affectations = new List <Affectation>();
     Specialite   = specialite;
 }
 private void LvSPE_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
 {
     speSelectione = allSpecialites.ElementAt(e.Position);
     // lvSPE.GetChildAt(e.Position).SetBackgroundColor(Android.Graphics.Color.ParseColor("#e8de2e"));
 }
Beispiel #21
0
        // chargement des données de la base dans les différentes collections statique de la classe Globale
        // dans cette méthode pas de bloc try catch car aucune erreur imprévisible en production ne doit se produire
        // en cas d'erreur en développement il faut laisser faire le debogueur de VS qui va signaler la ligne en erreur
        static public void chargerDonnees()
        {
            cnx.Open();

            // Chargement des objets Motifs
            MySqlCommand cmd = new MySqlCommand()
            {
                Connection  = cnx,
                CommandText = "getLesMotifs",
                CommandType = CommandType.StoredProcedure
            };
            var curseur = cmd.ExecuteReader();

            while (curseur.Read())
            {
                int    id        = (Int32)curseur["id"];
                string unLibelle = (string)curseur["libelle"];
                // création de l'objet et ajout dans donnees
                Motif unMotif = new Motif(id, unLibelle);
                Globale.LesMotifs.Add(unMotif);
            }
            curseur.Close();

            // Chargement des objets TypePraticien : on utilise le même objet Command on change juste le nom de la procédure stockée à exécuter

            cmd.CommandText = "getLesTypes";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id        = curseur["id"].ToString();
                string unLibelle = curseur["libelle"].ToString();
                // création de l'objet et ajout dans donnees
                TypePraticien unType = new TypePraticien(id, unLibelle);
                Globale.LesTypes.Add(unType);
            }
            curseur.Close();


            // Chargement des objets Specialite
            cmd.CommandText = "getLesSpecialites";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id        = curseur["id"].ToString();
                string unLibelle = curseur["libelle"].ToString();
                // création de l'objet et ajout dans donnees
                Specialite uneSpecialite = new Specialite(id, unLibelle);
                Globale.LesSpecialites.Add(uneSpecialite);
            }
            curseur.Close();

            // Chargement des objets Famille
            cmd.CommandText = "getLesFamilles";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id        = (string)curseur["id"];
                string unLibelle = (string)curseur["libelle"];
                // création de l'objet et ajout dans donnees
                Famille uneFamille = new Famille(id, unLibelle);
                Globale.LesFamilles.Add(id, uneFamille);
            }
            curseur.Close();

            // chargement des objets médicaments
            cmd.CommandText = "getLesMedicaments";
            curseur         = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string id               = (string)curseur["id"];
                string nom              = (string)curseur["nom"];
                string composition      = (string)curseur["composition"];
                string effet            = (string)curseur["effets"];
                string contreIndication = (string)curseur["contreIndication"];
                string idFamille        = (string)curseur["idFamille"];
                // récupération de l'objet Famille
                Famille uneFamille = Globale.LesFamilles[idFamille];
                // création de l'objet et ajout dans donnees
                Medicament unMedicament = new Medicament(id, nom, composition, effet, contreIndication, uneFamille);
                Globale.LesMedicaments.Add(unMedicament);
            }
            curseur.Close();

            // chargement des praticiens
            cmd.CommandText = "getLesPraticiens";
            cmd.Parameters.AddWithValue("idVisiteur", Globale.LeVisiteur.Id);
            curseur = cmd.ExecuteReader();
            while (curseur.Read())
            {
                int    id           = (Int32)curseur["id"];
                string nom          = (string)curseur["nom"];
                string prenom       = (string)curseur["prenom"];
                string rue          = (string)curseur["rue"];
                string codePostal   = (string)curseur["codePostal"];
                string ville        = (string)curseur["ville"];
                string email        = (string)curseur["email"];
                string telephone    = (string)curseur["telephone"];
                string idType       = (string)curseur["idType"];
                string idSpecialite = curseur.IsDBNull(9) ? null : (string)curseur["idSpecialite"];
                // création de l'objet et ajout dans l'objet db.LeVisiteur
                TypePraticien unType        = Globale.LesTypes.Find(x => x.Id == idType);
                Specialite    uneSpecialite = null;
                if (idSpecialite != null)
                {
                    uneSpecialite = Globale.LesSpecialites.Find(x => x.Id == idSpecialite);
                }

                Praticien unPraticien = new Praticien(id, nom, prenom, rue, codePostal, ville, email, telephone, unType, uneSpecialite);
                Globale.LeVisiteur.ajouterPraticien(unPraticien);
            }
            curseur.Close();


            // chargement des visites du visiteur connecté
            cmd.CommandText = "getLesVisites";
            // pas de changement au niveau des paramètres à transmettre : on garde l'id du visiteur avec la même valeur
            curseur = cmd.ExecuteReader();
            while (curseur.Read())
            {
                int idVisite    = (Int32)curseur["id"];
                int idPraticien = (Int32)curseur["idPraticien"];
                int idMotif     = (Int32)curseur["idMotif"];

                DateTime dateEtHeure = curseur.GetDateTime(1);
                // récupération des objets liés
                Motif     unMotif     = Globale.LesMotifs.Find(x => x.Id == idMotif);
                Praticien unPraticien = Globale.LeVisiteur.getPraticien(idPraticien);
                // création de l'objet visite qui est automatiquement ajouté dans la collection des visites du visiteur
                Visite uneVisite = new Visite(idVisite, unPraticien, unMotif, dateEtHeure, Globale.LeVisiteur);
                // si le bilan est enregistré
                if (!curseur.IsDBNull(4))
                {
                    // initialisation du bilan et du premierMedicament
                    string     bilan        = curseur["bilan"].ToString();
                    string     idMedicament = curseur["premierMedicament"].ToString();
                    Medicament premier      = Globale.LesMedicaments.Find(x => x.Id == idMedicament);
                    Medicament second       = null;
                    // initialisation éventuelle du second médicament s'il est renseigné
                    if (!curseur.IsDBNull(6))
                    {
                        idMedicament = curseur["secondMedicament"].ToString();
                        second       = Globale.LesMedicaments.Find(x => x.Id == idMedicament);
                    }
                    uneVisite.enregistrerBilan(bilan, premier, second);
                    // le chargement des échantillons s'effetue globalement à la fin
                }
            }
            curseur.Close();

            // chargement de la synthèse des échantillons distribués par le visiteur
            cmd.CommandText = "getLesEchantillons";
            // pas de changement au niveau des paramètres à transmettre : on garde l'id du visiteur avec la même valeur
            curseur = cmd.ExecuteReader();
            while (curseur.Read())
            {
                string idMedicament = curseur["idMedicament"].ToString();
                int    quantite     = (Int32)curseur["quantite"];
                int    idVisite     = (Int32)curseur["idVisite"];
                //trouver la visite correspondante
                Medicament unMedicament = Globale.LesMedicaments.Find(x => x.Id == idMedicament);
                Visite     uneVisite    = Globale.LeVisiteur.getLaVisite(idVisite);
                uneVisite.ajouterEchantillon(unMedicament, quantite);
            }
            // chargement des villes du département du visiteur pour la mise en place de l'auto complétion sur l'ajout d'un praticien
            // [ à compléter]
            cnx.Close();
        }
Beispiel #22
0
        public ActionResult NewMember(Member member)
        {
            var _context    = new DbCaimanContext();
            var specialites = _context.Specialites.ToList();
            var Tra         = _context.Transports.ToList();
            var vM          = new SaveMemberViewModel
            {
                Specialites = specialites,
                Transports  = Tra
            };

            if (!ModelState.IsValid)
            {
                vM.Member = member;
                return(View(vM));
            }
            var tar = new Transport();

            if (member.SpecialiteId == 0)
            {
                ViewBag.PasSpe = "Veuillez d'abord cree une specialite !";
                vM.Member      = member;
                return(View(vM));
            }
            if (ModelState.IsValid)
            {
                var date = DateTime.Today.Year;
                if (member.MemberNaissance.Year >= date)
                {
                    ViewData["errordate"] = "L'année doit etre inférieure a l'année actuelle";
                    vM.Member             = member;
                    return(View(vM));
                }


                Specialite _Specialite = _context.Specialites.FirstOrDefault(Sp => Sp.SpecialiteId == member.SpecialiteId);
                _Specialite.Members = new List <Member>();
                var memberAdd = new Member();
                memberAdd = member;

                /*memberAdd.MemberCommune = member.MemberCommune;
                 * memberAdd.MemberName = member.MemberName;
                 * memberAdd.MemberPnom = member.MemberPnom;
                 * memberAdd.MemberDescription = member.MemberDescription;
                 * memberAdd.MemberLieuNaissance = member.MemberLieuNaissance;
                 * memberAdd.MemberNaissance = member.MemberNaissance;
                 * memberAdd.MemberPhone = member.MemberPhone;
                 * memberAdd.MemberQuartier = member.MemberQuartier;
                 * memberAdd.MemberMail = member.MemberMail;
                 * memberAdd.MemberTransport = member.MemberTransport;
                 * memberAdd.MemberSex = member.MemberSex;*/
                Transport _Transport = _context.Transports.FirstOrDefault(Tr => Tr.TransportId == member.TransportId);

                _Transport.Members = new List <Member>();


                if (_Specialite != null)
                {
                    _Specialite.Members.Add(memberAdd);
                    _context.Specialites.Update(_Specialite);
                }
                _Transport.Members.Add(memberAdd);

                _context.Transports.Add(_Transport);
                _context.SaveChanges();
                _context.Dispose();

                return(RedirectToAction("ProfilMember", "Departement", new { id = memberAdd.MemberId }));
            }
            return(View());
        }