コード例 #1
0
ファイル: PersonneDAL.cs プロジェクト: saibimajdi/_Adox
 public static void Ajouter(Personne P)
 {
     String Query = @"INSERT INTO Personne(Name,Nationalite,DateNaissance) 
                      VALUES('" + P.Name + "','" + P.Nationalite + "','" + P.DateNaissance + "') ";
     Models.Database.Execute(Query);
     Models.Database.Close();
 }
コード例 #2
0
ファイル: PersonneDB.cs プロジェクト: GroupeStageSPPP/STAGE
        public static void Insert(Personne Personne)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"INSERT INTO Personne (Nom, Prenom, DateNaissance, Ville, CodePostal, Telephone, Mail, IdentifiantFamille, IdentifiantGenre)
                               VALUES (@Nom, @Prenom, @DateNaissance, @Ville, @CodePostal, @Telephone, @Mail, @IdentifiantFamille, @IdentifiantGenre)";
            SqlCommand commande = new SqlCommand(requete, connection);

            //Paramètres
            commande.Parameters.AddWithValue("Nom", Personne.Nom);
            commande.Parameters.AddWithValue("Prenom", Personne.Prenom);
            commande.Parameters.AddWithValue("DateNaissance", Personne.DateNaissance);
            commande.Parameters.AddWithValue("Rue", Personne.Rue);
            commande.Parameters.AddWithValue("Ville", Personne.Ville);
            commande.Parameters.AddWithValue("CodePostal", Personne.CodePostal);
            commande.Parameters.AddWithValue("Telephone", Personne.Telephone);
            commande.Parameters.AddWithValue("Mail", Personne.Mail);
            commande.Parameters.AddWithValue("IdentifiantFamille", Personne.famille.Identifiant);
            commande.Parameters.AddWithValue("IdentifiantGenre", Personne.genre.Identifiant);
            //Execution
            connection.Open();
            commande.ExecuteNonQuery();
            connection.Close();
        }
コード例 #3
0
ファイル: PersonneDAL.cs プロジェクト: saibimajdi/_Adox
 public static List<Personne> ListePersonnes()
 {
     List<Personne> Liste = new List<Personne>();
     String Query = "SELECT * FROM Personne";
     SqlDataReader dr = Models.Database.Get(Query);
     if(dr != null && dr.HasRows)
     {
         while(dr.Read())
         {
             Personne P = new Personne(dr);
             Liste.Add(P);
         }
     }
     return Liste;
 }
コード例 #4
0
        /// <summary>
        /// Ajoute un nouveau salarié à la liste à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Add()
        {
            SalarieWindow salarieWindow = new SalarieWindow();
            salarieWindow.creation = true;
            Personne tmp = new Personne();
            tmp.Salarie = new Salarie();
            tmp.Salarie.Salarie_Interne = new Salarie_Interne();
            tmp.Salarie.Tiers = new Tiers();
            tmp.Salarie.Interimaire = new Interimaire();
            tmp.Adresse1 = new Adresse();
            tmp.Adresse2 = new Adresse();
            salarieWindow.ListAgences = new ObservableCollection<Agence_Interimaire>(((App)App.Current).mySitaffEntities.Agence_Interimaire.OrderBy(ai => ai.Fournisseur.Entreprise.Libelle));
            salarieWindow.VilleListPerso = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
            salarieWindow.PaysListPerso = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
            salarieWindow.VilleListPro = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
            salarieWindow.PaysListPro = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
            salarieWindow.ListCivilite = new ObservableCollection<Civilite>(((App)App.Current).mySitaffEntities.Civilite.OrderBy(civ => civ.Libelle_Long));
            salarieWindow.ListEntreprise = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.Where(ent => ent.Fournisseur != null).Where(ent => ent.Fournisseur.Sous_Traitant != null || ent.Fournisseur.Agence_Interimaire != null).OrderBy(ent => ent.Libelle));
            salarieWindow.ListGroupe = new ObservableCollection<Groupe>(((App)App.Current).mySitaffEntities.Groupe.OrderBy(grp => grp.Libelle));
            salarieWindow.listEntreprise_Mere = new ObservableCollection<Entreprise_Mere>(((App)App.Current).mySitaffEntities.Entreprise_Mere.OrderBy(em => em.Nom));
            salarieWindow.ListContrats = new ObservableCollection<Contrat>(((App)App.Current).mySitaffEntities.Contrat.OrderBy(ct => ct.Libelle));
            salarieWindow.listOutillage = new ObservableCollection<Outillage>(((App)App.Current).mySitaffEntities.Outillage.OrderBy(ou => ou.Libelle));
            salarieWindow.DataContext = tmp;
            salarieWindow.bloquerSalarieInterne();
            salarieWindow.bloquerSalarieInterimaire();
            salarieWindow.bloquerSalarieTiers();

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = salarieWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                return (Personne)salarieWindow.DataContext;
            }
            else
            {
                try
                {
                    ((App)App.Current).mySitaffEntities.Detach((Personne)salarieWindow.DataContext);
                }
                catch (Exception)
                {
                }
                return null;
            }
        }
コード例 #5
0
        public void TestCreationDossier()
        {
            List <Personne> listePersonne = new List <Personne>();
            Personne        personne      = new Personne(1, "Jean", "Pagé", new DateTime(1997, 1, 24), "114 Marie Curie", CodePersonne.AVU);
            Personne        personne2     = new Personne(2, "Bob", "Tourmaline", new DateTime(1995, 03, 05), "234 Chalifoux", CodePersonne.DEM);

            listePersonne.Add(personne);
            listePersonne.Add(personne2);

            List <Vehicule> listeVehicule = new List <Vehicule>();

            listeVehicule.Add(new Vehicule(1, "Honda", "Civic", 1997, CodeVehicule.VDP, personne));

            RapportEnquete   rapportEnquete   = new RapportEnquete(1, "Le chat appartenais à la locataire de l'immeuble A123");
            RapportEvenement rapportEvenement = new RapportEvenement(1, CodeNature._01, "114 marie curie", new DateTime(2016, 2, 23, 12, 32, 22), "Aucune chose à précisé");
            RapportAccident  rapportAccident  = new RapportAccident(1, listeVehicule, "114 Marie curie", new DateTime(1999, 10, 12, 1, 23, 44), "Grave blessé sur place et un chat écrasé par une auto.");
            Dossier          dossier          = new Dossier("ASD123", StatutDossier.A, rapportAccident, rapportEvenement, rapportEnquete, CodeDestination.ATT, listeVehicule, listePersonne);
        }
コード例 #6
0
ファイル: EtatCivil.cs プロジェクト: AM-FARES/Test-repository
        public string methodeFindAGuy(String anne, String num)
        {
            Personne p = new Personne();

            p._Num      = num;
            p._AnneeAct = anne;
            Personne Trouve = new Personne();

            Trouve = pmm.RechercheParents(p);
            if (Trouve != null)
            {
                return(Trouve._NomFR + " " + Trouve._PrenomFR);
            }
            else
            {
                return("not found");
            }
        }
コード例 #7
0
    //Recherche sequentielle
    static void rechercher(Personne[] tab, string nom, int borne)
    {
        bool     trouve = false;
        Personne temp   = new Personne(nom.ToUpper(), ' ', 0.0, 0.0, 0);

        foreach (Personne per in tab) //parcourrir chaqu'une des personnes
        {
            if (per.Equals(temp))
            {
                trouve = true;//si trouve on transforme en true
                Console.WriteLine(nom + " est trouvée:\n" + per + "\n");
            }
        }
        if (!trouve)//si rien trouve on affiche personne introuvable
        {
            Console.WriteLine(nom + " est introuvable");
        }
    }
コード例 #8
0
        /// <summary>
        /// Fonction appelé lorsque l'utilisateur
        /// veut sauvegarder son image de profil
        /// ou sa nouvelle description de profil
        /// </summary>
        private void Btn_Sauvegarde(object sender, RoutedEventArgs e)
        {
            //On supprime l'utilisateur actuel de la liste
            Personne Pactuelle = (Application.Current as App).LesUsers.RechercherPersonne(Pseudo_Login.Text);

            (Application.Current as App).LesUsers.AllUsers.Remove(Pactuelle);


            pTemp.ModifierDescription(DescProfil1.Text);   // On actualise la nouvel description dans l'attribut de la personne
            if (cheminImageMis != null)                    //Si le chemin image est différent
            {
                pTemp.ModifierCheminImage(cheminImageMis); //On actualise le chemin de l'image dans l'attribut de la personne
            }

            //On rajoute le nouvel utilisateur dans la liste
            (Application.Current as App).LesUsers.AllUsers.Add(pTemp);
            ConfirmationSauvegarde.Text = "Sauvegarde réussie";
        }
コード例 #9
0
        protected void annulerClick(object sender, EventArgs e)
        {
            int      nIdCourse = Convert.ToInt32(Request.QueryString["Id"]);
            Course   course    = BLL_Course.getCourse(nIdCourse);
            Personne pers      = (Personne)HttpContext.Current.Session["ID"];

            try
            {
                BLL_Participation.supprimerUneParticipation(pers, course);
            }
            catch
            {
            }
            finally
            {
                Response.Redirect("~/PagesWeb/Participant/Courses/ListeCoursesDisponible.aspx");
            }
        }
コード例 #10
0
        public IActionResult Personne([FromHeader] string prenom)
        {
            var personne = new Personne {
                Prenom = prenom
            };

            personne.Xml = Properties.Constantes.PersonXml.Format(personne, bindingFlags: System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

            _logger.LogDebug("$Xml$".Format(personne, bindingFlags: System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic));

            return(OkEnveloppe(personne).WithMessage(new Message
            {
                Code = "Xml",
                Id = "1",
                Severity = "Information",
                Text = "$Xml$".Format(personne, bindingFlags: System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
            }));
        }
コード例 #11
0
        public Personne ValidateConnection(Personne pers)
        {
            WebSportEntities context = new WebSportEntities();

            var test = context.PersonEntities.Where(p => p.Mail == pers.Email);

            PersonEntity entity = context.PersonEntities.Single(p => p.Mail == pers.Email);

            if (entity.Password == pers.Password)
            {
                pers = EntityToBO(entity);
                return(pers);
            }
            else
            {
                return(null);
            }
        }
コード例 #12
0
        public async Task <IActionResult> Create([Bind("Id,Nom,Prenom,Sexe,BirthDate,Statut")] Personne personne)
        {
            if (ModelState.IsValid)
            {
                _context.Add(personne);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            string[] sexes = { "Homme", "Femme" };
            ViewData["ListeSexe"] = new SelectList(sexes);

            string[] statuts = { "Résident", "Personnel" };
            ViewData["ListeStatut"] = new SelectList(statuts);

            return(View(personne));
        }
コード例 #13
0
ファイル: FormMain.cs プロジェクト: LAUZEFM/E4C-
        private void SupprimerPersonne(Personne personne)
        {
            string message = string.Format("Voulez-vous supprimer la personne {0}-{1} ?", personne.Id, personne.Nom);

            if (MessageBox.Show(message, "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                // Suppression dans l'bejt "entreprise"
                if (entreprise.SupprimerPersonne(personne))
                {
                    // Suppression dans la listview
                    lvPersonnel.SupprimerPersonne(personne);
                }
                else
                {
                    MessageBox.Show("L'employé n'a pas pu être supprimé", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #14
0
        public ActionResult Edit(int id, Personne personne)
        {
            try
            {
                Personne lpersonne = Donnnees.Where(p => p.IdPersonne == id).FirstOrDefault();
                lpersonne.Age    = personne.Age;
                lpersonne.Nom    = personne.Nom;
                lpersonne.Prenom = personne.Prenom;
                lpersonne.Pays   = personne.Pays;


                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
コード例 #15
0
        public IActionResult Personnes()
        {
            List <Personne> liste         = Personne.GetPersonnes();
            List <Adresse>  listeAdresses = Adresse.GetAdresses();
            //L'uitilisation du ViewData pour passer les données du controller vers la view
            //ViewData["listesPersonnes"] = liste;
            //L'uitilisation du ViewBag pour passer les données du controller vers la view

            //ViewBag => objet dynamic
            //ViewBag.ListePersonnes = liste;

            //Un objet => à la vue, un model de vue != model MVC
            PersonneAdresseViewModel vModel = new PersonneAdresseViewModel();

            vModel.Adresses  = listeAdresses;
            vModel.Personnes = liste;
            return(View(vModel));
        }
コード例 #16
0
        public ActionResult Edit(Personne p)
        {
            //*******************Version-1*************************
            //new PersonneDAO().addOrUpdatePersonne(p);
            //PersonneDaoDisco.addOrUpdatePersonne(p);
            //Personne pers= entities.Personnes.First(pe => pe.Id == p.Id );
            //pers.Nom = p.Nom;....ou bien

            //*******************Version-2*************************
            //entities.Entry(pers).CurrentValues.SetValues(p);
            //entities.SaveChanges();.... ou bien

            //*******************Version-3*************************
            entities.Personnes.Attach(p);
            entities.Entry(p).State = EntityState.Modified;
            entities.SaveChanges();
            return(Redirect("/"));
        }
コード例 #17
0
        public void DefaultTest()
        {
            StringBuilder defaultStringBuilder = default(StringBuilder);

            Check.That(defaultStringBuilder).IsNull();

            bool defaultBool = default(bool);

            Check.That(defaultBool).IsFalse();

            int defaultint = default(int);

            Check.That(defaultint).IsEqualTo(0);

            Personne defaultPersonne = default(Personne);

            Check.That(defaultPersonne).IsNull();
        }
コード例 #18
0
        /// <summary>
        /// Ajoute une personne au fichier personnes.xml
        /// </summary>
        /// <param name="personne">La personne</param>
        public override void ajoutePersonne(Personne personne)
        {
            listePersonnes.Add(personne);

            if (personne is Realisateur)
            {
                Realisateurs.ToList().Add(personne as Realisateur);
            }
            else
            {
                Acteurs.ToList().Add(personne as Acteur);
            }

            using (var isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                savePersonnes(isolatedStorage);
            }
        }
コード例 #19
0
ファイル: Stephen.cs プロジェクト: msfredb7/GameJam2017
    public void DiscussionAnn()
    {
        Personne ann = ScenarioManager.instance.Annushka;

        personnage.focus = ann;
        ann.focus        = personnage;

        BulleManager.instance.Say("Bonjour Annushka!", personnage, 2);
        BulleManager.instance.Say("Bonjour Stephen,\n ta journée,\n ca va bien?", ann, 2, 5);
        BulleManager.instance.Say("Oui oui", personnage, 2, 7);

        BulleManager.instance.Say("Hey Annushka, savais tu que Rodriguez n'est pas le vrai nom de famille de Enrique?", personnage, delay: 10);
        BulleManager.instance.Say("Ah oui vraiment?", ann, 3, 15);
        BulleManager.instance.Say("J'ai fait la découverte en fouillant dans des dossiers. J'me demande pourquoi il l'a caché", personnage, 2, 7);

        ann.SetFocusIn(null, 20);
        personnage.SetFocusIn(null, 20);
    }
コード例 #20
0
        public async Task <IActionResult> DeletePersonne([FromBody] Personne item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            if (result)
            {
                return(Ok(result));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #21
0
    private void OnMouseDrag()
    {
        Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition);

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, raycastMask))
        {
            dragged = true;

            transform.position = hit.point + Vector3.up * groundOffset;

            if (hit.collider.TryGetComponent(out Personne buddy))
            {
                targetBuddy = buddy;
            }
        }
    }
コード例 #22
0
    private void MoveCamera(Character character)
    {
        if (!CameraInteraction.InstaceNotNull())
        {
            return;
        }
        Personne tar1 = CameraInteraction.GetFocusedTarget(0);
        Personne tar2 = CameraInteraction.GetFocusedTarget(1);

        if (tar1 != null && tar1.focus == character)
        {
            CameraInteraction.FocusCharacter(0, (Personne)character);
        }
        if (tar2 != null && tar2.focus == character)
        {
            CameraInteraction.FocusCharacter(1, (Personne)character);
        }
    }
コード例 #23
0
        protected void enregistrerClick(object sender, EventArgs e)

        {
            try
            {
                Personne personne = BLL_Personne.personne(TB_NOM_VALUE.Text, TB_PRENOM_VALUE.Text, TB_EMAIL_VALUE.Text, TB_TEL_VALUE.Text
                                                          , Convert.ToDateTime(TB_DATE_NAISS_VALUE.Text), TB_MOT_DE_PASSE_VALUE.Text, CB_ACTIVE.Checked, false, DDL_SEXE.SelectedItem.ToString());

                BLL_Personne.addPersonne(personne);
            }
            catch
            {
            }
            finally
            {
                Response.Redirect("~/Administration/Membres/ListeMembres.aspx");
            }
        }
コード例 #24
0
        public ActionResult Connexion()
        {
            var Authentifie = HttpContext.User.Identity.IsAuthenticated; // Booleen pour savoir si on a un cookie

            ViewData["Authentifie"] = Authentifie;
            Personne personne = null;

            if (Authentifie)
            {
                using (var db = new Model1())
                {
                    personne = (from p in db.Personnes
                                where p.Login == HttpContext.User.Identity.Name
                                select p).FirstOrDefault();
                }
            }
            return(View(personne));
        }
        // GET: Locals/Create
        public ActionResult Create(int?id)
        {
            ViewBag.NumAdresse   = new SelectList(db.Adresses, "NumAdresse", "Pays");
            ViewBag.CodeImmeuble = new SelectList(db.Immeubles, "CodeImmeuble", "NomImmeuble");
            ViewBag.CodePers     = new SelectList(db.Personnes.Where(p => p.CodeTypePersonne == 1), "CodePers", "nom");
            ViewBag.CodeSynd     = new SelectList(db.Syndics, "CodeSynd", "NomSynd");
            ViewBag.NumTypeLocal = new SelectList(db.TypeLocals, "NumTypeLocal", "Description");

            //Add 21/10/15
            var locals = db.Locals.Include(l => l.Adresse).Include(l => l.Immeuble).Include(l => l.Personne).Include(l => l.Syndic).Include(l => l.TypeLocal).Where(i => i.CodePers == id);

            ViewBag.listLocals = locals.ToList();

            Personne pers = db.Personnes.Find(id);

            ViewBag.Pers = pers;
            return(View());
        }
コード例 #26
0
        // Handler pour afficher info Contact
        private void InfoContact(object sender, RoutedEventArgs e)
        {
            Button   b       = (Button)sender;
            Personne contact = (Personne)b.DataContext;

            Infos infoWindows = new Infos(User, contact);

            infoWindows.ShowDialog();
            if (infoWindows.IsModified)
            {
                User.ListeContact   = ContactManager.GetListeContactsByUserId(User.Id);
                User.ListePersonnes = PersonneManager.GetListePersonnesByListeContacts(User.ListeContact);
                ListeContactVue.Children.Clear();
                //reafficher le stackPanel avec la nouvelle liste
                ajouterContactTrier(User.ListeContact, User.ListePersonnes);
            }
            infoWindows.Close();
        }
コード例 #27
0
        public async Task <IActionResult> Create([Bind("nom,prenom,ddn,sexe,role")] Personne personne)
        {
            var new_uuid = Guid.NewGuid().ToString();

            personne.uuid = new_uuid;
            //Force la réévaluation de modelState
            ModelState.Clear();
            TryValidateModel(personne);

            if (ModelState.IsValid)
            {
                _context.Add(personne);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(personne));
        }
コード例 #28
0
ファイル: Extensions.cs プロジェクト: ajaunasse/WebSport
        public static PersonEntity ToEntity(this Personne bo, bool withJoin = false)
        {
            if (bo == null)
            {
                return(null);
            }

            return(new PersonEntity
            {
                Id = bo.Id,
                Lastname = bo.Prenom,
                Firstname = bo.Prenom,
                BirthDate = bo.DateNaissance,
                Mail = bo.Email,
                Phone = bo.Phone,
                Password = bo.Password,
            });
        }
コード例 #29
0
        public ActionResult Index()
        {
            var Authentifie = HttpContext.User.Identity.IsAuthenticated;

            ViewData["Authentifie"] = Authentifie;
            Personne personne = null;

            if (Authentifie)
            {
                using (var model = new Model1())
                {
                    personne = (from p in model.Personnes
                                where p.Login == HttpContext.User.Identity.Name
                                select p).FirstOrDefault();
                }
            }
            return(View(personne));
        }
コード例 #30
0
        public Personne ApiGetPersonne(int id)
        {
            HttpClient client   = new HttpClient();
            var        services = new Personne();

            client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["urlProjectAPI"]);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var response = client.GetAsync(string.Format("project22/values/GetPersonne?id={0}", id)).Result;

            if (response.IsSuccessStatusCode)
            {
                var responseData = response.Content.ReadAsStringAsync().Result;
                services = JsonConvert.DeserializeObject <Personne>(responseData);
            }

            return(services);
        }
コード例 #31
0
        static void Main(string[] args)
        {
            Personne player = null;

            Console.WriteLine("Do you want to auth? Y - N");
            string userChoice = Console.ReadLine();

            if (userChoice.Equals("Y"))
            {
                Console.WriteLine("Firstname = ?");
                string fName = Console.ReadLine();
                Console.WriteLine("Lastname = ?");
                string lName = Console.ReadLine();
                player = new Personne(fName, lName);
            }

            JeuPlusMoins(player);
        }
コード例 #32
0
        protected void enregistrerClick(object sender, EventArgs e)

        {
            try
            {
                Personne personne = BLL_Personne.personne(TB_NOM_VALUE.Text, TB_PRENOM_VALUE.Text, TB_EMAIL_VALUE.Text, null
                                                          , Convert.ToDateTime(TB_DATE_NAISS_VALUE.Text), TB_MOT_DE_PASSE_VALUE.Text, true, false, DDL_SEXE.SelectedItem.ToString());

                BLL_Personne.addPersonne(personne);
            }
            catch
            {
            }
            finally
            {
                Response.Redirect("~/PagesWeb/Connexion.aspx");
            }
        }
コード例 #33
0
    protected void ListBoxQui_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (PersonnesDropDownListQui.Count > 0)
        {
            ListItem pers = ListBoxQui.SelectedItem;
            if (DropDownListQui.Items.FindByValue(pers.Value) != null)
            {
                int idx = DropDownListQui.Items.IndexOf(pers);
                DropDownListQuiSelectedIndex  = idx;
                DropDownListQui.SelectedIndex = idx;
                Personne personne = PersonnesDropDownListQui[idx];
                QuestionnaireControlStatAll.SelectedQuestionnaireID = SessionState.Questionnaire.QuestionnaireID;
                QuestionnaireControlStatAll.SelectedPersonneGUID    = personne.PersonneGUID;
            }

            AfficherOnReponduATout();
        }
    }
コード例 #34
0
        public ActionResult Edit(Personne personne)
        {
            if (!ModelState.IsValid)
            {
                return(View(personne));
            }
            if (personne.PersonneId.HasValue)
            {
                _personneRepository.UpdatePersonne(personne);

                return(RedirectToAction("List"));
            }
            else
            {
                _personneRepository.AddPersonne(personne);
                return(RedirectToAction("List"));
            }
        }
コード例 #35
0
ファイル: PersonneDB.cs プロジェクト: GroupeStageSPPP/STAGE
        /// <summary>
        /// Récupère une Personne à partir d'un identifiant de client
        /// </summary>
        /// <param name="Identifiant">Identifant de Personne</param>
        /// <returns>Un Personne </returns>
        public static Personne Get(Int32 identifiant)
        {
            //Connection
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"];
            SqlConnection connection = new SqlConnection(connectionStringSettings.ToString());
            //Commande
            String requete = @"SELECT Identifiant, Nom, Prenom, DateNaissance, Rue, Ville, CodePostal, IdentifiantGenre, IdentifiantFamille, Telephone, Mail FROM Personne
                                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 Personne
            Personne personne = new Personne();

            personne.Identifiant = dataReader.GetInt32(0);
            personne.Nom = dataReader.GetString(1);
            personne.Prenom = dataReader.GetString(2);
            personne.DateNaissance = dataReader.GetDateTime(3);
            personne.Rue = dataReader.GetString(4);
            personne.Ville = dataReader.GetString(5);
            personne.CodePostal = dataReader.GetString(6);
            personne.genre.Identifiant = dataReader.GetInt32(7);
            personne.famille.Identifiant = dataReader.GetInt32(8);
            personne.Telephone = dataReader.GetString(9);
            personne.Mail = dataReader.GetString(10);
            dataReader.Close();
            connection.Close();

            return personne;
        }
        private void NewContact_Click(object sender, RoutedEventArgs e)
        {
            ContactWindow contactWindow = new ContactWindow();
            Personne tmp = new Personne();

            ObservableCollection<Entreprise> toPutOnComboBox = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.OrderBy(ent => ent.Libelle));
            if (!toPutOnComboBox.Contains((Entreprise)this._comboBoxClient.SelectedItem))
            {
                toPutOnComboBox.Add((Entreprise)this._comboBoxClient.SelectedItem);
            }
            contactWindow.EntrepriseList = new ObservableCollection<Entreprise>(toPutOnComboBox.OrderBy(ent => ent.Libelle));

            if (this._comboBoxClient.SelectedItem != null)
            {
                tmp.Entreprise1 = (Entreprise)this._comboBoxClient.SelectedItem;
            }
            tmp.Contact = new Contact();
            contactWindow.DataContext = tmp;

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = contactWindow.ShowDialog();
            Personne personne = (Personne)contactWindow.DataContext;

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                ((App)App.Current).mySitaffEntities.AddToPersonne(personne);
                this.listContact.Clear();
                if (this._comboBoxClient.SelectedItem != null)
                {
                    foreach (Personne pers in ((Entreprise)this._comboBoxClient.SelectedItem).Personne.Where(per => per.Contact != null))
                    {
                        this.listContact.Add(pers.Contact);
                    }
                }
                this._comboBoxContact.SelectedItem = personne.Contact;
                if (this._comboBoxClient.SelectedItem != null)
                {
                    Entreprise E = (Entreprise)this._comboBoxClient.SelectedItem;
                    ObservableCollection<Contact> temp = new ObservableCollection<Contact>();
                    foreach (Personne p in E.Personne)
                    {
                        if (p.Contact != null)
                        {
                            temp.Add(p.Contact);
                        }
                    }
                    this._comboBoxContact.ItemsSource = temp;
                }
            }
            else
            {
                try
                {
                    ((App)App.Current).mySitaffEntities.Detach(personne.Contact);
                    ((App)App.Current).mySitaffEntities.Detach(personne);
                }
                catch (Exception)
                {
                    try
                    {
                        ((App)App.Current).mySitaffEntities.Contact.DeleteObject(personne.Contact);
                        ((App)App.Current).mySitaffEntities.Personne.DeleteObject(personne);
                    }
                    catch (Exception)
                    {

                    }
                }
            }
        }
コード例 #37
0
        private void NewContact_Click(object sender, RoutedEventArgs e)
        {
            ContactWindow contactWindow = new ContactWindow();
            Personne tmp = new Personne();
            if (this._comboBoxFournisseur.SelectedItem != null)
            {
                tmp.Entreprise1 = ((Fournisseur)this._comboBoxFournisseur.SelectedItem).Entreprise;
            }
            tmp.Contact = new Contact();
            contactWindow.DataContext = tmp;

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = contactWindow.ShowDialog();
            Personne personne = (Personne)contactWindow.DataContext;

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                this.listContacts.Clear();
                if (this._comboBoxFournisseur.SelectedItem != null)
                {
                    foreach (Personne pers in ((Fournisseur)this._comboBoxFournisseur.SelectedItem).Entreprise.Personne.Where(per => per.Contact != null))
                    {
                        this.listContacts.Add(pers.Contact);
                    }
                }
                this._comboBoxContact.SelectedItem = personne.Contact;
                if (this._comboBoxEntLivraison.SelectedItem != null)
                {
                    Entreprise E = (Entreprise)this._comboBoxEntLivraison.SelectedItem;
                    this._comboBoxContact.SelectedItem = personne.Contact;
                    ObservableCollection<Contact> temp = new ObservableCollection<Contact>();
                    foreach (Personne p in E.Personne)
                    {
                        if (p.Contact != null)
                        {
                            temp.Add(p.Contact);
                        }
                    }
                    this._comboBoxContactLivraison.ItemsSource = temp;
                }
            }
            else
            {
                try
                {
                    ((App)App.Current).mySitaffEntities.Detach(personne.Contact);
                    ((App)App.Current).mySitaffEntities.Detach(personne);
                }
                catch (Exception)
                {
                    try
                    {
                        ((App)App.Current).mySitaffEntities.Contact.DeleteObject(personne.Contact);
                        ((App)App.Current).mySitaffEntities.Personne.DeleteObject(personne);
                    }
                    catch (Exception)
                    {

                    }
                }
            }
        }
コード例 #38
0
        private void NewContact_Click(object sender, RoutedEventArgs e)
        {
            //ListeContactsControl listeContactsControl = new ListeContactsControl();
            //Personne personne = ((App)App.Current)._theMainWindow.AddContacts(listeContactsControl);
            //if (personne != null)
            //{
            //    if (personne.Contact != null)
            //    {
            //        if (devis.Client2 != null)
            //        {
            //            this.Contacts = new ObservableCollection<Contact>(((App)App.Current).mySitaffEntities.Contact.Where(con => con.Personne.Entreprise1.Libelle == devis.Client2.Entreprise.Libelle).OrderBy(con => con.Personne.Nom));
            //        }
            //        else
            //        {
            //            this.Contacts = new ObservableCollection<Contact>(((App)App.Current).mySitaffEntities.Contact.OrderBy(con => con.Personne.Nom));
            //        }
            //        this._ComboBoxDevisChoixContact.SelectedItem = personne.Contact;
            //    }
            //}
            //else
            //{
            //    this._ComboBoxDevisChoixContact.SelectedItem = null;
            //}
            ContactWindow contactWindow = new ContactWindow();
            Personne tmp = new Personne();
            if (this.entreprise != null)
            {
                tmp.Entreprise1 = this.entreprise;
                contactWindow._ComboBoxContactEntreprise.IsEnabled = false;
            }
            tmp.Contact = new Contact();
            contactWindow.DataContext = tmp;

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = contactWindow.ShowDialog();
            Personne personne = (Personne)contactWindow.DataContext;

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                this.Contacts.Clear();
                this.Contacts = new ObservableCollection<Contact>(((App)App.Current).mySitaffEntities.Contact.Where(con => con.Personne.Entreprise1.Libelle == this.entreprise.Libelle).OrderBy(con => con.Personne.Nom));
                this.Contacts.Add(((Personne)contactWindow.DataContext).Contact);
                this._ComboBoxDevisChoixContact.SelectedItem = personne.Contact;
            }
            else
            {
                try
                {
                    ((App)App.Current).mySitaffEntities.Detach(personne.Contact);
                    ((App)App.Current).mySitaffEntities.Detach(personne);
                }
                catch (Exception)
                {
                    try
                    {
                        ((App)App.Current).mySitaffEntities.Contact.DeleteObject(personne.Contact);
                        ((App)App.Current).mySitaffEntities.Personne.DeleteObject(personne);
                    }
                    catch (Exception)
                    {

                    }
                }
            }
        }
コード例 #39
0
        /// <summary>
        /// Ouvre le salarié séléctionné à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Open()
        {
            if (this._DataGridMain.SelectedItem != null)
            {
                if (this._DataGridMain.SelectedItems.Count == 1)
                {
                    SalarieWindow salarieWindow = new SalarieWindow();
                    Personne tmp = new Personne();
                    tmp = (Personne)this._DataGridMain.SelectedItem;
                    salarieWindow.ListAgences = new ObservableCollection<Agence_Interimaire>(((App)App.Current).mySitaffEntities.Agence_Interimaire.OrderBy(ai => ai.Fournisseur.Entreprise.Libelle));
                    salarieWindow.VilleListPerso = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPerso = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.VilleListPro = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPro = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.ListCivilite = new ObservableCollection<Civilite>(((App)App.Current).mySitaffEntities.Civilite.OrderBy(civ => civ.Libelle_Long));
                    salarieWindow.ListEntreprise = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.Where(ent => ent.Fournisseur != null).Where(ent => ent.Fournisseur.Sous_Traitant != null || ent.Fournisseur.Agence_Interimaire != null).OrderBy(ent => ent.Libelle));
                    salarieWindow.ListGroupe = new ObservableCollection<Groupe>(((App)App.Current).mySitaffEntities.Groupe.OrderBy(grp => grp.Libelle));
                    salarieWindow.listEntreprise_Mere = new ObservableCollection<Entreprise_Mere>(((App)App.Current).mySitaffEntities.Entreprise_Mere.OrderBy(em => em.Nom));
                    salarieWindow.ListContrats = new ObservableCollection<Contrat>(((App)App.Current).mySitaffEntities.Contrat.OrderBy(ct => ct.Libelle));
                    salarieWindow.listOutillage = new ObservableCollection<Outillage>(((App)App.Current).mySitaffEntities.Outillage.OrderBy(ou => ou.Libelle));
                    foreach (Salarie_Outillage so in tmp.Salarie.Salarie_Outillage)
                    {
                        salarieWindow.listOutillage.Remove(so.Outillage1);
                    }
                    if (((Personne)this._DataGridMain.SelectedItem).Salarie.Salarie_Interne == null)
                    {
                        salarieWindow.bloquerSalarieInterne();
                        tmp.Salarie.Salarie_Interne = new Salarie_Interne();
                    }
                    else
                    {
                        salarieWindow.checkBox_SalarieInterne.IsChecked = true;
                    }
                    if (((Personne)this._DataGridMain.SelectedItem).Salarie.Interimaire == null)
                    {
                        salarieWindow.bloquerSalarieInterimaire();
                        tmp.Salarie.Interimaire = new Interimaire();
                    }
                    else
                    {
                        salarieWindow.checkBox_SalarieInterimaire.IsChecked = true;
                    }
                    if (((Personne)this._DataGridMain.SelectedItem).Salarie.Tiers == null)
                    {
                        salarieWindow.bloquerSalarieTiers();
                        tmp.Salarie.Tiers = new Tiers();
                    }
                    else
                    {
                        salarieWindow.checkBox_SalarieTiers.IsChecked = true;
                    }
                    if (tmp.Adresse1 == null)
                    {
                        tmp.Adresse1 = new Adresse();
                    }
                    if (tmp.Adresse2 == null)
                    {
                        tmp.Adresse2 = new Adresse();
                    }
                    salarieWindow.DataContext = tmp;

                    bool? dialogResult = salarieWindow.ShowDialog();
                    if (dialogResult.HasValue && dialogResult.Value == true)
                    {
                        return (Personne)salarieWindow.DataContext;
                    }
                    else
                    {
                        return null;
                    }

                }
                else
                {
                    MessageBox.Show("Vous ne devez sélectionner qu'un seul salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner un salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return null;
            }
        }
コード例 #40
0
        /// <summary>
        /// Ouvre le salarié séléctionné en lecture seule à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Look(Personne salarieToLook)
        {
            if (this._DataGridMain.SelectedItem != null || salarieToLook != null)
            {
                if (this._DataGridMain.SelectedItems.Count == 1 || salarieToLook != null)
                {
                    SalarieWindow salarieWindow = new SalarieWindow();
                    salarieWindow.DataContext = new Personne();
                    salarieWindow.ListAgences = new ObservableCollection<Agence_Interimaire>(((App)App.Current).mySitaffEntities.Agence_Interimaire.OrderBy(ai => ai.Fournisseur.Entreprise.Libelle));
                    salarieWindow.VilleListPerso = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPerso = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.VilleListPro = new ObservableCollection<Ville>(((App)App.Current).mySitaffEntities.Ville.OrderBy(vil => vil.Libelle));
                    salarieWindow.PaysListPro = new ObservableCollection<Pays>(((App)App.Current).mySitaffEntities.Pays.OrderBy(pay => pay.Libelle));
                    salarieWindow.ListCivilite = new ObservableCollection<Civilite>(((App)App.Current).mySitaffEntities.Civilite.OrderBy(civ => civ.Libelle_Long));
                    salarieWindow.ListEntreprise = new ObservableCollection<Entreprise>(((App)App.Current).mySitaffEntities.Entreprise.OrderBy(ent => ent.Libelle));
                    salarieWindow.ListGroupe = new ObservableCollection<Groupe>(((App)App.Current).mySitaffEntities.Groupe.OrderBy(grp => grp.Libelle));
                    salarieWindow.listEntreprise_Mere = new ObservableCollection<Entreprise_Mere>(((App)App.Current).mySitaffEntities.Entreprise_Mere.OrderBy(em => em.Nom));
                    salarieWindow.ListContrats = new ObservableCollection<Contrat>(((App)App.Current).mySitaffEntities.Contrat.OrderBy(ct => ct.Libelle));
                    salarieWindow.listOutillage = new ObservableCollection<Outillage>(((App)App.Current).mySitaffEntities.Outillage.OrderBy(ou => ou.Libelle));

                    if (salarieToLook != null)
                    {
                        foreach (Salarie_Outillage so in salarieToLook.Salarie.Salarie_Outillage)
                        {
                            salarieWindow.listOutillage.Remove(so.Outillage1);
                        }
                        salarieWindow.DataContext = salarieToLook;
                        if (salarieToLook.Salarie.Salarie_Interne != null)
                        {
                            salarieWindow.checkBox_SalarieInterne.IsChecked = true;
                        }
                        if (salarieToLook.Salarie.Interimaire != null)
                        {
                            salarieWindow.checkBox_SalarieInterimaire.IsChecked = true;
                        }
                        if (salarieToLook.Salarie.Tiers != null)
                        {
                            salarieWindow.checkBox_SalarieTiers.IsChecked = true;
                        }
                    }
                    else
                    {
                        foreach (Salarie_Outillage so in ((Personne)this._DataGridMain.SelectedItem).Salarie.Salarie_Outillage)
                        {
                            salarieWindow.listOutillage.Remove(so.Outillage1);
                        }
                        salarieWindow.DataContext = this._DataGridMain.SelectedItem;
                        if (((Personne)this._DataGridMain.SelectedItem).Salarie.Salarie_Interne != null)
                        {
                            salarieWindow.checkBox_SalarieInterne.IsChecked = true;
                        }
                        if (((Personne)this._DataGridMain.SelectedItem).Salarie.Interimaire != null)
                        {
                            salarieWindow.checkBox_SalarieInterimaire.IsChecked = true;
                        }
                        if (((Personne)this._DataGridMain.SelectedItem).Salarie.Tiers != null)
                        {
                            salarieWindow.checkBox_SalarieTiers.IsChecked = true;
                        }
                    }

                    salarieWindow.LectureSeule();

                    bool? dialogResult = salarieWindow.ShowDialog();
                    return null;
                }
                else
                {
                    MessageBox.Show("Vous ne devez sélectionner qu'un seul salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner un salarié.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return null;
            }
        }
コード例 #41
0
        /// <summary>
        /// Ouvre la facture séléctionnée en lecture seule à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Look(Personne personneToLook)
        {
            if (this._DataGridMain.SelectedItem != null || personneToLook != null)
            {
                if (this._DataGridMain.SelectedItems.Count == 1 || personneToLook != null)
                {
                    //Affichage du message "affichage en cours"
                    ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true;
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un contact en cours ...");

                    //Création de la fenêtre
                    ContactWindow contactWindow = new ContactWindow();

                    //Initialisation du Datacontext en Commande_Fournisseur et association à la Commande_Fournisseur sélectionnée
                    contactWindow.DataContext = new Personne();
                    if (personneToLook != null)
                    {
                        contactWindow.DataContext = personneToLook;
                    }
                    else
                    {
                        contactWindow.DataContext = (Personne)this._DataGridMain.SelectedItem;
                    }

                    //Je positionne la lecture seule sur la fenêtre
                    contactWindow.lectureSeule();
                    contactWindow.soloLecture = true;

                    //J'affiche la fenêtre
                    bool? dialogResult = contactWindow.ShowDialog();

                    //Affichage du message "affichage en cours"
                    ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false;
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un contact terminé : " + this.Contacts.Count() + " / " + this.max);

                    //Renvoi null
                    return null;
                }
                else
                {
                    MessageBox.Show("Vous ne devez sélectionner qu'un seul contact.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return null;
                }
            }
            else
            {
                MessageBox.Show("Vous devez sélectionner un contact.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return null;
            }
        }
コード例 #42
0
ファイル: PersonneDB.cs プロジェクト: GroupeStageSPPP/STAGE
        /// <summary>
        /// Récupère une liste de Personne à partir de la base de données
        /// </summary>
        /// <returns>Une liste de client</returns>
        public static List<Personne> 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, Nom, Prenom, DateNaissance, Rue, Ville, CodePostal, IdentifiantGenre, IdentifiantFamille, Telephone, Mail FROM Personne";
            connection.Open();
            SqlCommand commande = new SqlCommand(requete, connection);
            //execution

            SqlDataReader dataReader = commande.ExecuteReader();

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

                //1 - Créer un Personne à partir des donner de la ligne du dataReader
                Personne personne = new Personne();
                personne.Identifiant = dataReader.GetInt32(0);
                personne.Nom = dataReader.GetString(1);
                personne.Prenom = dataReader.GetString(2);
                personne.DateNaissance = dataReader.GetDateTime(3);
                personne.Rue = dataReader.GetString(4);
                personne.Ville = dataReader.GetString(5);
                personne.CodePostal = dataReader.GetString(6);
                personne.genre.Identifiant = dataReader.GetInt32(7);
                personne.famille.Identifiant = dataReader.GetInt32(8);
                personne.Telephone = dataReader.GetString(9);
                personne.Mail = dataReader.GetString(10);

                //2 - Ajouter ce Personne à la list de client
                list.Add(personne);
            }
            dataReader.Close();
            connection.Close();
            return list;
        }
コード例 #43
0
        /// <summary>
        /// Ajoute une nouvelle Facture à la liste à l'aide d'une nouvelle fenêtre
        /// </summary>
        public Personne Add()
        {
            //Affichage du message "ajout en cours"
            ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true;
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un contact en cours ...");

            //Initialisation de la fenêtre
            ContactWindow contactWindow = new ContactWindow();

            //Création de l'objet temporaire
            Personne tmp = new Personne();
            tmp.Contact = new Contact();

            //Mise de l'objet temporaire dans le datacontext
            contactWindow.DataContext = tmp;

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = contactWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value == true)
            {
                //Si j'appuie sur le bouton Ok, je renvoi l'objet DAO se trouvant dans le datacontext de la fenêtre
                return (Personne)contactWindow.DataContext;
            }
            else
            {
                try
                {
                    //On détache le contact
                    try
                    {
                        ((App)App.Current).mySitaffEntities.Detach(((Personne)contactWindow.DataContext).Contact);
                    }
                    catch (Exception) { }
                    ((App)App.Current).mySitaffEntities.Detach((Personne)contactWindow.DataContext);
                }
                catch (Exception)
                {
                }

                //Si j'appuie sur le bouton annuler, je préviens que j'annule mon ajout
                ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false;
                this.recalculMax();
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un contact annulé : " + this.Contacts.Count() + " / " + this.max);

                return null;
            }
        }
コード例 #44
0
        private void _buttonIntNouveauContact_Click(object sender, RoutedEventArgs e)
        {
            if (this._comboBoxIntEntreprise.SelectedItem != null)
            {
                ContactWindow contactWindow = new ContactWindow();
                Personne tmp = new Personne();

                tmp.Entreprise1 = ((Entreprise)this._comboBoxIntEntreprise.SelectedItem);
                tmp.Contact = new Contact();
                contactWindow.DataContext = tmp;

                //booléen nullable vrai ou faux ou null
                bool? dialogResult = contactWindow.ShowDialog();
                Personne personne = (Personne)contactWindow.DataContext;

                if (dialogResult.HasValue && dialogResult.Value == true)
                {
                    this.listContact.Clear();
                    if (this._comboBoxIntEntreprise.SelectedItem != null)
                    {
                        foreach (Personne pers in ((Entreprise)this._comboBoxIntEntreprise.SelectedItem).Personne)
                        {
                            if (pers.Contact != null)
                            {
                                this.listContact.Add(pers.Contact);
                            }
                        }
                    }
                    this._comboBoxIntContact.SelectedItem = personne.Contact;
                }
                else
                {
                    try
                    {
                        ((App)App.Current).mySitaffEntities.Detach(personne.Contact);
                        ((App)App.Current).mySitaffEntities.Detach(personne);
                    }
                    catch (Exception)
                    {
                        try
                        {
                            ((App)App.Current).mySitaffEntities.Contact.DeleteObject(personne.Contact);
                            ((App)App.Current).mySitaffEntities.Personne.DeleteObject(personne);
                        }
                        catch (Exception)
                        {

                        }
                    }
                }
            }
        }
コード例 #45
0
        /// <summary>
        /// Met à jour l'état en bas pour l'utilisateur
        /// </summary>
        /// <param name="typeEtat">texte : "Filtrage", "Ajout", "Modification", "Suppression", "Look", "" ("" = Chargement)</param>
        /// <param name="dao">un objet Commande_Fournisseur soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param>
        public void MiseAJourEtat(string typeEtat, Personne per)
        {
            //Je racalcul le nombre max d'élements
            this.recalculMax();
            //En fonction de l'action, j'affiche le message
            if (typeEtat == "Filtrage")
            {
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("filtrage des contacts terminée : " + this.Contacts.Count() + " / " + this.max);
            }
            else if (typeEtat == "Ajout")
            {
                //J'ajoute la commande_fournisseur dans le linsting
                this.Contacts.Add(per);
                //Je racalcul le nombre max d'élements après l'ajout
                this.recalculMax();
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un contact dénommé '" + per.Nom + "' effectué avec succès. Nombre d'élements : " + this.Contacts.Count() + " / " + this.max);
            }
            else if (typeEtat == "Modification")
            {
                //Je raffraichis mon datagrid
                this._DataGridMain.Items.Refresh();
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Modification du contact dénommé : '" + per.Nom + "' effectué avec succès. Nombre d'élements : " + this.Contacts.Count() + " / " + this.max);
            }
            else if (typeEtat == "Suppression")
            {
                //Je supprime de mon listing l'élément supprimé
                this.Contacts.Remove(per);
                //Je racalcul le nombre max d'élements après la suppression
                this.recalculMax();
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Suppression du contact dénommé : '" + per.Nom + "' effectué avec succès. Nombre d'élements : " + this.Contacts.Count() + " / " + this.max);
            }
            else if (typeEtat == "Look")
            {

            }
            else
            {
            ((App)App.Current)._theMainWindow.changementTexteStatusBar("Chargement des contacts terminé : " + this.Contacts.Count() + " / " + this.max);
            }
            //Je retri les données dans le sens par défaut
            this.triDatas();
            //J'arrete la progressbar
            ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false;
        }
コード例 #46
0
        //Ouvre la fenêtre 'ContactWindow' pour ajouter un nouveau contact
        private void _buttonAjouterContact_Click(object sender, RoutedEventArgs e)
        {
            ContactWindow contactWindow = new ContactWindow();
            Personne tmp = new Personne();

            tmp.Contact = new Contact();
            contactWindow.DataContext = tmp;

            //booléen nullable vrai ou faux ou null
            bool? dialogResult = contactWindow.ShowDialog();
            Contact contact = (Contact)contactWindow.DataContext;

            if (dialogResult.HasValue == true && dialogResult.Value == false)
            {
                try
                {
                    ((App)App.Current).mySitaffEntities.Detach(contact);
                }
                catch (Exception)
                {
                    try
                    {
                        ((App)App.Current).mySitaffEntities.Contact.DeleteObject(contact);
                    }
                    catch (Exception)
                    {

                    }
                }
            }
        }