コード例 #1
0
ファイル: modifLicDuree.cs プロジェクト: avakovdavid/TEST
        /// <summary>
        /// constructeur de la classe
        /// </summary>
        /// <param name="frmAppelant">la fenêtre de consultation des prêts à partir de laquelle on souhaite modifier une licence de durée</param>
        /// <param name="id">identifiant de la licence de durée qu'on souhaite modifier</param>
        public modifLicDuree(frmResume frmAppelant,int id)
        {
            this.frmAppelant = frmAppelant;
            InitializeComponent();

            Mysql m = new Mysql();
            Licence_duree l = m.getLicenceDuree(id);
            this.l = l;

            /*AFFICHAGE DES INFORMATIONS DANS LE FORMULAIRE*/

            this.txtBoxNomLicDuree.Text = l.getNomVersion();
            this.lblNumLic.Text = l.getIdLicence().ToString();
            this.dateMiseCirculation.Text = l.getDebutLicence().ToString();

            this.nbAnneeDuree.Maximum = 10;
            this.nbAnneeDuree.Minimum = 0;

            this.nbAnneeDuree.Value = l.getDureeLicence();

            try
            {
                this.lblNumMatAssoc.Text = l.getMateriel().getIdMateriel().ToString();
            }
            catch (Exception ex)
            {

            }
        }
コード例 #2
0
ファイル: frmSaisie.cs プロジェクト: avakovdavid/TEST
        private List<frmNvoMat> listeFrmNvoMat; // la liste des formulaires pour ajouter un nouveau materiel

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructeur du module de saisie d'un prêt
        /// </summary>
        public frmSaisie()
        {
            InitializeComponent();
            this.listeFrmNvoMat = new List<frmNvoMat>();
            this.listeFrmNvlLicDuree = new List<frmNvlLicDuree>();
            this.listeFrmNvlLicVersion = new List<frmNvlLicVersion>();

            Mysql m = new Mysql();
            //on instancie une liste de personnes
            List<Personne> lesP = new List<Personne>();

            //on la remplie à partir de la base de données
            lesP = m.getLesPersonne();

            //puis on ajoute chaque personne dans la liste (nom + prenom de la personne)
            for (int i = 0; i < lesP.Count; i++)
            {
                this.listBox1.Items.Add(lesP.ElementAt(i).getNomPersonne() + " " + lesP.ElementAt(i).getPrenomPersonne());
            }

            this.grpBoxMateriel.Hide();
            this.grpBoxLicDuree.Hide();
            this.grpBoxLicVersion.Hide();

            insertNewFrmMat();
            insertNewFrmLicDuree();
            insertNewFrmLicVersion();
        }
コード例 #3
0
ファイル: frmNvoMat.cs プロジェクト: avakovdavid/TEST
        /// <summary>
        /// Constructeur du formulaire pour un nouveau matériel
        /// </summary>
        /// <param name="parent">formulaire de saisie où sera implémenté le formulaire pour un nouveau matériel</param>
        public frmNvoMat(frmSaisie parent)
        {
            InitializeComponent();
            this.frmParent = parent;

            Mysql m = new Mysql();

            List<Marque> lesMarques = m.getLesMarque(); //la liste de toutes les marques
            List<Type_materiel> lesTypes = m.getLesTypeMateriel(); //la liste de tous les types

            // dans le code qui suit nous allons remplire les listes déroulantes pour les marques et les types
            var dataMarque = new List<String>();
            var dataType = new List<String>();

            for (int i = 0; i < lesMarques.Count; i++)
            {
                dataMarque.Add(lesMarques.ElementAt(i).getNomMarque());
            }
            for (int i = 0; i < lesTypes.Count; i++)
            {
                dataType.Add(lesTypes.ElementAt(i).getTypeMateriel());
            }

            this.cBoxMarque.DataSource = dataMarque;
            //this.cBoxMarque.DropDownStyle = ComboBoxStyle.DropDownList; //rend la liste inmodifiable

            this.cBoxType.DataSource = dataType;
            //this.cBoxType.DropDownStyle = ComboBoxStyle.DropDownList; //rend la liste inmodifiable
        }
コード例 #4
0
        /// <summary>
        /// constructeur de la classe
        /// </summary>
        public StatistiquesDeLapp()
        {
            InitializeComponent();
            Mysql m = new Mysql();

            Hashtable az = m.statDeLapp();

            label1.Text = "Actullement il y a "+az["total"]+" utilisateurs enregistré dont " + az["sont_admin"]+" sont administrateurs.";
            label2.Text = " Au total, il y a " + az["nb_materiel"] + " matériel(s) pour " + az["nb_pers"] + " personne(s).";
            label3.Text = " Au total, il y a " + az["nb_licenceD"] + " licence(s) de durée pour " + az["nb_pers_licenceD"] + " personne(s).";
            label4.Text = " Au total, il y a " + az["nb_licenceV"] + " licence(s) de version pour " + az["nb_pers_licenceV"] + " personne(s).";
        }
コード例 #5
0
ファイル: Profil.cs プロジェクト: avakovdavid/ppe
 /// <summary>
 /// fonction qui se déclenche lorsque l'utilisateur valide le formulaire. une modification dans la base de données est alors effectué.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnValider_Click(object sender, EventArgs e)
 {
     try
     {
         Mysql m = new Mysql();
         Personne p = (Personne)MainWindows.getPersConnect();
         m.changerMdp(p, this.tfdMdp.Text, this.tfdNvoMdp.Text, this.tfdNvoMdpC.Text);
         MessageBox.Show("Votre mot de passe a bien été modifié.", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }
コード例 #6
0
ファイル: frmResume.cs プロジェクト: avakovdavid/ppe
        /// <summary>
        /// fonction qui se déclenche lorsque le bouton de suppression d'une licence de durée est cliqué. Permet de supprimet la licence de durée concernée de la base de données
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnSuppLicDuree_Click(object sender, EventArgs e)
        {
            Mysql m = new Mysql();

            try
            {
                m.suppLicDuree(int.Parse(this.tableLayoutLicDuree.GetControlFromPosition(0,this.tableLayoutLicDuree.GetCellPosition((Control)sender).Row).Text));

                this.listBoxQui_SelectedIndexChanged(sender, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #7
0
ファイル: Administration.cs プロジェクト: avakovdavid/ppe
        /// <summary>
        /// fonction executée lorsque l'utilisateur valide la création du nouvel employé. L'utilisateur est alors créé
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreerEmploye_Click(object sender, EventArgs e)
        {
            Hashtable ht = new Hashtable();
            ht.Add("nom", this.tfdNomE.Text);
            ht.Add("prenom", this.tfdPrenomE.Text);
            ht.Add("email", this.tfdEmailE.Text);

            Mysql m = new Mysql();
            try
            {
                if (m.creerUtilisateur(ht, false))
                {
                    MessageBox.Show("L'utilisateur a bien été créé.","Succès",MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #8
0
ファイル: modifLicVersion.cs プロジェクト: avakovdavid/ppe
        /// <summary>
        /// fonction qui se déclenche lorsque l'utilisateur valide ses modifications. 
        /// Si tout est correctement rempli et que les modification ont été prises en compte alors la boite de dialogue est fermée est l'affichage du résumé des prêts est mis à jour (initialisé)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnValider_Click(object sender, EventArgs e)
        {
            Mysql m = new Mysql();

            Hashtable ht = new Hashtable();
            ht.Add("id", this.lblNumLic.Text);
            ht.Add("nom", this.txtBoxNomLicVersion.Text);

            try
            {
                m.updateLicenceVersion(ht);
                MessageBox.Show("la modification a réussie.", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
                this.frmAppelant.init(l.getPersonne().getIdPersonne());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #9
0
ファイル: frmNvlLicVersion.cs プロジェクト: avakovdavid/TEST
 /// <summary>
 /// fonction qui est executée lorsque l'utilisateur clique sur le bouton de supression de la licence. 
 /// Si la licence a déjà été ajoutée alors dans cette fonction on va accepder à la base de données pour la supprimer, sinon on cache juste le formulaire 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void btnSupp_Click(object sender, EventArgs e)
 {
     if (!this.lblNumLicVersionAttribue.Text.Equals(""))
     {
         //nous allons devoir effectuer sa suppression dans la base de donnée :
         Mysql m = new Mysql();
         try
         {
             m.suppLicVersion(int.Parse(this.lblNumLicVersionAttribue.Text));
             this.panel.Hide(); // on cache juste le formulaire
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
     else
     {
         this.panel.Hide(); // on cache juste le formulaire
     }
 }
コード例 #10
0
ファイル: frmResume.cs プロジェクト: avakovdavid/ppeCSharp
        /// <summary>
        /// constructeur de la classe
        /// </summary>
        public frmResume()
        {
            InitializeComponent();

            Mysql m = new Mysql();
            //on instancie une liste de personnes
            List<Personne> lesP = new List<Personne>();

            //on la remplie à partir de la base de données
            lesP = m.getLesPersonne();

            //puis on ajoute chaque personne dans la liste (nom + prenom de la personne)
            for (int i = 0; i < lesP.Count; i++)
            {
                this.listBoxQui.Items.Add(lesP.ElementAt(i).getNomPersonne() + " " + lesP.ElementAt(i).getPrenomPersonne());
            }

            this.init(-1); //aucune personne n'est selectionnée dans la liste au moment de la création de la fenêtre donc le paramètre est : -1

            //this.tableLayoutMat.
        }
コード例 #11
0
ファイル: frmConnect.cs プロジェクト: avakovdavid/ppeCSharp
        /// <summary>
        /// fonction qui est executée lorsque l'utilisateur clique sur le bouton de connection ou la touche "Enter".
        /// Elle permet de vérifier si les identifiants entrés correspondent à ceux dans la base de données et prépare la fenêtre principale si la personne est identifiée
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConnexion_Click(object sender, EventArgs e)
        {
            if (this.tfdLogin.Text.Equals("") || this.tfdMdp.Text.Equals(""))
            {
                MessageBox.Show("Veuillez completer tous les champs.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                try
                {
                    Mysql msql = new Mysql();
                    Personne p = msql.seConnecter(this.tfdLogin.Text, this.tfdMdp.Text);
                    if (p != null)
                    {
                        MessageBox.Show("Vous êtes maintenant connectés.", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        ((MainWindows)MdiParent).getSeConnecter().Visible = false;
                        ((MainWindows)MdiParent).getSeDeconnecter().Visible = true;
                        ((MainWindows)MdiParent).getLesPretsItem().Enabled = true;
                        ((MainWindows)MdiParent).getAdministration().Enabled = true;
                        ((MainWindows)MdiParent).getProfil().Enabled = true;
                        ((MainWindows)MdiParent).getStatistiques().Enabled = true;

                        ((MainWindows)MdiParent).getInfoConnexion().Text = p.getNomPersonne() + " " + p.getPrenomPersonne();

                        this.Close();

                        MainWindows.setPersConnect((Object)p);
                    }
                    else
                    {
                        MessageBox.Show("identifiants incorrectes.", "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
コード例 #12
0
ファイル: frmNvoMat.cs プロジェクト: avakovdavid/TEST
        /// <summary>
        /// fonction executée lorsque l'utilisateur valide son formulaire. Elle effectue un enregistrement de ce matériel dans la base de données
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAjouter_Click(object sender, EventArgs e)
        {
            Mysql m = new Mysql();
            List<Personne> lesPers = m.getLesPersonne();

            //on remplis le tableau associatif avec les données :
            Hashtable ht = new Hashtable();
            ht.Add("marque", this.cBoxMarque.Text);
            ht.Add("type", this.cBoxType.Text);
            ht.Add("date", this.dateTimePicker2.Value.Year + "/" + this.dateTimePicker2.Value.Month + "/" + this.dateTimePicker2.Value.Day);
            ht.Add("garantie", this.garantieMat.Value);
            ht.Add("id_pers", lesPers.ElementAt(this.frmParent.getListBox().SelectedIndex).getIdPersonne());

            //on essaye d'effectuer l'ajout du matériel
            try
            {
                String num = m.ajouterMateriel(ht).ToString(); //on effectue la création dans la base de donnée (on va récupèrer l'identifiant attribué au matériel)
                this.lblNumMatAttribue.Text = num; //on affiche l'identifiant attribué dans le label spécifé juste devant le formulaire de saisie
                this.btnAjouter.Hide(); //on cache le bouton ajouter pour pas ajouter deux fois le même matériel
                MessageBox.Show("Le matériel a bien été ajouté.", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //on récupère la liste des Controls du formulaire qu'on vient de valider pour les désactiver (évider la modification du contenu)
                System.Windows.Forms.Control.ControlCollection lesControls = this.panel.Controls;

                //pour chaque controle on vérifie si ce n'est pas le bouton supprimé et si c'est pas le label qui affiche le numéro attribué puis si la condition est respectée on désactive le controle.
                for (int i = 0; i < lesControls.Count; i++)
                {
                    if (!lesControls[i].Name.Equals("btnSupp") && !lesControls[i].Name.Equals("lblNumMatAttribue"))
                    {
                        lesControls[i].Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                //on va affiché la nature de l'erreur qui a causé l'échec de l'ajout du nouveau matériel
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #13
0
ファイル: modifLicVersion.cs プロジェクト: avakovdavid/ppe
        /// <summary>
        /// constructeur de la classe
        /// </summary>
        /// <param name="frmAppelant">la fenêtre de consultation des prêts à partir de laquelle on souhaite modifier une licence de version</param>
        /// <param name="id">identifiant de la licence de version qu'on souhaite modifier</param>
        public modifLicVersion(frmResume frmAppelant, int id)
        {
            this.frmAppelant = frmAppelant;
            InitializeComponent();

            Mysql m = new Mysql();
            Licence_version l = m.getLicenceVersion(id);
            this.l = l;

            /*AFFICHAGE DES INFORMATIONS DANS LE FORMULAIRE*/

            this.txtBoxNomLicVersion.Text = l.getNomVersion();
            this.lblNumLic.Text = l.getIdLicence().ToString();

            try
            {
                this.lblNumMatAssoc.Text = l.getMateriel().getIdMateriel().ToString();
            }
            catch (Exception ex)
            {

            }
        }
コード例 #14
0
        /// <summary>
        /// constructeur de la classe
        /// </summary>
        /// <param name="frmAppelant">la fenêtre de consultation des prêts à partir de laquelle on souhaite modifier un matériel</param>
        /// <param name="id">identifiant du matériel qu'on souhaite modifier</param>
        public modifMateriel(frmResume frmAppelant, int id)
        {
            Mysql m = new Mysql();

            this.frmAppelant = frmAppelant;
            InitializeComponent();

            /*REMPLISAAGE DES LISTES DE MARQUES ET DES TYPES : */
            List<Marque> lesMarques = m.getLesMarque(); //la liste de toutes les marques
            List<Type_materiel> lesTypes = m.getLesTypeMateriel(); //la liste de tous les types

            var dataMarque = new List<String>();
            var dataType = new List<String>();

            for (int i = 0; i < lesMarques.Count; i++)
            {
                dataMarque.Add(lesMarques.ElementAt(i).getNomMarque());
            }
            for (int i = 0; i < lesTypes.Count; i++)
            {
                dataType.Add(lesTypes.ElementAt(i).getTypeMateriel());
            }

            this.cBoxMarque.DataSource = dataMarque;
            this.cBoxType.DataSource = dataType;

            //on recupère le materiel qu'on souhaite modifier
            this.materiel = m.getMateriel(id);

            /*AFFICHAGE DES INFORMATIONS DANS LE FORMULAIRE*/
            this.lblNumMateriel.Text = this.materiel.getIdMateriel().ToString();
            this.cBoxMarque.SelectedItem = this.materiel.getMarque().getNomMarque();
            this.cBoxType.SelectedItem = this.materiel.getType().getTypeMateriel();
            this.dateMiseCirculation.Text = this.materiel.getDateCirculation().ToString();
            this.garantie.Value = this.materiel.getGarantie();
        }
コード例 #15
0
ファイル: frmResume.cs プロジェクト: avakovdavid/ppe
        /// <summary>
        /// fonction qui permet d'initialiser certains éléments de l'interface
        /// </summary>
        /// <param name="id">identifiant de la personne dont ont souhaite afficher le résumé (-1 dans le cas d'un premier affichage où aucune personne n'est encore choisie)</param>
        public void init(int id)
        {
            //si aucune personne n'est selectionnée dans la liste :
            if (id != -1)
            {
                Mysql m = new Mysql();
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindows));

                this.tableLayoutMat.Controls.Clear();
                this.tableLayoutLicDuree.Controls.Clear();
                this.tableLayoutLicVersion.Controls.Clear();

                /*TABLEAU DES MATERIELS */
                Label lbl1 = new Label();
                lbl1.Text = "n° du matériel";
                this.tableLayoutMat.Controls.Add(lbl1, 0, 0);

                Label lbl2 = new Label();
                lbl2.Text = "Date de mise en circulation";
                this.tableLayoutMat.Controls.Add(lbl2, 1, 0);

                Label lbl3 = new Label();
                lbl3.Text = "Garantie";
                this.tableLayoutMat.Controls.Add(lbl3, 2, 0);

                Label lbl4 = new Label();
                lbl4.Text = "Marque";
                this.tableLayoutMat.Controls.Add(lbl4, 3, 0);

                Label lbl5 = new Label();
                lbl5.Text = "Type";
                this.tableLayoutMat.Controls.Add(lbl5, 4, 0);

                List<Materiel> lesMat = m.getLesMateriel(id);

                for (int i = 0; i < lesMat.Count; i++)
                {
                    Label lblId = new Label();
                    lblId.Anchor = AnchorStyles.None;
                    lblId.TextAlign = ContentAlignment.MiddleLeft;
                    lblId.Text = lesMat.ElementAt(i).getIdMateriel().ToString();
                    this.tableLayoutMat.Controls.Add(lblId, 0, i + 1);

                    Label lblDate = new Label();
                    lblDate.Anchor = AnchorStyles.Bottom;
                    lblDate.TextAlign = ContentAlignment.MiddleLeft;
                    lblDate.Text = lesMat.ElementAt(i).getDateCirculation().ToString();
                    this.tableLayoutMat.Controls.Add(lblDate, 1, i + 1);

                    Label lblGarantie = new Label();
                    lblGarantie.Anchor = AnchorStyles.None;
                    lblGarantie.TextAlign = ContentAlignment.MiddleLeft;
                    lblGarantie.Text = lesMat.ElementAt(i).getGarantie().ToString() + " an(s)";
                    this.tableLayoutMat.Controls.Add(lblGarantie, 2, i + 1);

                    Label lblMarque = new Label();
                    lblMarque.Anchor = AnchorStyles.None;
                    lblMarque.TextAlign = ContentAlignment.MiddleLeft;
                    lblMarque.Text = lesMat.ElementAt(i).getMarque().getNomMarque();
                    this.tableLayoutMat.Controls.Add(lblMarque, 3, i + 1);

                    Label lblType = new Label();
                    lblType.Anchor = AnchorStyles.None;
                    lblType.TextAlign = ContentAlignment.MiddleLeft;
                    lblType.Text = lesMat.ElementAt(i).getType().getTypeMateriel();
                    this.tableLayoutMat.Controls.Add(lblType, 4, i + 1);

                    Button btnSuppMat = new Button();
                    btnSuppMat.Anchor = AnchorStyles.None;
                    btnSuppMat.TextAlign = ContentAlignment.MiddleLeft;

                    this.tableLayoutMat.Controls.Add(btnSuppMat, 5, i + 1);

                    btnSuppMat.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("supp")));
                    btnSuppMat.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                    btnSuppMat.Size = new System.Drawing.Size(25, 25);
                    btnSuppMat.UseVisualStyleBackColor = true;
                    btnSuppMat.Click += new System.EventHandler(this.btnSuppMat_Click);
                    //btnSuppMat.Get
                }

                /*TABLEAU DES LICENCES DE DUREE*/

                Label lbl7 = new Label();
                lbl7.Text = "n° licence";
                this.tableLayoutLicDuree.Controls.Add(lbl7, 0, 0);

                Label lbl8 = new Label();
                lbl8.Text = "Titre";
                this.tableLayoutLicDuree.Controls.Add(lbl8, 1, 0);

                Label lbl9 = new Label();
                lbl9.Text = "Date du début";
                this.tableLayoutLicDuree.Controls.Add(lbl9, 2, 0);

                Label lbl10 = new Label();
                lbl10.Text = "Durée";
                this.tableLayoutLicDuree.Controls.Add(lbl10, 3, 0);

                Label lbl11 = new Label();
                lbl11.Text = "n° matériel associé";
                this.tableLayoutLicDuree.Controls.Add(lbl11, 4, 0);

                List<Licence_duree> lesLicDur = m.getLesLicenceDuree(id);

                for (int i = 0; i < lesLicDur.Count; i++)
                {
                    Label lblId = new Label();
                    lblId.Anchor = AnchorStyles.None;
                    lblId.TextAlign = ContentAlignment.MiddleLeft;
                    lblId.Text = lesLicDur.ElementAt(i).getIdLicence().ToString();
                    this.tableLayoutLicDuree.Controls.Add(lblId, 0, i + 1);

                    Label lblTitre = new Label();
                    lblTitre.Anchor = AnchorStyles.None;
                    lblTitre.TextAlign = ContentAlignment.MiddleLeft;
                    lblTitre.Text = lesLicDur.ElementAt(i).getNomVersion().ToString();
                    this.tableLayoutLicDuree.Controls.Add(lblTitre, 1, i + 1);

                    Label lblDate = new Label();
                    lblDate.Anchor = AnchorStyles.Bottom;
                    lblDate.TextAlign = ContentAlignment.MiddleLeft;
                    lblDate.Text = lesLicDur.ElementAt(i).getDebutLicence().ToString();
                    this.tableLayoutLicDuree.Controls.Add(lblDate, 2, i + 1);

                    Label lblDuree = new Label();
                    lblDuree.Anchor = AnchorStyles.None;
                    lblDuree.TextAlign = ContentAlignment.MiddleLeft;
                    lblDuree.Text = lesLicDur.ElementAt(i).getDureeLicence() + " an(s)";
                    this.tableLayoutLicDuree.Controls.Add(lblDuree, 3, i + 1);

                    try
                    {
                        Label lblNumMat = new Label();
                        lblNumMat.Anchor = AnchorStyles.None;
                        lblNumMat.TextAlign = ContentAlignment.MiddleLeft;
                        lblNumMat.Text = lesLicDur.ElementAt(i).getMateriel().getIdMateriel().ToString();
                        this.tableLayoutLicDuree.Controls.Add(lblNumMat, 4, i + 1);
                    }
                    catch (Exception ex){}

                    Button btnSuppLicDuree = new Button();
                    Button btnModifLicDuree = new Button();
                    btnSuppLicDuree.Anchor = AnchorStyles.None;
                    btnModifLicDuree.Anchor = AnchorStyles.None;
                    btnSuppLicDuree.TextAlign = ContentAlignment.MiddleLeft;
                    btnModifLicDuree.TextAlign = ContentAlignment.MiddleLeft;

                    this.tableLayoutLicDuree.Controls.Add(btnSuppLicDuree, 5, i + 1);
                    this.tableLayoutLicDuree.Controls.Add(btnModifLicDuree, 6, i + 1);

                    btnSuppLicDuree.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("supp")));
                    btnSuppLicDuree.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                    btnSuppLicDuree.Size = new System.Drawing.Size(25, 25);
                    btnSuppLicDuree.UseVisualStyleBackColor = true;
                    btnSuppLicDuree.Click += new System.EventHandler(this.btnSuppLicDuree_Click);

                    btnModifLicDuree.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("edit")));
                    btnModifLicDuree.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                    btnModifLicDuree.Size = new System.Drawing.Size(25, 25);
                    btnModifLicDuree.UseVisualStyleBackColor = true;
                    btnModifLicDuree.Click += new System.EventHandler(this.btnModifLicDuree_Click);
                }

                /*TABLEAU DES LICENCES DE VERSION*/

                Label lbl12 = new Label();
                lbl12.Text = "n° licence";
                this.tableLayoutLicVersion.Controls.Add(lbl12, 0, 0);

                Label lbl13 = new Label();
                lbl13.Text = "Titre";
                this.tableLayoutLicVersion.Controls.Add(lbl13, 1, 0);

                Label lbl14 = new Label();
                lbl14.Text = "n° matériel associé";
                this.tableLayoutLicVersion.Controls.Add(lbl14, 2, 0);

                List<Licence_version> lesLicVersion = m.getLesLicenceVersion(id);

                for (int i = 0; i < lesLicVersion.Count; i++)
                {
                    Label lblId = new Label();
                    lblId.Anchor = AnchorStyles.None;
                    lblId.TextAlign = ContentAlignment.MiddleLeft;
                    lblId.Text = lesLicVersion.ElementAt(i).getIdLicence().ToString();
                    this.tableLayoutLicVersion.Controls.Add(lblId, 0, i + 1);

                    Label lblTitre = new Label();
                    lblTitre.Anchor = AnchorStyles.None;
                    lblTitre.TextAlign = ContentAlignment.MiddleLeft;
                    lblTitre.Text = lesLicVersion.ElementAt(i).getNomVersion().ToString();
                    this.tableLayoutLicVersion.Controls.Add(lblTitre, 1, i + 1);

                    try
                    {
                        Label lblNumMat = new Label();
                        lblNumMat.Anchor = AnchorStyles.None;
                        lblNumMat.TextAlign = ContentAlignment.MiddleLeft;
                        lblNumMat.Text = lesLicVersion.ElementAt(i).getMateriel().getIdMateriel().ToString();
                        this.tableLayoutLicVersion.Controls.Add(lblNumMat, 2, i + 1);
                    }
                    catch (Exception ex) { }

                    Button btnSuppLicVersion = new Button();
                    Button btnModifLicVersion = new Button();
                    btnSuppLicVersion.Anchor = AnchorStyles.None;
                    btnModifLicVersion.Anchor = AnchorStyles.None;
                    btnSuppLicVersion.TextAlign = ContentAlignment.MiddleLeft;
                    btnModifLicVersion.TextAlign = ContentAlignment.MiddleLeft;

                    this.tableLayoutLicVersion.Controls.Add(btnSuppLicVersion, 3, i + 1);
                    this.tableLayoutLicVersion.Controls.Add(btnModifLicVersion, 4, i + 1);

                    btnSuppLicVersion.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("supp")));
                    btnSuppLicVersion.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                    btnSuppLicVersion.Size = new System.Drawing.Size(25, 25);
                    btnSuppLicVersion.UseVisualStyleBackColor = true;
                    btnSuppLicVersion.Click += new System.EventHandler(this.btnSuppLicVersion_Click);

                    btnModifLicVersion.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("edit")));
                    btnModifLicVersion.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                    btnModifLicVersion.Size = new System.Drawing.Size(25, 25);
                    btnModifLicVersion.UseVisualStyleBackColor = true;
                    btnModifLicVersion.Click += new System.EventHandler(this.btnModifLicVersion_Click);
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// fonction qui se déclenche lorsque l'utilisateur valide ses modifications. 
        /// Si tout est correctement rempli et que les modification ont été prises en compte alors la boite de dialogue est fermée est l'affichage du résumé des prêts est mis à jour (initialisé)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnValider_Click(object sender, EventArgs e)
        {
            Mysql m = new Mysql();

            Hashtable ht = new Hashtable();
            ht.Add("id", this.lblNumMateriel.Text);
            ht.Add("marque", this.cBoxMarque.Text);
            ht.Add("type", this.cBoxType.Text);
            ht.Add("date", this.dateMiseCirculation.Value.Year + "/" + this.dateMiseCirculation.Value.Month + "/" + this.dateMiseCirculation.Value.Day);
            ht.Add("garantie", this.garantie.Value);

            try
            {
                m.updateMateriel(ht);
                MessageBox.Show("la modification a réussie.", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
                this.frmAppelant.init(this.materiel.getPersonne().getIdPersonne());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #17
0
ファイル: frmResume.cs プロジェクト: avakovdavid/ppeCSharp
        /// <summary>
        /// fonction qui se déclenche lorsque le bouton de suppression d'un matériel est cliqué. Permet de supprimer le matériel concerné de la base de données
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btnSuppMat_Click(object sender, EventArgs e)
        {
            Mysql m = new Mysql();
            List<Personne> lesP = m.getLesPersonne();

            int idMat = int.Parse(this.tableLayoutMat.GetControlFromPosition(0, this.tableLayoutMat.GetCellPosition((Control)sender).Row).Text);
            try
            {
                List<Licence_duree> lesLicDur = m.getLesLicenceDuree(lesP.ElementAt(this.listBoxQui.SelectedIndex).getIdPersonne(), idMat);
                List<Licence_version> lesLicVersion = m.getLesLicenceVersion(lesP.ElementAt(this.listBoxQui.SelectedIndex).getIdPersonne(), idMat);

                //si il y a des licences de durée associées on va les supprimer
                for (int i = 0; i < lesLicDur.Count; i++)
                {
                    m.suppLicDuree(lesLicDur.ElementAt(i).getIdLicence());
                }

                //si il y des licences de version associées on va les supprimer
                for (int i = 0; i < lesLicVersion.Count; i++)
                {
                    m.suppLicVersion(lesLicVersion.ElementAt(i).getIdLicence());
                }

                m.suppMateriel(idMat);

                this.listBoxQui_SelectedIndexChanged(sender, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #18
0
ファイル: modifLicDuree.cs プロジェクト: avakovdavid/TEST
        /// <summary>
        /// fonction qui se déclenche lorsque l'utilisateur valide ses modifications. 
        /// Si tout est correctement rempli et que les modification ont été prises en compte alors la boite de dialogue est fermée est l'affichage du résumé des prêts est mis à jour (initialisé)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnValider_Click(object sender, EventArgs e)
        {
            Mysql m = new Mysql();

            Hashtable ht = new Hashtable();
            ht.Add("id", this.lblNumLic.Text);
            ht.Add("nom", this.txtBoxNomLicDuree.Text);
            ht.Add("date", this.dateMiseCirculation.Value.Year + "/" + this.dateMiseCirculation.Value.Month + "/" + this.dateMiseCirculation.Value.Day);
            ht.Add("duree", this.nbAnneeDuree.Value);

            try
            {
                m.updateLicenceDuree(ht);
                MessageBox.Show("la modification a réussie.", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
                this.frmAppelant.init(l.getPersonne().getIdPersonne());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #19
0
ファイル: frmResume.cs プロジェクト: avakovdavid/ppeCSharp
        /// <summary>
        /// fonction qui permet d'initialiser certains éléments de l'interface
        /// </summary>
        /// <param name="id">identifiant de la personne dont ont souhaite afficher le résumé (-1 dans le cas d'un premier affichage où aucune personne n'est encore choisie)</param>
        public void init(int id)
        {
            //si une personne est selectionnée dans la liste :
            if (id != -1)
            {
                Mysql m = new Mysql();
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmResume));

                this.tableLayoutMat.Controls.Clear();
                this.tableLayoutLicDuree.Controls.Clear();
                this.tableLayoutLicVersion.Controls.Clear();

                /*TABLEAU DES MATERIELS */
                List<Materiel> lesMat = m.getLesMateriel(id);

                if (lesMat.Count > 0)
                {
                    this.grpBoxMateriel.Show();
                    Label lbl1 = new Label();
                    lbl1.Text = "n° du matériel";
                    this.tableLayoutMat.Controls.Add(lbl1, 0, 0);
                    lbl1.Font = new Font(lbl1.Font, FontStyle.Bold);

                    Label lbl2 = new Label();
                    lbl2.Text = "Mise en circulation";
                    lbl2.Size = new Size(130, 13);
                    this.tableLayoutMat.Controls.Add(lbl2, 1, 0);
                    lbl2.Font = new Font(lbl2.Font, FontStyle.Bold);

                    Label lbl3 = new Label();
                    lbl3.Text = "Garantie";
                    this.tableLayoutMat.Controls.Add(lbl3, 2, 0);
                    lbl3.Font = new Font(lbl3.Font, FontStyle.Bold);

                    Label lbl4 = new Label();
                    lbl4.Text = "Marque";
                    this.tableLayoutMat.Controls.Add(lbl4, 3, 0);
                    lbl4.Font = new Font(lbl4.Font, FontStyle.Bold);

                    Label lbl5 = new Label();
                    lbl5.Text = "Type";
                    this.tableLayoutMat.Controls.Add(lbl5, 4, 0);
                    lbl5.Font = new Font(lbl5.Font, FontStyle.Bold);

                    for (int i = 0; i < lesMat.Count; i++)
                    {
                        Label lblId = new Label();
                        lblId.Anchor = AnchorStyles.None;
                        lblId.TextAlign = ContentAlignment.MiddleLeft;
                        lblId.Text = lesMat.ElementAt(i).getIdMateriel().ToString();
                        this.tableLayoutMat.Controls.Add(lblId, 0, i + 1);

                        Label lblDate = new Label();
                        lblDate.Anchor = AnchorStyles.Bottom;
                        lblDate.TextAlign = ContentAlignment.MiddleLeft;
                        lblDate.Text = lesMat.ElementAt(i).getDateCirculation().ToString();
                        this.tableLayoutMat.Controls.Add(lblDate, 1, i + 1);

                        Label lblGarantie = new Label();
                        lblGarantie.Anchor = AnchorStyles.None;
                        lblGarantie.TextAlign = ContentAlignment.MiddleLeft;
                        lblGarantie.Text = lesMat.ElementAt(i).getGarantie().ToString() + " an(s)";
                        this.tableLayoutMat.Controls.Add(lblGarantie, 2, i + 1);

                        Label lblMarque = new Label();
                        lblMarque.Anchor = AnchorStyles.None;
                        lblMarque.TextAlign = ContentAlignment.MiddleLeft;
                        lblMarque.Text = lesMat.ElementAt(i).getMarque().getNomMarque();
                        this.tableLayoutMat.Controls.Add(lblMarque, 3, i + 1);

                        Label lblType = new Label();
                        lblType.Anchor = AnchorStyles.None;
                        lblType.TextAlign = ContentAlignment.MiddleLeft;
                        lblType.Text = lesMat.ElementAt(i).getType().getTypeMateriel();
                        this.tableLayoutMat.Controls.Add(lblType, 4, i + 1);

                        Button btnSuppMat = new Button();
                        Button btnModifMat = new Button();
                        btnSuppMat.Anchor = AnchorStyles.None;
                        btnModifMat.Anchor = AnchorStyles.None;
                        btnSuppMat.TextAlign = ContentAlignment.MiddleLeft;
                        btnModifMat.TextAlign = ContentAlignment.MiddleLeft;

                        this.tableLayoutMat.Controls.Add(btnSuppMat, 5, i + 1);
                        this.tableLayoutMat.Controls.Add(btnModifMat, 6, i + 1);

                        btnSuppMat.BackgroundImage = global::gsb_application.Properties.Resources.supp;
                        btnSuppMat.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                        btnSuppMat.Size = new System.Drawing.Size(25, 25);
                        btnSuppMat.UseVisualStyleBackColor = true;
                        btnSuppMat.Click += new System.EventHandler(this.btnSuppMat_Click);

                        btnModifMat.BackgroundImage = global::gsb_application.Properties.Resources.edit;
                        btnModifMat.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                        btnModifMat.Size = new System.Drawing.Size(25, 25);
                        btnModifMat.UseVisualStyleBackColor = true;
                        btnModifMat.Click += new System.EventHandler(this.btnModifMat_Click);
                    }
                }
                else
                {
                    this.grpBoxMateriel.Hide();
                }

                /*TABLEAU DES LICENCES DE DUREE*/
                List<Licence_duree> lesLicDur = m.getLesLicenceDuree(id);

                if (lesLicDur.Count > 0)
                {
                    this.grpBoxLicDuree.Show();

                    Label lbl7 = new Label();
                    lbl7.Text = "n° licence";
                    this.tableLayoutLicDuree.Controls.Add(lbl7, 0, 0);
                    lbl7.Font = new Font(lbl7.Font, FontStyle.Bold);

                    Label lbl8 = new Label();
                    lbl8.Text = "Titre";
                    this.tableLayoutLicDuree.Controls.Add(lbl8, 1, 0);
                    lbl8.Font = new Font(lbl8.Font, FontStyle.Bold);

                    Label lbl9 = new Label();
                    lbl9.Text = "Date du début";
                    this.tableLayoutLicDuree.Controls.Add(lbl9, 2, 0);
                    lbl9.Font = new Font(lbl9.Font, FontStyle.Bold);

                    Label lbl10 = new Label();
                    lbl10.Text = "Durée";
                    this.tableLayoutLicDuree.Controls.Add(lbl10, 3, 0);
                    lbl10.Font = new Font(lbl10.Font, FontStyle.Bold);

                    Label lbl11 = new Label();
                    lbl11.Text = "n° matériel associé";
                    this.tableLayoutLicDuree.Controls.Add(lbl11, 4, 0);
                    lbl11.Font = new Font(lbl11.Font, FontStyle.Bold);

                    for (int i = 0; i < lesLicDur.Count; i++)
                    {
                        Label lblId = new Label();
                        lblId.Anchor = AnchorStyles.None;
                        lblId.TextAlign = ContentAlignment.MiddleLeft;
                        lblId.Text = lesLicDur.ElementAt(i).getIdLicence().ToString();
                        this.tableLayoutLicDuree.Controls.Add(lblId, 0, i + 1);

                        Label lblTitre = new Label();
                        lblTitre.Anchor = AnchorStyles.None;
                        lblTitre.TextAlign = ContentAlignment.MiddleLeft;
                        lblTitre.Text = lesLicDur.ElementAt(i).getNomVersion().ToString();
                        this.tableLayoutLicDuree.Controls.Add(lblTitre, 1, i + 1);

                        Label lblDate = new Label();
                        lblDate.Anchor = AnchorStyles.Bottom;
                        lblDate.TextAlign = ContentAlignment.MiddleLeft;
                        lblDate.Text = lesLicDur.ElementAt(i).getDebutLicence().ToString();
                        this.tableLayoutLicDuree.Controls.Add(lblDate, 2, i + 1);

                        Label lblDuree = new Label();
                        lblDuree.Anchor = AnchorStyles.None;
                        lblDuree.TextAlign = ContentAlignment.MiddleLeft;
                        lblDuree.Text = lesLicDur.ElementAt(i).getDureeLicence() + " an(s)";
                        this.tableLayoutLicDuree.Controls.Add(lblDuree, 3, i + 1);

                        try
                        {
                            Label lblNumMat = new Label();
                            lblNumMat.Anchor = AnchorStyles.None;
                            lblNumMat.TextAlign = ContentAlignment.MiddleLeft;
                            lblNumMat.Text = lesLicDur.ElementAt(i).getMateriel().getIdMateriel().ToString();
                            this.tableLayoutLicDuree.Controls.Add(lblNumMat, 4, i + 1);
                        }
                        catch (Exception ex) { }

                        Button btnSuppLicDuree = new Button();
                        Button btnModifLicDuree = new Button();
                        btnSuppLicDuree.Anchor = AnchorStyles.None;
                        btnModifLicDuree.Anchor = AnchorStyles.None;
                        btnSuppLicDuree.TextAlign = ContentAlignment.MiddleLeft;
                        btnModifLicDuree.TextAlign = ContentAlignment.MiddleLeft;

                        this.tableLayoutLicDuree.Controls.Add(btnSuppLicDuree, 5, i + 1);
                        this.tableLayoutLicDuree.Controls.Add(btnModifLicDuree, 6, i + 1);

                        btnSuppLicDuree.BackgroundImage = global::gsb_application.Properties.Resources.supp;
                        btnSuppLicDuree.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                        btnSuppLicDuree.Size = new System.Drawing.Size(25, 25);
                        btnSuppLicDuree.UseVisualStyleBackColor = true;
                        btnSuppLicDuree.Click += new System.EventHandler(this.btnSuppLicDuree_Click);

                        btnModifLicDuree.BackgroundImage = global::gsb_application.Properties.Resources.edit;
                        btnModifLicDuree.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                        btnModifLicDuree.Size = new System.Drawing.Size(25, 25);
                        btnModifLicDuree.UseVisualStyleBackColor = true;
                        btnModifLicDuree.Click += new System.EventHandler(this.btnModifLicDuree_Click);
                    }
                }
                else
                {
                    this.grpBoxLicDuree.Hide();
                }

                /*TABLEAU DES LICENCES DE VERSION*/

                List<Licence_version> lesLicVersion = m.getLesLicenceVersion(id);

                if (lesLicVersion.Count > 0)
                {
                    this.grpBoxLicVersion.Show();

                    Label lbl12 = new Label();
                    lbl12.Text = "n° licence";
                    this.tableLayoutLicVersion.Controls.Add(lbl12, 0, 0);
                    lbl12.Font = new Font(lbl12.Font, FontStyle.Bold);

                    Label lbl13 = new Label();
                    lbl13.Text = "Titre";
                    this.tableLayoutLicVersion.Controls.Add(lbl13, 1, 0);
                    lbl13.Font = new Font(lbl13.Font, FontStyle.Bold);

                    Label lbl14 = new Label();
                    lbl14.Text = "n° matériel associé";
                    this.tableLayoutLicVersion.Controls.Add(lbl14, 2, 0);
                    lbl14.Font = new Font(lbl14.Font, FontStyle.Bold);

                    for (int i = 0; i < lesLicVersion.Count; i++)
                    {
                        Label lblId = new Label();
                        lblId.Anchor = AnchorStyles.None;
                        lblId.TextAlign = ContentAlignment.MiddleLeft;
                        lblId.Text = lesLicVersion.ElementAt(i).getIdLicence().ToString();
                        this.tableLayoutLicVersion.Controls.Add(lblId, 0, i + 1);

                        Label lblTitre = new Label();
                        lblTitre.Anchor = AnchorStyles.None;
                        lblTitre.TextAlign = ContentAlignment.MiddleLeft;
                        lblTitre.Text = lesLicVersion.ElementAt(i).getNomVersion().ToString();
                        this.tableLayoutLicVersion.Controls.Add(lblTitre, 1, i + 1);

                        try
                        {
                            Label lblNumMat = new Label();
                            lblNumMat.Anchor = AnchorStyles.None;
                            lblNumMat.TextAlign = ContentAlignment.MiddleLeft;
                            lblNumMat.Text = lesLicVersion.ElementAt(i).getMateriel().getIdMateriel().ToString();
                            this.tableLayoutLicVersion.Controls.Add(lblNumMat, 2, i + 1);
                        }
                        catch (Exception ex) { }

                        Button btnSuppLicVersion = new Button();
                        Button btnModifLicVersion = new Button();
                        btnSuppLicVersion.Anchor = AnchorStyles.None;
                        btnModifLicVersion.Anchor = AnchorStyles.None;
                        btnSuppLicVersion.TextAlign = ContentAlignment.MiddleLeft;
                        btnModifLicVersion.TextAlign = ContentAlignment.MiddleLeft;

                        this.tableLayoutLicVersion.Controls.Add(btnSuppLicVersion, 3, i + 1);
                        this.tableLayoutLicVersion.Controls.Add(btnModifLicVersion, 4, i + 1);

                        btnSuppLicVersion.BackgroundImage = global::gsb_application.Properties.Resources.supp;
                        btnSuppLicVersion.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                        btnSuppLicVersion.Size = new System.Drawing.Size(25, 25);
                        btnSuppLicVersion.UseVisualStyleBackColor = true;
                        btnSuppLicVersion.Click += new System.EventHandler(this.btnSuppLicVersion_Click);

                        btnModifLicVersion.BackgroundImage = global::gsb_application.Properties.Resources.edit;
                        btnModifLicVersion.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                        btnModifLicVersion.Size = new System.Drawing.Size(25, 25);
                        btnModifLicVersion.UseVisualStyleBackColor = true;
                        btnModifLicVersion.Click += new System.EventHandler(this.btnModifLicVersion_Click);
                    }
                }
                else
                {
                    this.grpBoxLicVersion.Hide();
                }

                if (lesMat.Count == 0 && lesLicDur.Count == 0 && lesLicVersion.Count == 0)
                {
                    MessageBox.Show("Aucun prêt pour " + this.listBoxQui.SelectedItem.ToString());
                }
            }
            else
            {
                this.grpBoxMateriel.Hide();
                this.grpBoxLicDuree.Hide();
                this.grpBoxLicVersion.Hide();
            }
        }
コード例 #20
0
ファイル: frmResume.cs プロジェクト: avakovdavid/ppeCSharp
        /// <summary>
        /// fonction qui se déclenche lorsque l'utilisateur change la personne dont il souhate consulter les prêts. Permet de faire appel à la fonction de initialisation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listBoxQui_SelectedIndexChanged(object sender, EventArgs e)
        {
            Mysql m = new Mysql();
            List<Personne> lesP = m.getLesPersonne();

            init(lesP.ElementAt(this.listBoxQui.SelectedIndex).getIdPersonne());
        }
コード例 #21
0
        /// <summary>
        /// Constructeur du module des statistiques sur les matériels 
        /// </summary>
        public statistiqueMateriel()
        {
            InitializeComponent();

            Mysql m = new Mysql();
            List<Licence_duree> licence = new List<Licence_duree>();
            licence = m.getLesStatLicence();

            this.tableau2.Controls.Clear();

            Label lblTitre10 = new Label();
            lblTitre10.Text = "n° licence";
            this.tableau2.Controls.Add(lblTitre10);
            lblTitre10.Font = new Font(lblTitre10.Font, FontStyle.Bold);

            Label lblTitre11 = new Label();
            lblTitre11.Text = "Nom";
            this.tableau2.Controls.Add(lblTitre11);
            lblTitre11.Font = new Font(lblTitre11.Font, FontStyle.Bold);

            Label lblTitre12 = new Label();
            lblTitre12.Text = "Date de debut";
            this.tableau2.Controls.Add(lblTitre12);
            lblTitre12.Font = new Font(lblTitre12.Font, FontStyle.Bold);

            Label lblTitre13 = new Label();
            lblTitre13.Text = "Durée";
            this.tableau2.Controls.Add(lblTitre13);
            lblTitre13.Font = new Font(lblTitre13.Font, FontStyle.Bold);

            Label lblTitre14 = new Label();
            lblTitre14.Text = "n° matériel associé";
            this.tableau2.Controls.Add(lblTitre14);
            lblTitre14.Font = new Font(lblTitre14.Font, FontStyle.Bold);

            for (int l = 0; l < licence.Count; l++)
            {
                Label lbl10 = new Label();
                lbl10.Text = "" + licence.ElementAt(l).getIdLicence();
                this.tableau2.Controls.Add(lbl10);

                Label lbl11 = new Label();
                lbl11.Text = "" + licence.ElementAt(l).getNomVersion();
                this.tableau2.Controls.Add(lbl11);

                Label lbl12 = new Label();
                lbl12.Text = "" + licence.ElementAt(l).getDebutLicence();
                this.tableau2.Controls.Add(lbl12);

                Label lbl13 = new Label();
                lbl13.Text = "" + licence.ElementAt(l).getDureeLicence();
                this.tableau2.Controls.Add(lbl13);

                Label lbl14 = new Label();
                try
                {
                    lbl14.Text = "" + licence.ElementAt(l).getMateriel().getIdMateriel();
                }
                catch (Exception ex)
                {
                    lbl14.Text = "";
                }
                this.tableau2.Controls.Add(lbl14);
            }
            afficher();
        }
コード例 #22
0
        /// <summary>
        /// Constructeur du module des statistiques sur les matériels 
        /// </summary>
        public statistiqueMateriel()
        {
            InitializeComponent();

            Mysql m = new Mysql();
            List<Materiel> materiel = new List<Materiel>();
            materiel = m.getLesStatMateriel();

            for (int i = 0; i < materiel.Count; i++)
            {
                Label lbl1 = new Label();
                lbl1.Text = "" + materiel.ElementAt(i).getIdMateriel();
                this.tableau1.Controls.Add(lbl1);

                Label lbl2 = new Label();
                lbl2.Text = "" + materiel.ElementAt(i).getDateCirculation();
                this.tableau1.Controls.Add(lbl2);

                Label lbl3 = new Label();
                lbl3.Text = "" + materiel.ElementAt(i).getGarantie();
                this.tableau1.Controls.Add(lbl3);

                Label lbl4 = new Label();
                lbl4.Text = "" + materiel.ElementAt(i).getMarque().getNomMarque();
                this.tableau1.Controls.Add(lbl4);

                Label lbl5 = new Label();
                lbl5.Text = "" + materiel.ElementAt(i).getType().getTypeMateriel();
                this.tableau1.Controls.Add(lbl5);
            }

            List<Licence_duree> licence = new List<Licence_duree>();
            licence = m.getLesStatLicence();

            for (int l = 0; l < licence.Count; l++)
            {

                Label lbl10 = new Label();
                lbl10.Text = "" + licence.ElementAt(l).getIdLicence();
                this.tableau2.Controls.Add(lbl10);

                Label lbl11 = new Label();
                lbl11.Text = "" + licence.ElementAt(l).getNomVersion();
                this.tableau2.Controls.Add(lbl11);

                Label lbl12 = new Label();
                lbl12.Text = "" + licence.ElementAt(l).getDebutLicence();
                this.tableau2.Controls.Add(lbl12);

                Label lbl13 = new Label();
                lbl13.Text = "" + licence.ElementAt(l).getDureeLicence();
                this.tableau2.Controls.Add(lbl13);

                Label lbl14 = new Label();
                try
                {
                   lbl14.Text = "" + licence.ElementAt(l).getMateriel().getIdMateriel();
                }
                catch(Exception ex)
                {
                   lbl14.Text = "";
                }
                this.tableau2.Controls.Add(lbl14);
            }
        }
コード例 #23
0
        /// <summary>
        /// fonction qui permet d'afficher (d'actualiser) le tableau tatistique des matériels 
        /// </summary>
        public void afficher()
        {
            Mysql m = new Mysql();
            List<Materiel> materiel = new List<Materiel>();
            materiel = m.getLesStatMateriel((int)this.anciennete.Value);

            this.tableau1.Controls.Clear();
            this.tableau1.Show();

            //si la requete a retourné au moins un résultat :
            if (materiel.Count != 0)
            {
                /*ATTRIBUTION DES TITRES EN HAUT DE CHAQUE COLONNE : */
                Label lblTitre1 = new Label();
                lblTitre1.Text = "n° matériel";
                this.tableau1.Controls.Add(lblTitre1);
                lblTitre1.Font = new Font(lblTitre1.Font, FontStyle.Bold);

                Label lblTitre2 = new Label();
                lblTitre2.Text = "Date de mise en circulation";
                this.tableau1.Controls.Add(lblTitre2);
                lblTitre2.Font = new Font(lblTitre2.Font, FontStyle.Bold);

                Label lblTitre3 = new Label();
                lblTitre3.Text = "Garantie";
                this.tableau1.Controls.Add(lblTitre3);
                lblTitre3.Font = new Font(lblTitre3.Font, FontStyle.Bold);

                Label lblTitre4 = new Label();
                lblTitre4.Text = "Marque";
                this.tableau1.Controls.Add(lblTitre4);
                lblTitre4.Font = new Font(lblTitre4.Font, FontStyle.Bold);

                Label lblTitre5 = new Label();
                lblTitre5.Text = "Type";
                this.tableau1.Controls.Add(lblTitre5);
                lblTitre5.Font = new Font(lblTitre5.Font, FontStyle.Bold);

                /*POUR CHAQUE MATERIEL ON VA REMPLIR UNE LIGNE DANS LE TABLEAU*/
                for (int i = 0; i < materiel.Count; i++)
                {
                    Label lbl1 = new Label();
                    lbl1.Text = "" + materiel.ElementAt(i).getIdMateriel();
                    this.tableau1.Controls.Add(lbl1);

                    Label lbl2 = new Label();
                    lbl2.Text = "" + materiel.ElementAt(i).getDateCirculation();
                    this.tableau1.Controls.Add(lbl2);

                    Label lbl3 = new Label();
                    lbl3.Text = "" + materiel.ElementAt(i).getGarantie();
                    this.tableau1.Controls.Add(lbl3);

                    Label lbl4 = new Label();
                    lbl4.Text = "" + materiel.ElementAt(i).getMarque().getNomMarque();
                    this.tableau1.Controls.Add(lbl4);

                    Label lbl5 = new Label();
                    lbl5.Text = "" + materiel.ElementAt(i).getType().getTypeMateriel();
                    this.tableau1.Controls.Add(lbl5);
                }
            }
            else
            {   //sinon si aucun résultat n'est retourné par la requete on va cacher le tableau.
                this.tableau1.Hide();
            }
        }
コード例 #24
0
ファイル: frmNvoMat.cs プロジェクト: avakovdavid/TEST
        /// <summary>
        /// fonction qui est executée lorsque l'utilisateur clique sur le bouton de supression du matériel
        /// Si le matériel a déjà été ajouté alors dans cette fonction on va accepder à la base de données pour le supprimer, sinon on cache juste le formulaire 
        /// Les licences de version qui sont associées à ce matériel seront également supprimées.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSupp_Click(object sender, EventArgs e)
        {
            //Si le label concernant le numéro attribué au matériel est vide :
            if (this.lblNumMatAttribue.Text.Equals(""))
            {
                this.panel.Hide(); // on cache juste le formulaire
            }
            else
            {
                if (MessageBox.Show("Voulez-vous vraiment supprimer ce matériel ? Les licences associées à ce matériel seront également supprimées.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    //nous allons devoir effectuer sa suppression dans la base de donnée :
                    Mysql m = new Mysql();
                    try
                    {
                        m.suppMateriel(int.Parse(this.lblNumMatAttribue.Text));

                        //pour chaque formulaire de materiel
                        for (int i = 0; i < this.frmParent.getListeFrmNvoMat().Count; i++)
                        {
                            //si le formulaire a été validé (le numero attribué est ecrit)
                            if (!this.frmParent.getListeFrmNvoMat().ElementAt(i).getNum().Equals(""))
                            {
                                //pour chaque licence de duree
                                for (int j = 0; j < this.frmParent.getListeFrmNvlLicDuree().Count; j++)
                                {
                                    //si le formulaire a été validé (le numero attribué est ecrit) et si le numero du matériel est renseigné et est égale au numéro du materiel qu'on souhaite supprimer
                                    if (!this.frmParent.getListeFrmNvlLicDuree().ElementAt(j).getNum().Equals("") && this.frmParent.getListeFrmNvlLicDuree().ElementAt(j).getNumMatAssoc().Equals(this.frmParent.getListeFrmNvoMat().ElementAt(i).getNum()))
                                    {
                                        //on effectue la suppression de cette licence.
                                        this.frmParent.getListeFrmNvlLicDuree().ElementAt(j).btnSupp_Click(sender,e);
                                    }
                                }
                                //pour chaque licence de vrsion
                                for (int k = 0; k < this.frmParent.getListeFrmNvlLicVersion().Count; k++)
                                {
                                    //si le formulaire a été validé (le numero attribué est ecrit) et si le numero du matériel est renseigné et est égale au numéro du materiel qu'on souhaite supprimer
                                    if (!this.frmParent.getListeFrmNvlLicVersion().ElementAt(k).getNum().Equals("") && this.frmParent.getListeFrmNvlLicVersion().ElementAt(k).getNumMatAssoc().Equals(this.frmParent.getListeFrmNvoMat().ElementAt(i).getNum()))
                                    {
                                        //on effectue la suppression de cette licence.
                                        this.frmParent.getListeFrmNvlLicVersion().ElementAt(k).btnSupp_Click(sender, e);
                                    }
                                }
                            }
                        }
                        this.panel.Hide(); // on cache juste le formulaire
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
            }
        }