Ejemplo n.º 1
0
 private void lk_box_add_2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (DialogResult.Yes == Messages.Confirmation(Mots.Confirmer.ToLower()))
     {
         PhotosArticle p = current.Photos[1];
         p.Article = current;
         Image i = box_add_2.Image;
         box_add_2.Image.Dispose();
         box_photo.Image.Dispose();
         if (PhotosArticleBLL.Delete(p))
         {
             box_add_2.Image = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
             current.Photos.Remove(p);
             box_add_2.Tag        = false;
             lk_box_add_2.Visible = false;
             current.Photos       = BLL.PhotosArticleBLL.List("select * from photo_article where article = " + current.Id);
             Messages.Succes();
         }
         else
         {
             box_add_2.Image = i;
         }
         LoadPhotoPrincipal();
     }
 }
Ejemplo n.º 2
0
 private void box_add_8_DoubleClick(object sender, EventArgs e)
 {
     if (current != null ? current.Id > 0 : false)
     {
         bool add = (bool)(((PictureBox)sender).Tag);
         if (!add)
         {
             OpenFileDialog file = new OpenFileDialog();
             file.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
             file.Filter           = "Fichiers jpg (*.jpg)|*.jpg|Fichiers png (*.png)|*.png|Fichiers bmp (*.bmp)|*.bmp|Tous les images (*.*)|*.jpg;*.png;*.bmp";
             if (file.ShowDialog(this) == DialogResult.OK)
             {
                 string path = file.FileName;
                 if (path != null ? !path.Trim().Equals("") : false)
                 {
                     if (DialogResult.Yes == Messages.Confirmation(Mots.Enregistrer.ToLower()))
                     {
                         PhotosArticle p = PhotosArticleBLL.Save(new PhotosArticle(path, current));
                         if (p != null ? p.Id > 0 : false)
                         {
                             current.Photos.Add(p);
                             box_add_8.Image      = Image.FromFile(Chemins.getCheminArticle(current.Id.ToString()) + p.Nom);
                             box_add_8.Tag        = true;
                             lk_box_add_8.Visible = true;
                             LoadPhotoPrincipal();
                             Messages.Succes();
                         }
                     }
                 }
             }
         }
         else
         {
             Messages.Information(Mots.Msg_Photo_exist);
         }
     }
     else
     {
         Messages.ShowErreur(Mots.Msg_Select_Article);
     }
 }