public ActionResult ClientPartic([Bind(Include = "id_personne,civilite,prenom,nom,adresse,telephone,date_naissance,client,participant,email")] Personnes personnes)
        {
            if (ModelState.IsValid)
            {
                List <int> Participants = Session["listParticipant"] as List <int>;
                string     clientPart   = Request.Form["f_reponse"];
                if (Participants == null)
                {
                    Participants = new List <int>();
                    if (clientPart == "Oui")
                    {
                        personnes.id_personne = (Session["client"] as Personnes).id_personne;
                        Participants.Add(personnes.id_personne);
                        Session["listParticipant"] = Participants;
                        Session["nbParticipant"]   = Participants.Count;
                        return(RedirectToAction("CreerParticipant"));
                    }
                    if (clientPart == "Non")
                    {
                        return(RedirectToAction("CreerParticipant"));
                    }
                }

                return(RedirectToAction("Create"));
            }
            return(View(personnes));
        }
        // GET: Authentifications
        public ActionResult Index()
        {
            if (Session["client"] != null)
            {
                Personnes client             = Session["client"] as Personnes;
                List <Authentifications> moi = new List <Authentifications>();
                foreach (Authentifications a in db.Authentifications)
                {
                    if (a.email == client.email)
                    {
                        moi.Add(a);
                    }
                }
                return(View(moi));
            }
            else
            {
                if ((TempData["message"] as string) != "" && TempData["message"] != null)
                {
                    ViewBag.message = TempData["message"];
                }

                Authentifications auth = new Authentifications();
                return(RedirectToAction("../Authentifications/Connexion", auth));;
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nom,Prenom,Sexe,DateNaissance,TypePersonne")] Personnes personnes)
        {
            if (id != personnes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(personnes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonnesExists(personnes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(personnes));
        }
        public ActionResult Ajouter(Gaming.Personne personne)
        {
            if (ModelState.IsValid)
            {
                Personnes personnes = new Personnes(Session["DB_REPO"]);

                String sql = "SELECT * from Personnes where Prenom='" + personne.Prenom.ToString() + "'";
                personnes.QuerySQL(sql);
                // Le même prenom
                if(personnes.Next())
                {
                    //Le même nom
                    sql = "SELECT * from Personnes where Nom='" + personne.Nom.ToString() + "'";
                    personnes.QuerySQL(sql);
                    if (personnes.Next())
                    {
                        ViewBag.Erreur = "Un gamer possède déja ce nom et prénom";
                        return View(personne);
                    }
                }

                // Tout est valide
                personnes.personne = personne;
                personnes.personne.UpLoadImage(Request);
                personnes.Insert();
                return RedirectToAction("Lister", "Personnes");
            }
            return View(personne);
        }
 public ActionResult Editer(String Id)
 {
     Personnes personnes = new Personnes(Session["DB_REPO"]);
     if (personnes.SelectByID(Id))
         return View(personnes.personne);
     else
         return RedirectToAction("Lister", "Personnes");
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Personnes personnes = db.Personnes.Find(id);

            db.Personnes.Remove(personnes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        private void FamilyTreeButton_Click(object sender, EventArgs e)
        {
            int       rowIndex = dataGridView1.CurrentRow.Index;
            string    value    = dataGridView1.Rows[rowIndex].Cells[0].Value.ToString();
            Personnes per      = new Personnes(dal.GetOnePerson(value));
            string    s        = "";

            MessageBox.Show(DisplayFamilyTree(per, ref s));
        }
Example #8
0
 private void OnPersonneAjoutee(PersonneAjoutee obj)
 {
     Personnes.Add(new Personne
     {
         DateDeces      = null,
         Prenom         = obj.Prenom,
         InfosNaissance = new InfosNaissance(obj.LieuNaissance, obj.DateNaissance)
     });
 }
        public ActionResult CreerParticipant([Bind(Include = "id_personne,civilite,prenom,nom,adresse,telephone,date_naissance,client,participant,email")] Personnes personnes)
        {
            if (ModelState.IsValid)
            {
                List <int> Participants = Session["listParticipant"] as List <int>;

                if (Participants == null)
                {
                    Participants = new List <int>();
                }

                if (personnes.email != null && personnes.email != "")
                {
                    if (db.Personnes.Any(i => i.email == personnes.email))
                    {
                        ViewBag.message1    = " Erreur aucune ou plusieurs personnes avec cet e-mail dans la BDD###";
                        ViewBag.civilite    = new SelectList(db.Civilites, "id_civilite", "civilite", personnes.civilite);
                        ViewBag.client      = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.client);
                        ViewBag.participant = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.participant);
                        return(View(personnes));
                    }
                }

                personnes.client      = 1;
                personnes.participant = 2;
                db.Personnes.Add(personnes);
                db.SaveChanges();
                Participants.Add(personnes.id_personne);

                Session["listParticipant"] = Participants;
                Session["nbParticipant"]   = Participants.Count;

                if (Participants.Count < 9)
                {
                    if (Participants.Count < (int)Session["f_place"])
                    {
                    }
                    else
                    {
                        ViewBag.message = " Attention : Vous ne pouvez plus ajouter de participants. Le nombre de place disponible serait insuffisant";
                        return(View(personnes));
                    }
                }
                else
                {
                    ViewBag.message = " Attention : vous avez atteint le seuil maximal de 9 participants pour une réservation. Vous ne pouvez donc pas en ajouter plus. ";
                    return(View(personnes));
                }
                return(RedirectToAction("CreerParticipant"));
            }
            ViewBag.civilite    = new SelectList(db.Civilites, "id_civilite", "civilite", personnes.civilite);
            ViewBag.client      = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.client);
            ViewBag.participant = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.participant);
            return(View(personnes));
        }
        public async Task <IActionResult> Create([Bind("Id,Nom,Prenom,Sexe,DateNaissance,TypePersonne")] Personnes personnes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personnes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personnes));
        }
 public ActionResult Edit([Bind(Include = "id,Nom,Prénom,Admin,Qualité")] Personnes personnes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personnes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Qualité = new SelectList(db.Qualité, "id", "Qualité1", personnes.Qualité);
     return(View(personnes));
 }
 public void UpdatePersonne([FromBody] Personnes value)
 {
     try
     {
         db.Entry(value).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         WriteLogSystem(ex.ToString());
     }
 }
        public ActionResult Create([Bind(Include = "id,Nom,Prénom,Admin,Qualité")] Personnes personnes)
        {
            if (ModelState.IsValid)
            {
                db.Personnes.Add(personnes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Qualité = new SelectList(db.Qualité, "id", "Qualité1", personnes.Qualité);
            return(View(personnes));
        }
 public void AddPersonne([FromBody] Personnes value)
 {
     try
     {
         db.Personnes.Add(value);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         WriteLogSystem(ex.ToString());
     }
 }
        private static void Deserialiser()
        {
            IFormatter deserialiseur = null;

            if (File.Exists(FICHIER_XML))
            {
                FileStream flux = File.OpenRead(FICHIER_XML);
                deserialiseur = new SoapFormatter();
                ListePersonne = (Personnes)deserialiseur.Deserialize(flux);
                flux.Close();
            }
        }
        public ActionResult Create([Bind(Include = "id_personne,civilite,prenom,nom,adresse,telephone,date_naissance,client,participant")] Personnes personnes)
        {
            Authentifications auth = new Authentifications();

            personnes.email = (string)Session["login"];     /*emailclient;*/

            if (ModelState.IsValid)
            {
                personnes.client      = 1;
                personnes.participant = 1;
                db.Personnes.Add(personnes);
                db.SaveChanges();

                // on verifie que le client que l'on viens de creer existe dans la table "personnes"
                if (db.Personnes.Any(i => i.email == personnes.email))
                {
                    // on recupere l'objet personne qui correspond au client sous forme de liste
                    List <Personnes> clients = new List <Personnes>();
                    foreach (Personnes p in db.Personnes.Include(p => p.Civilites).Include(p => p.OuisNons).Include(p => p.OuisNons1))
                    {
                        if (p.email == personnes.email)
                        {
                            clients.Add(p);
                        }
                    }
                    // on verifie l'unicité de l'email dans la BDD
                    if (clients.Count == 1)
                    {
                        Personnes client = clients[0];
                        // on recupere toutes les infos dans la session

                        Session["client"] = client;

                        ViewBag.civilite    = new SelectList(db.Civilites, "id_civilite", "civilite", personnes.civilite);
                        ViewBag.client      = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.client);
                        ViewBag.participant = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.participant);

                        return(RedirectToAction("../Voyages/Index"));
                    }
                    else
                    {
                        ViewBag.message = " Erreur aucune ou plusieurs personnes avec cet e-mail dans la BDD###";
                        return(RedirectToAction("../Voyages/Index"));
                    }
                }
                else
                {
                    ViewBag.message = "### Erreur pas de Personne correspondante dans la BDD ###";
                    return(RedirectToAction("../Voyages/Index"));
                }
            }
            return(RedirectToAction("../Voyages/Index"));
        }
 public void DeletePersonne(int id)
 {
     try
     {
         Personnes u = db.Personnes.Find(id);
         db.Personnes.Remove(u);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         WriteLogSystem(ex.ToString());
     }
 }
Example #18
0
 public ActionResult Edit([Bind(Include = "id_personne,civilite,prenom,nom,adresse,telephone,date_naissance,client,participant,email")] Personnes personnes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personnes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.civilite    = new SelectList(db.Civilites, "id_civilite", "civilite", personnes.civilite);
     ViewBag.client      = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.client);
     ViewBag.participant = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.participant);
     return(View(personnes));
 }
Example #19
0
        public void TestDuréeTravailPersonne()
        {
            #region Initialisation ListeMétiers
            // Instantiation de la liste des métiers
            Métiers        ANA          = new Métiers("Analyste", "ANA", Activités.DBE | Activités.ARF | Activités.ANF);
            Métiers        CDP          = new Métiers("Chef de projet", "CDP", Activités.ARF | Activités.ANF | Activités.ART | Activités.TES | Activités.GDP);
            Métiers        DEV          = new Métiers("Développeur", "DEV", Activités.ANF | Activités.ART | Activités.ANT | Activités.DEV | Activités.TES);
            Métiers        DES          = new Métiers("Designer", "DES", Activités.ANF | Activités.DES | Activités.INF);
            Métiers        TES          = new Métiers("Testeur", "TES", Activités.RPT | Activités.TES);
            List <Métiers> listeMétiers = new List <Métiers> {
                ANA, CDP, DEV, DES, TES
            };
            #endregion

            #region Initialisation ListePersonnes
            // Instantiation de la liste des personnes
            Personnes GL = new Personnes("GL", "Genevieve", "LECLERCQ", ANA);
            Personnes AF = new Personnes("AF", "Angèle", "FERRAND", ANA);
            Personnes BN = new Personnes("BN", "Balthazar", "NORMAND", CDP);
            Personnes RF = new Personnes("RF", "Raymond", "FISHER", DEV);
            Personnes LB = new Personnes("LB", "Lucien", "BUTLER", DEV);
            Personnes RB = new Personnes("RB", "Roseline", "BEAUMONT", DEV);
            Personnes MW = new Personnes("MW", "Marguerite", "WEBER", DES);
            Personnes HK = new Personnes("HK", "Hilaire", "KLEIN", TES);
            Personnes NP = new Personnes("NP", "Nino", "PALMER", TES);

            // Création d'un Dictionnaire contenant la liste des personnes et dont la clé sont les initiales
            Dictionary <string, Personnes> listePersonnes = new Dictionary <string, Personnes> {
            };
            listePersonnes.Add(GL.Code, GL);
            listePersonnes.Add(AF.Code, AF);
            listePersonnes.Add(BN.Code, BN);
            listePersonnes.Add(RF.Code, RF);
            listePersonnes.Add(LB.Code, LB);
            listePersonnes.Add(RB.Code, RB);
            listePersonnes.Add(MW.Code, MW);
            listePersonnes.Add(HK.Code, HK);
            listePersonnes.Add(NP.Code, NP);
            #endregion

            #region Chargement des données dans un DAL
            // On charge la liste des personnes et des métiers dans un DAL
            DAL genomica = new DAL(listeMétiers, listePersonnes);
            genomica.ChargerFichier(@"..\..\Data.txt");
            List <TachesProduction> listeRésultat = new List <TachesProduction>();
            listeRésultat = genomica.ListeTaches.Select(t => t.Value).ToList();
            #endregion

            Results.DuréeTravailPersonne(listeRésultat, "pas une personne", "1.00");
        }
        // GET: Personnes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Personnes personnes = db.Personnes.Find(id);

            if (personnes == null)
            {
                return(HttpNotFound());
            }
            return(View(personnes));
        }
        // GET: Personnes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Personnes personnes = db.Personnes.Find(id);

            if (personnes == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Qualité = new SelectList(db.Qualité, "id", "Qualité1", personnes.Qualité);
            return(View(personnes));
        }
Example #22
0
        /// <summary>
        /// Retourne la personne d'un nom donné
        /// </summary>
        /// <param name="nom">Le nom de la personne recherchée</param>
        /// <returns>La personne recherchée</returns>
        public Personne recupereUnePersonne(string nom)
        {
            List <Personne> personnes = Personnes
                                        .Where(pers => pers.Nom.ToUpper()
                                               .Equals(nom.ToUpper()))
                                        .ToList();

            if (personnes.Count() == 0)
            {
                return(null);
            }
            else
            {
                return(personnes.First());
            }
        }
Example #23
0
        public Personnes GetOnePerson(string value)
        {
            SqlCommand cmd = new SqlCommand("SELECT TOP(1) * FROM Personnes WHERE CIN=@CIN", Connection);

            cmd.Parameters.AddWithValue("@CIN", value);
            if (Connection.State == System.Data.ConnectionState.Closed)
            {
                Connection.Open();
            }
            SqlDataReader data = cmd.ExecuteReader();

            if (data.Read())
            {
                Personnes per = new Personnes();
                per.ID        = data.GetInt32(0);
                per.CIN       = data.GetString(1);
                per.Name      = data.GetString(2);
                per.BirthDate = data.GetDateTime(3);
                per.Sexe      = data.GetString(4);
                //father insertion
                if (data.IsDBNull(5))
                {
                    per.IDFather = null;
                }
                else
                {
                    Personnes father = new Personnes();
                    father.ID    = data.GetInt32(5);
                    per.IDFather = father;
                }

                //mother insertion
                if (data.IsDBNull(6))
                {
                    per.IDMother = null;
                }
                else
                {
                    Personnes mother = new Personnes();
                    mother.ID    = data.GetInt32(6);
                    per.IDMother = mother;
                }
                return(per);
            }
            return(null);
        }
Example #24
0
        // GET: Personnes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Personnes personnes = db.Personnes.Find(id);

            if (personnes == null)
            {
                return(HttpNotFound());
            }
            ViewBag.civilite    = new SelectList(db.Civilites, "id_civilite", "civilite", personnes.civilite);
            ViewBag.client      = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.client);
            ViewBag.participant = new SelectList(db.OuisNons, "id_ouinon", "valeur", personnes.participant);
            return(View(personnes));
        }
Example #25
0
        public int AddPerson(Personnes pr)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("INSERT INTO Personnes(CIN,Nom,BirthDate,Sexe,IDFather,IDMother) VALUES(@CIN,@Name,@BirthDate,@Sexe,@IDFather,@IDMother)", Connection);
                // cmd.Parameters.AddWithValue("@ID", pr.ID);
                cmd.Parameters.AddWithValue("@CIN", pr.CIN);
                cmd.Parameters.AddWithValue("@Name", pr.Name);
                cmd.Parameters.AddWithValue("BirthDate", pr.BirthDate);
                cmd.Parameters.AddWithValue("Sexe", pr.Sexe);
                switch (pr.IDFather)
                {
                case null:
                    cmd.Parameters.AddWithValue("@IDFather", DBNull.Value);
                    break;

                default:
                    cmd.Parameters.AddWithValue("@IDFather", pr.IDFather.ID);
                    break;
                }

                switch (pr.IDMother)
                {
                case null:
                    cmd.Parameters.AddWithValue("@IDMother", DBNull.Value);
                    break;

                default:
                    cmd.Parameters.AddWithValue("@IDMother", pr.IDMother.ID);
                    break;
                }
                if (Connection.State == System.Data.ConnectionState.Closed)
                {
                    Connection.Open();
                }
                int Success = cmd.ExecuteNonQuery();
                Connection.Close();
                return(Success);
            }catch (Exception e)
            {
                MessageBox.Show(e.StackTrace);
                return(0);
            }
        }
 public void Order(string order)
 {
     if (order == "Prenom")
     {
         Personnes = Personnes.OrderBy(x => x.Prenom).ToList();
     }
     if (order == "Nom")
     {
         Personnes = Personnes.OrderBy(x => x.Nom).ToList();
     }
     if (order == "Civilité")
     {
         Personnes = Personnes.OrderBy(x => x.Civilite).ToList();
     }
     if (order == "Nationalité")
     {
         Personnes = Personnes.OrderBy(x => x.Nationalite).ToList();
     }
 }
        public ActionResult Editer(Gaming.Personne personne)
        {
            Personnes personnes = new Personnes(Session["DB_REPO"]);
            if (ModelState.IsValid)
            {
                if (personnes.SelectByID(personne.Id))
                {
                    String sql = "SELECT * from Personnes where Prenom='" + personne.Prenom.ToString() + "'";
                    personnes.QuerySQL(sql);
                    // Le même prenom
                    if (personnes.Next())
                    {
                        //Le même nom
                        sql = "SELECT * from Personnes where Nom='" + personne.Nom.ToString() + "'";
                        personnes.QuerySQL(sql);
                        if (personnes.Next())
                        {
                            // Vérifier si c'est pas moi-même
                            personnes.SelectByID(personne.Id);
                            if (personnes.personne.Prenom != personne.Prenom ||
                                personnes.personne.Nom != personne.Nom)
                            {
                                ViewBag.Erreur = "Un gamer possède déja ce nom et prénom";
                                return View(personne);
                            }
                        }
                    }
                    try
                    {
                        personnes.personne = personne;
                        personnes.personne.UpLoadImage(Request);
                        personnes.Update();
                        return RedirectToAction("Lister", "Personnes");
                    }
                    catch
                    {
                        ViewBag.Erreur = "Une erreur lors de l'update! Avez-vous une image?";
                    }

                }
            }
            return View(personne);
        }
Example #28
0
        private void ValidateAddingButton_Click(object sender, EventArgs e)
        {
            Personnes personnes = new Personnes();

            personnes.CIN       = CINTextBox.Text;
            personnes.Name      = NameTextBox.Text;
            personnes.BirthDate = DateTime.Parse(BirthDateDatePicker.Text);
            if (MaleRadioButton.Checked)
            {
                personnes.Sexe = "M";
            }
            else if (FemaleRadioButton.Checked)
            {
                personnes.Sexe = "F";
            }
            if (FatherComboBox.SelectedItem == null)
            {
                personnes.IDFather = null;
            }
            else
            {
                Personnes father = new Personnes();
                father             = dal.GetIdOutOfName(FatherComboBox.SelectedItem.ToString());
                personnes.IDFather = father;
            }
            if (MotherComboBox.SelectedItem == null)
            {
                personnes.IDMother = null;
            }
            else
            {
                Personnes Mother = new Personnes();
                Mother             = dal.GetIdOutOfName(MotherComboBox.SelectedItem.ToString());
                personnes.IDMother = Mother;
            }
            int a = dal.AddPerson(personnes);

            if (a == 1)
            {
                MessageBox.Show("Person Added Successfully!!");
            }
            this.Hide();
        }
        private static void Deserialiser()
        {
            Console.WriteLine("1. Binaire \n2.XML \n Tapez 1 ou 2");
            string    saisie        = Console.ReadLine();
            Personnes listePersonne = null;

            switch (saisie)
            {
            case "1":
                if (File.Exists(FICHIER_BINAIRE))
                {
                    FileStream      flux          = File.OpenRead(FICHIER_BINAIRE);
                    BinaryFormatter deserialiseur = new BinaryFormatter();
                    listePersonne = (Personnes)deserialiseur.Deserialize(flux);
                }
                else
                {
                    Console.WriteLine("Pas de fichier binaire");
                }
                break;

            case "2":
                if (File.Exists(FICHIER_XML))
                {
                    FileStream    flux          = File.OpenRead(FICHIER_XML);
                    SoapFormatter deserialiseur = new SoapFormatter();
                    listePersonne = (Personnes)deserialiseur.Deserialize(flux);
                }
                else
                {
                    Console.WriteLine("Pas de fichier xml");
                }
                break;
            }
            if (listePersonne != null)
            {
                foreach (var personne in listePersonne)
                {
                    Console.WriteLine(personne);
                }
            }
        }
Example #30
0
        private List <Personnes> toPersonnesList(SqlDataReader data)
        {
            List <Personnes> temp = new List <Personnes>();
            Personnes        per  = new Personnes();

            while (data.Read())
            {
                per.ID        = data.GetInt32(0);
                per.CIN       = data.GetString(1);
                per.Name      = data.GetString(2);
                per.BirthDate = data.GetDateTime(3);
                per.Sexe      = data.GetString(4);
                //father insertion
                if (data.IsDBNull(5))
                {
                    per.IDFather = null;
                }
                else
                {
                    Personnes father = new Personnes();
                    father.ID    = data.GetInt32(5);
                    per.IDFather = father;
                }

                //mother insertion
                if (data.IsDBNull(6))
                {
                    per.IDMother = null;
                }
                else
                {
                    Personnes mother = new Personnes();
                    mother.ID    = data.GetInt32(6);
                    per.IDMother = mother;
                }


                temp.Add(new Personnes(per));
            }
            return(temp);
        }
Example #31
0
        private string GetNameOutOfId(Personnes per)
        {
            SqlCommand cmd = new SqlCommand("SELECT Nom FROM Personnes WHERE ID=@ID", Connection);

            cmd.Parameters.AddWithValue("@ID", per.ID);
            if (Connection.State == System.Data.ConnectionState.Closed)
            {
                Connection.Open();
            }
            SqlDataReader data = cmd.ExecuteReader();

            if (data.Read())
            {
                string name = data.GetString(0);
                return(name);
            }
            else
            {
                return(null);
            }
        }
Example #32
0
        public Personnes GetIdOutOfName(string v)
        {
            SqlCommand cmd = new SqlCommand("SELECT ID FROM Personnes WHERE Nom=@Name", Connection);

            cmd.Parameters.AddWithValue("@Name", v);
            if (Connection.State == System.Data.ConnectionState.Closed)
            {
                Connection.Open();
            }
            SqlDataReader data = cmd.ExecuteReader();

            if (data.Read())
            {
                Personnes pr = new Personnes();
                pr.ID = data.GetInt32(0);
                return(pr);
            }
            else
            {
                return(null);
            }
        }
Example #33
0
 // GET: Dossiers
 public ActionResult Index()
 {
     if (Session["client"] != null)
     {
         Personnes       clientconnecte = Session["client"] as Personnes;
         List <Dossiers> mesdossiers    = new List <Dossiers>();
         foreach (Dossiers d in db.Dossiers)
         {
             if (d.client == clientconnecte.id_personne)
             {
                 mesdossiers.Add(d);
             }
         }
         return(View(mesdossiers.OrderBy(a => a.id_dossier).ToList()));
     }
     else
     {
         string            message = "Veuillez vous connecter pour acceder à cette page";
         Authentifications auth    = new Authentifications();
         return(RedirectToAction("Connexion", "Authentifications", new { auth, message }));;
     }
 }
 public ActionResult Effacer(String Id)
 {
     Personnes personnes = new Personnes(Session["DB_REPO"]);
     personnes.DeleteRecordByID(Id);
     return RedirectToAction("Lister", "Personnes");
 }
        public ActionResult Lister()
        {
            Personnes personnes = new Personnes(Session["DB_REPO"]);

            if (Request["nom"] != null)
            {
                Personnes_Par_Jeu personnesParjeu = new Personnes_Par_Jeu(Request["nom"], Session["DB_REPO"]);

                String orderBy = "";
                if (Session["Personne_SortBy"] != null)
                    orderBy = (String)Session["Personne_SortBy"] + " " + (String)Session["Personne_SortOrder"];

                personnesParjeu.SelectAll(orderBy);
                return View(personnesParjeu.ToList());
            }
            else
            {
                String orderBy = "";
                if (Session["Personne_SortBy"] != null)
                    orderBy = (String)Session["Personne_SortBy"] + " " + (String)Session["Personne_SortOrder"];

                personnes.SelectAll(orderBy);
                return View(personnes.ToList());
            }
        }