private void btnParcourirPhotoOfficielle_Click(object sender, EventArgs e)
        {
            openFileDialogPhoto.Multiselect = false;
            openFileDialogPhoto.Filter      = "Images | *.png; *.bmp; *.jpg";
            openFileDialogPhoto.Title       = "Sélectionner la photo";
            DialogResult result = openFileDialogPhoto.ShowDialog();

            if (result == DialogResult.OK) //Si om choisie le fichier
            {
                var p = new Modele.tblFichierPersonnel()
                {
                    chemin      = openFileDialogPhoto.FileName,
                    type        = "Fichier",
                    commentaire = rtbCommentaire.Rtf
                };
                var j = new Modele.tblFichierOfficiel()
                {
                    tblFichierPersonnel = p,
                    tblContrat          = cmbContrat.SelectedItem as Modele.tblContrat,
                    noContrat           = (cmbContrat.SelectedItem as Modele.tblContrat).noContrat
                };
                var tempList = (lstPhotoOfficiel.DataSource as List <Modele.tblFichierOfficiel>);
                tempList.Add(j);
                lstPhotoOfficiel.DataSource   = null;
                lstPhotoOfficiel.DataSource   = tempList;
                lstPhotoOfficiel.SelectedItem = j;
            }
        }
        private void lstPhotoOfficiel_SelectedIndexChanged(object sender, EventArgs e)
        {
            var i = (lstPhotoOfficiel.SelectedItem as Modele.tblFichierOfficiel);

            if (i == null)
            {
                pbApercu.Image           = null;
                lblTailleFichier.Text    = "Taille:";
                lblNomFichier.Text       = "Nom:";
                lblTypeFichier.Text      = "Type:";
                cmbContrat.SelectedIndex = 0;
                rtbCommentaire.Rtf       = "";
                this.selection           = null;
                return;
            }
            if (artiste.PhotoExiste(i))
            {
                cmbContrat.Enabled = false;
            }
            else
            {
                cmbContrat.Enabled = true;
            }
            var f = new FileInfo(((sender as ListBox).SelectedItem as Modele.tblFichierOfficiel).tblFichierPersonnel.chemin);

            Dictionary <string, string> types = new Dictionary <string, string>()
            {
                { "PNG", "Image" },
                { "JPG", "Image" },
                { "JPEG", "Image" },
                { "PDF", "Document" },
                { "DOCX", "Document" },
                { "DOC", "Document" },
                { "TXT", "Texte" },
                { "XLS", "Document" },
                { "XLSX", "Document" },
                { "XLSM", "Document" }
            };

            if (File.Exists(i.tblFichierPersonnel.chemin) && types[f.Extension.Substring(1).ToUpper()] == "Image")
            {
                pbApercu.Image           = Image.FromFile(i.tblFichierPersonnel.chemin);
                btnOuvrirFichier.Visible = false;
            }
            else
            {
                pbApercu.Image           = null;
                btnOuvrirFichier.Visible = true;
            }
            if (f != null && f.Exists)
            {
                lblTailleFichier.Text = "Taille:" + BytesToString(f.Length);
                lblNomFichier.Text    = "Nom:" + f.Name;
                lblTypeFichier.Text   = "Type:" + types[f.Extension.Substring(1).ToUpper()];
            }
            cmbContrat.SelectedItem = i.tblContrat;
            this.selection          = ((sender as ListBox).SelectedItem as Modele.tblFichierOfficiel).tblFichierPersonnel;
            rtbCommentaire.Rtf      = i.tblFichierPersonnel.commentaire;
        }
        public DetailArtiste()
        {
            InitializeComponent();
            conDetailFichiers           = new Controleur.Details.DetailFichiers();
            artiste                     = new Controleur.Details.DetailArtiste();
            conSomCatArtiste            = new Controleur.Sommaires.SommaireCategorieArtiste();
            lstCatArtiste.SelectionMode = SelectionMode.MultiSimple;
            cmbContrat.DataSource       = artiste.ChargerContrat();
            cmbContrat.DisplayMember    = "noContrat";
            lstCatArtiste.DataSource    = conSomCatArtiste.Tout();
            lstCatArtiste.DisplayMember = "nom";
            idartiste                   = null;
            selection                   = null;

            lstFiches.DataSource        = new List <Modele.tblFichierPersonnel>();
            lstFichier.DataSource       = new List <Modele.tblFichierPersonnel>();
            lstPhotoOfficiel.DataSource = new List <Modele.tblFichierOfficiel>();
        }
        private void btnParcourirFichier_Click(object sender, EventArgs e)
        {
            openFileDialogfichier.Multiselect = false;
            openFileDialogfichier.Title       = "Sélectionner le fichier.";
            openFileDialogfichier.Filter      = "Documents|*.xls;*.xlsx;*.xlsm;*.pdf;*.txt;|Images | *.png; *.bmp; *.jpg;";
            DialogResult result = openFileDialogfichier.ShowDialog();

            if (result == DialogResult.OK) //Si on choisie le fichier
            {
                var f = new Modele.tblFichierPersonnel()
                {
                    chemin = openFileDialogfichier.FileName,
                    type   = "Fichier"
                };
                var tempList = (lstFichier.DataSource as List <Modele.tblFichierPersonnel>);
                tempList.Add(f);
                lstFichier.DataSource   = null;
                lstFichier.DataSource   = tempList;
                lstFichier.SelectedItem = f;
            }
        }