示例#1
0
        public static PhotosArticle savePhotosArticle(PhotosArticle f)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string path = f.Nom;

                f.Nom = Utils.milliseconds() + Path.GetExtension(path);
                string        insert = "insert into photo_article (nom, article) values ('" + f.Nom + "'," + f.Article.Id + ")";
                NpgsqlCommand cmd    = new NpgsqlCommand(insert, con);
                cmd.ExecuteNonQuery();
                f.Id = currentPhotosArticle(f);

                string chemin = Chemins.getCheminArticle(f.Article.Id.ToString()) + f.Nom;
                System.IO.File.Copy(path, chemin, true);

                return(f);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
示例#2
0
        public static bool deleteArticles(Articles f)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                foreach (PhotosArticle p in f.Photos)
                {
                    p.Article = f;
                    BLL.PhotosArticleBLL.Delete(p);
                }

                string        delete = "delete from articles where id = " + f.Id;
                NpgsqlCommand cmd    = new NpgsqlCommand(delete, con);
                cmd.ExecuteNonQuery();

                DirectoryInfo dossier = new DirectoryInfo(Chemins.getCheminArticle(f.Id.ToString()));
                if (dossier.Exists)
                {
                    dossier.Delete();
                }
                return(true);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(false);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
示例#3
0
        public static bool  deletePhotosArticle(PhotosArticle f)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        delete = "delete from photo_article where id = " + f.Id;
                NpgsqlCommand cmd    = new NpgsqlCommand(delete, con);
                cmd.ExecuteNonQuery();
                try
                {
                    string chemin = Chemins.getCheminArticle(f.Article.Id.ToString()) + f.Nom;
                    if (File.Exists(chemin))
                    {
                        File.Delete(chemin);
                    }
                }
                catch (Exception ex) { }
                return(true);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(false);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
示例#4
0
        public static bool updatePhotoUsers(Users f)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string path = "";
                if (!(f.Photo == null || f.Photo.Trim().Equals("")))
                {
                    path    = f.Photo;
                    f.Photo = Utils.milliseconds() + Path.GetExtension(path);
                }

                string        delete = "update users set photo = '" + f.Photo + "' where id = " + f.Id;
                NpgsqlCommand cmd    = new NpgsqlCommand(delete, con);
                cmd.ExecuteNonQuery();

                if (!(path == null || path.Trim().Equals("")))
                {
                    string chemin = Chemins.getCheminUsers(f.Id.ToString()) + f.Photo;
                    System.IO.File.Copy(path, chemin, true);
                }

                return(true);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(false);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
        private void SaveCurrent()
        {
            string       fileName = Chemins.CheminBackupServeur() + DateTime.Now.ToString("dd-MM-yyyy") + ".csv";
            bool         deja     = File.Exists(fileName);
            ObjectThread o_       = new ObjectThread(Constantes.PBAR_WAIT);

            o_.UpdateMaxBar(lIO.Count);

            foreach (IOEMDevice o in lIO)
            {
                Logs.WriteCsv(fileName, o);
                Constantes.LoadPatience(false);
            }
            if (!deja)
            {
                FileInfo     file = new FileInfo(fileName);
                ObjectThread o1   = new ObjectThread(dgv_backup);
                o1.WriteDataGridView(new object[] { file.Name });
            }
            File.Delete(Chemins.CheminDatabase() + "LogRecord.csv");
            File.Create(Chemins.CheminDatabase() + "LogRecord.csv");

            ObjectThread o2 = new ObjectThread(dgv_log);

            o2.ClearDataGridView(true);
            Utils.WriteLog("-- Sauvegarde du fichier courant effectuée");
            Constantes.LoadPatience(true);
        }
示例#6
0
        private void LoadCurrentSetting()
        {
            Setting s = SettingBLL.ReturnSetting();

            chk_autorun.Checked           = s.Autorun;
            chk_auto_synchro.Checked      = s.AutoSynchro;
            chk_save_delete.Checked       = s.AutoClearAndBackup;
            chk_rattach.Checked           = s.AutoRattach;
            chk_add_enroller_auto.Checked = s.AddEnrollAuto;
            chk_auto_backup.Checked       = s.AutoBackupDevice;
            chk_connect.Checked           = s.CheckConnect;
            chk_use_tampon_log.Checked    = s.UseFileTamponLog;
            chk_connect_synchro.Checked   = s.AutoCheckConnectAndSynchro;
            chk_create_service.Checked    = s.CreateService;
            dtp_time_synchro_auto.Value   = s.TimeSynchroAuto != null ? (!s.TimeSynchroAuto.ToShortDateString().Equals("01/01/0001") ? s.TimeSynchroAuto : DateTime.Now) : DateTime.Now;
            dtp_time_synchro_auto.Enabled = s.AutoCheckConnectAndSynchro;
            string path = s.CheminPhoto;

            if (path != null ? path.Trim().Equals("") : true)
            {
                //C:\Users\Administrateur\lymytz\CCOS.A\documents\docEmps\perso\photo
                path = Chemins.CheminUser() + "lymytz" + Constantes.FILE_SEPARATOR + txt_name.Text.Trim() + Constantes.FILE_SEPARATOR + "documents" + Constantes.FILE_SEPARATOR + "docEmps" + Constantes.FILE_SEPARATOR + "perso" + Constantes.FILE_SEPARATOR + "photo" + Constantes.FILE_SEPARATOR;
            }
            txt_path_photo.Text = path;
            path = s.CheminSetup;
            if (path != null ? path.Trim().Equals("") : true)
            {
                path = Chemins.cheminStartup;
            }
            txt_path_setup.Text = path;
        }
        private void ReadSelectFile()
        {
            List <IOEMDevice> l = Logs.ReadCsv(Chemins.CheminBackupServeur() + currentFile);
            ObjectThread      o = new ObjectThread(Constantes.PBAR_WAIT);

            o.UpdateMaxBar(l.Count);
            LoadLogs(l);
        }
示例#8
0
 static void insertAuto(DateTime debut, DateTime fin)
 {
     while (debut < fin)
     {
         Logs.WriteTxt(Chemins.CheminPing() + "192.168.30.230.txt", debut.ToString());
         debut = debut.AddSeconds(60);
     }
 }
        public void LoadDataFile()
        {
            lIO_ = Logs.ReadCsv(Chemins.CheminBackup(currentPointeuse.Ip) + currentFile);
            ObjectThread o = new ObjectThread(Constantes.PBAR_WAIT);

            o.UpdateMaxBar(lIO.Count);
            LoadLogs(lIO_, true);
        }
示例#10
0
 private void LoadPhotoPrincipal()
 {
     box_photo.Image.Dispose();
     if (current != null ? current.Id > 0 : false)
     {
         if (current.Photos != null?current.Photos.Count > 0:false)
         {
             string chemin = Chemins.getCheminArticle(current.Id.ToString());
             box_photo.Image = Image.FromFile(chemin + current.Photos[0].Nom);
             return;
         }
     }
     box_photo.Image = global::CATALOGUE_ARTICLE.Properties.Resources.article;
 }
示例#11
0
 private void btn_prec_Click(object sender, EventArgs e)
 {
     if (box_article.Tag != null)
     {
         int i = (int)box_article.Tag;
         if (i > 0)
         {
             i--;
             string chemin = Chemins.getCheminArticle(current.Id.ToString());
             box_article.Image = Image.FromFile(chemin + current.Photos[i].Nom);
             box_article.Tag   = i;
         }
     }
 }
 public void LoadFileBackup()
 {
     dgv_backup.Rows.Clear();
     string[] files = System.IO.Directory.GetFiles(Chemins.CheminBackupServeur(), "*.csv");
     foreach (string f in files)
     {
         FileInfo file = new FileInfo(f);
         if (file.Name != "LogRecord.csv")
         {
             dgv_backup.Rows.Add(new object[] { file.Name });
         }
     }
     ResetDataBackup();
 }
示例#13
0
 private void btn_search_path_setup_Click(object sender, EventArgs e)
 {
     fbd_search.SelectedPath = Chemins.CheminUser();
     if (fbd_search.ShowDialog() == DialogResult.OK)
     {
         try
         {
             txt_path_setup.Text = fbd_search.SelectedPath + Constantes.FILE_SEPARATOR;
         }
         catch (Exception ex)
         {
             Messages.Exception("Form_Setting (btn_search_path_setup_Click)", ex);
         }
     }
 }
 public void LoadFileBackup()
 {
     if (currentPointeuse != null ? currentPointeuse.Id > 0 : false)
     {
         dgv_backup.Rows.Clear();
         int      i     = 0;
         string[] files = System.IO.Directory.GetFiles(Chemins.CheminBackup(currentPointeuse.Ip), "*.csv");
         foreach (string f in files)
         {
             ++i;
             FileInfo file = new FileInfo(f);
             dgv_backup.Rows.Add(new object[] { i, file.Name, file.CreationTime, file.FullName });
         }
     }
     ResetDataBackup();
 }
示例#15
0
 private void btn_connecter_Click(object sender, EventArgs e)
 {
     try
     {
         if (ConnectLog())
         {
             timer1.Stop();
             timer2.Stop();
             this.Close();
             Form_Parent f_parent = new Form_Parent();
             if (Constantes.f_parent == null)
             {
                 f_parent.Show();
                 Constantes.f_parent = f_parent;
             }
             else
             {
                 Constantes.f_parent.InitializeComponent();
                 Constantes.f_parent.Show();
             }
             if (Constantes.users != null)
             {
                 Acces.LoadAcces(Constantes.users.Niveau);
                 Constantes.f_parent.txt_users.Text = Constantes.users.Prenom + " " + Constantes.users.Nom;
                 if (!(Constantes.users.Photo == null || Constantes.users.Photo.Trim().Equals("")))
                 {
                     string chemin = Chemins.getCheminUsers(Constantes.users.Id.ToString());
                     if (System.IO.File.Exists(chemin + Constantes.users.Photo))
                     {
                         Constantes.f_parent.box_users.Image = Image.FromFile(chemin + Constantes.users.Photo);
                         return;
                     }
                 }
             }
             Constantes.f_parent.box_users.Image.Dispose();
             Constantes.f_parent.box_users.Image = global::CATALOGUE_ARTICLE.Properties.Resources.contact;
         }
     }
     catch (Exception ex)
     {
         Messages.Exception(ex);
     }
 }
        private void btn_current_Click(object sender, EventArgs e)
        {
            lIO         = new List <IOEMDevice>();
            currentFile = "LogRecord.csv";
            current     = false;
            string fileName = Chemins.CheminDatabase() + currentFile;

            if (File.Exists(fileName))
            {
                current              = true;
                pbar_statut.Value    = 0;
                Constantes.PBAR_WAIT = pbar_statut;
                Thread t = new Thread(new ThreadStart(LoadCurrentLog));
                t.Start();
            }
            else
            {
                Utils.WriteLog("Le fichier courant n'existe pas");
            }
        }
示例#17
0
        private void box_photo_DoubleClick(object sender, EventArgs e)
        {
            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)
                    {
                        current.Photo = path;
                        if (current != null ? current.Id > 0 : false)
                        {
                            if (DialogResult.Yes == Messages.Confirmation(Mots.Enregistrer))
                            {
                                if (UsersBLL.UpdatePhoto(current))
                                {
                                    var t = current.Photo;
                                    box_photo.Image      = Image.FromFile(Chemins.getCheminUsers(current.Id.ToString()) + current.Photo);
                                    box_photo.Tag        = true;
                                    lk_box_photo.Visible = true;
                                    Messages.Succes();
                                }
                            }
                        }
                        else
                        {
                            box_photo.Image = Image.FromFile(current.Photo);
                        }
                    }
                }
            }
            else
            {
                Messages.Information(Mots.Msg_Photo_exist);
            }
        }
示例#18
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);
     }
 }
 private void supprimerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentFile != null ? currentFile.Trim().Length > 0 : false)
     {
         Utils.WriteLog("Demande de suppression du fichier " + currentFile + " de l'appareil " + currentPointeuse.Ip);
         if (Messages.Question("Voulez-vous vraiment supprimer ce fichier?") == System.Windows.Forms.DialogResult.Yes)
         {
             String file = Chemins.CheminBackup(currentPointeuse.Ip) + currentFile;
             if (File.Exists(file))
             {
                 File.Delete(file);
             }
             LoadFileBackup();
             dgv_log.Rows.Clear();
         }
         else
         {
             Utils.WriteLog("Suppression du fichier " + currentFile + " de l'appareil " + currentPointeuse.Ip + " annulée");
         }
     }
 }
示例#20
0
 private void LoadPhoto(Users u)
 {
     if (u != null ? u.Id > 0 : false)
     {
         if (!(u.Photo == null || u.Photo.Trim().Equals("")))
         {
             string chemin = Chemins.getCheminUsers(u.Id.ToString());
             if (System.IO.File.Exists(chemin + u.Photo))
             {
                 box_photo.Image      = Image.FromFile(chemin + u.Photo);
                 box_photo.Tag        = true;
                 lk_box_photo.Visible = true;
                 return;
             }
         }
     }
     box_photo.Image.Dispose();
     box_photo.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
     box_photo.Tag        = false;
     lk_box_photo.Visible = false;
 }
        public void DeleteDoublon()
        {
            List <IOEMDevice> l        = new List <IOEMDevice>();
            string            fileName = Chemins.CheminBackup(currentPointeuse.Ip) + currentFile;
            int          i             = 0;
            ObjectThread o             = new ObjectThread(Constantes.PBAR_WAIT);

            o.UpdateMaxBar(lIO_.Count);
            foreach (IOEMDevice p in lIO_)
            {
                bool deja = false;
                foreach (IOEMDevice s in l)
                {
                    if (s.idwSEnrollNumber == p.idwSEnrollNumber && s.idwYear == p.idwYear && s.idwMonth == p.idwMonth && s.idwDay == p.idwDay && s.idwHour == p.idwHour && s.idwMinute == p.idwMinute && s.idwSecond == p.idwSecond)
                    {
                        ++i;
                        deja = true;
                        break;
                    }
                }
                if (!deja)
                {
                    l.Add(p);
                }
                Constantes.LoadPatience(false);
            }
            File.Delete(fileName);
            o.UpdateMaxBar(Constantes.PBAR_WAIT.Maximum + l.Count);
            foreach (IOEMDevice s in l)
            {
                Logs.WriteCsv(fileName, s);
                Constantes.LoadPatience(false);
            }
            Constantes.LoadPatience(true);
            Utils.WriteLog("---- Nombre Ligne Total : " + lIO_.Count);
            Utils.WriteLog("---- Nombre Ligne Supprimée : " + i);
            Utils.WriteLog("---- Nombre Ligne Restante : " + l.Count);
            LoadDataFile();
            Utils.WriteLog("-- Fin de la suppression des doublons du fichier " + currentFile + " de l'appareil " + currentPointeuse.Ip + "...");
        }
示例#22
0
        private void load()
        {
            if (articles != null ? articles.Count > 0 : false)
            {
                current             = articles[0];
                lb_designation.Text = current.Designation;
                if (current.Marque != null ? current.Marque.Id > 0 : false)
                {
                    lb_marque.Text = current.Marque.Designation;
                }
                lb_datesave.Text     = current.DateSave.ToShortDateString();
                lb_puv.Text          = current.Puv.ToString();
                lb_famille.Text      = current.Famille != null ? current.Famille.Designation : "";
                txt_description.Text = current.Description;

                if (current.Photos != null ? current.Photos.Count > 0 : false)
                {
                    string chemin = Chemins.getCheminArticle(current.Id.ToString());
                    box_article.Image = Image.FromFile(chemin + current.Photos[0].Nom);
                    box_article.Tag   = 0;
                }
            }
        }
示例#23
0
        public static Users saveUsers(Users f)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string path = "";
                if (!(f.Photo == null || f.Photo.Trim().Equals("")))
                {
                    path    = f.Photo;
                    f.Photo = Utils.milliseconds() + Path.GetExtension(path);
                }
                string insert = "insert into users (nom, prenom, identifiant, mot_passe, photo, actif, niveau) values " +
                                "('" + f.Nom + "','" + f.Prenom + "','" + f.Identifiant + "','" + f.Password + "','" + f.Photo + "','" + f.Actif + "'," + f.Niveau.Id + ")";
                NpgsqlCommand cmd = new NpgsqlCommand(insert, con);
                cmd.ExecuteNonQuery();
                f.Id = currentUsers(f);

                if (!(path == null || path.Trim().Equals("")))
                {
                    string chemin = Chemins.getCheminUsers(f.Id.ToString()) + f.Photo;
                    System.IO.File.Copy(path, chemin, true);
                }

                return(f);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
示例#24
0
        private void LoadCatalogueMosaique(string query)
        {
            articles = ArticlesBLL.List(query);
            panel_parent.Controls.Clear();
            int x = 0, y = 0, x_ = 0, y_ = 0, c = 0;

            for (int i = 0; i < articles.Count; i++)
            {
                Articles a = articles[i];
                Panel    p = new Panel();
                p.BorderStyle = BorderStyle.FixedSingle;
                p.Margin      = new Padding(3, 3, 3, 3);
                p.Size        = new Size(154, 180);
                p.Location    = new Point(x_ + 12, y_ + 4);

                TextBox t = new TextBox();
                t.Text      = a.Designation;
                t.TextAlign = HorizontalAlignment.Center;
                t.Size      = new Size(140, 20);
                t.Margin    = new Padding(3, 3, 3, 3);
                t.Location  = new Point(6, 3);
                t.ReadOnly  = true;
                p.Controls.Add(t);

                Panel p1 = new Panel();
                p1.Size     = new Size(140, 118);
                p1.Margin   = new Padding(3, 3, 3, 3);
                p1.Location = new Point(6, 26);
                PictureBox b = new PictureBox();
                b.BorderStyle = BorderStyle.FixedSingle;
                if (a.Photos != null ? a.Photos.Count > 0 : false)
                {
                    string chemin = Chemins.getCheminArticle(a.Id.ToString());
                    if (System.IO.File.Exists(chemin + a.Photos[0].Nom))
                    {
                        b.Image = Image.FromFile(chemin + a.Photos[0].Nom);
                    }
                    else
                    {
                        b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.article;
                    }
                    b.Tag = 0;
                }
                else
                {
                    b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.article;
                }
                b.SizeMode = PictureBoxSizeMode.StretchImage;
                b.Size     = new Size(140, 118);
                b.Margin   = new Padding(3, 3, 3, 3);
                b.Location = new Point(0, 0);
                ContextMenuStrip  co = new System.Windows.Forms.ContextMenuStrip(this.components);
                ToolStripMenuItem to = new ToolStripMenuItem();
                to.Text   = Mots.Vue;
                to.Image  = global::CATALOGUE_ARTICLE.Properties.Resources.vue;
                to.Click += delegate(object sender, EventArgs e)
                {
                    if (a != null ? a.Id > 0 : false)
                    {
                        new _2ND.Form_View(a).ShowDialog();
                    }
                };
                co.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { to });
                b.ContextMenuStrip = co;
                p1.Controls.Add(b);
                p.Controls.Add(p1);

                Panel p2 = new Panel();
                p2.BorderStyle = BorderStyle.FixedSingle;
                p2.Size        = new Size(140, 30);
                p2.Margin      = new Padding(3, 3, 3, 3);
                p2.Location    = new Point(6, 147);
                TextBox ts = new TextBox();
                ts.Text      = "Stock : " + a.Stock;
                ts.TextAlign = HorizontalAlignment.Center;
                ts.Size      = new Size(80, 20);
                ts.Margin    = new Padding(3, 3, 3, 3);
                ts.Location  = new Point(29, 5);
                ts.ReadOnly  = true;
                p2.Controls.Add(ts);
                Button bp = new Button();
                bp.Size     = new Size(24, 23);
                bp.Margin   = new Padding(3, 3, 3, 3);
                bp.Location = new Point(3, 4);
                bp.Image    = global::CATALOGUE_ARTICLE.Properties.Resources.prec;
                bp.Click   += delegate(object sender, EventArgs e)
                {
                    if (b.Tag != null)
                    {
                        int j = (int)b.Tag;
                        if (j > 0)
                        {
                            j--;
                            string chemin = Chemins.getCheminArticle(a.Id.ToString());
                            if (System.IO.File.Exists(chemin + a.Photos[j].Nom))
                            {
                                b.Image = Image.FromFile(chemin + a.Photos[j].Nom);
                            }
                            else
                            {
                                b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                            }
                            b.Tag = j;
                        }
                    }
                };
                p2.Controls.Add(bp);
                Button bn = new Button();
                bn.Size     = new Size(24, 23);
                bn.Margin   = new Padding(3, 3, 3, 3);
                bn.Location = new Point(112, 4);
                bn.Image    = global::CATALOGUE_ARTICLE.Properties.Resources.next;
                bn.Click   += delegate(object sender, EventArgs e)
                {
                    if (b.Tag != null)
                    {
                        int j = (int)b.Tag;
                        if (j < a.Photos.Count - 1)
                        {
                            j++;
                            string chemin = Chemins.getCheminArticle(a.Id.ToString());
                            if (System.IO.File.Exists(chemin + a.Photos[j].Nom))
                            {
                                b.Image = Image.FromFile(chemin + a.Photos[j].Nom);
                            }
                            else
                            {
                                b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                            }
                            b.Tag = j;
                        }
                    }
                };
                p2.Controls.Add(bn);
                p.Controls.Add(p2);


                if (c < 3)
                {
                    x_ += 200;
                    c++;
                }
                else
                {
                    x_  = 0;
                    y_ += 205;
                    c   = 0;
                }
                panel_parent.Controls.Add(p);
            }
        }
示例#25
0
        private void LoadCatalogueList(string query)
        {
            articles = ArticlesBLL.List(query);
            panel_parent.Controls.Clear();
            int i = 0, y = 0;

            foreach (Articles a in articles)
            {
                Panel p = new Panel();
                p.BorderStyle = BorderStyle.FixedSingle;
                p.Size        = new Size(777, 160);
                p.Margin      = new Padding(3, 3, 3, 3);
                p.Location    = new Point(12, (13 + y) + (i * 160));

                Panel p1 = new Panel();
                p1.Size     = new Size(140, 118);
                p1.Margin   = new Padding(3, 3, 3, 3);
                p1.Location = new Point(6, 7);
                PictureBox b = new PictureBox();
                b.BorderStyle = BorderStyle.FixedSingle;
                if (a.Photos != null ? a.Photos.Count > 0 : false)
                {
                    string chemin = Chemins.getCheminArticle(a.Id.ToString());
                    if (System.IO.File.Exists(chemin + a.Photos[0].Nom))
                    {
                        b.Image = Image.FromFile(chemin + a.Photos[0].Nom);
                    }
                    else
                    {
                        b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.article;
                    }
                    b.Tag = 0;
                }
                else
                {
                    b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.article;
                }
                b.SizeMode = PictureBoxSizeMode.StretchImage;
                b.Size     = new Size(140, 118);
                b.Margin   = new Padding(3, 3, 3, 3);
                b.Location = new Point(0, 0);
                p1.Controls.Add(b);
                p.Controls.Add(p1);

                Panel p2 = new Panel();
                p2.BorderStyle = BorderStyle.FixedSingle;
                p2.Size        = new Size(140, 30);
                p2.Margin      = new Padding(3, 3, 3, 3);
                p2.Location    = new Point(6, 127);
                TextBox ts = new TextBox();
                ts.Text      = Mots.Stock + " : " + a.Stock;
                ts.TextAlign = HorizontalAlignment.Center;
                ts.Size      = new Size(80, 20);
                ts.Margin    = new Padding(3, 3, 3, 3);
                ts.Location  = new Point(29, 5);
                ts.ReadOnly  = true;
                p2.Controls.Add(ts);
                Button bp = new Button();
                bp.Size     = new Size(24, 23);
                bp.Margin   = new Padding(3, 3, 3, 3);
                bp.Location = new Point(3, 4);
                bp.Image    = global::CATALOGUE_ARTICLE.Properties.Resources.prec;
                bp.Click   += delegate(object sender, EventArgs e)
                {
                    if (b.Tag != null)
                    {
                        int j = (int)b.Tag;
                        if (j > 0)
                        {
                            j--;
                            string chemin = Chemins.getCheminArticle(a.Id.ToString());
                            if (System.IO.File.Exists(chemin + a.Photos[j].Nom))
                            {
                                b.Image = Image.FromFile(chemin + a.Photos[j].Nom);
                            }
                            else
                            {
                                b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                            }
                            b.Tag = j;
                        }
                    }
                };
                p2.Controls.Add(bp);
                Button bn = new Button();
                bn.Size     = new Size(24, 23);
                bn.Margin   = new Padding(3, 3, 3, 3);
                bn.Location = new Point(112, 4);
                bn.Image    = global::CATALOGUE_ARTICLE.Properties.Resources.next;
                bn.Click   += delegate(object sender, EventArgs e)
                {
                    if (b.Tag != null)
                    {
                        int j = (int)b.Tag;
                        if (j < a.Photos.Count - 1)
                        {
                            j++;
                            string chemin = Chemins.getCheminArticle(a.Id.ToString());
                            if (System.IO.File.Exists(chemin + a.Photos[0].Nom))
                            {
                                b.Image = Image.FromFile(chemin + a.Photos[j].Nom);
                            }
                            else
                            {
                                b.Image = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                            }
                            b.Tag = j;
                        }
                    }
                };
                p2.Controls.Add(bn);
                p.Controls.Add(p2);

                Label ld = new Label();
                ld.Text     = Mots.Designation + " : ";
                ld.Size     = new Size(72, 13);
                ld.Margin   = new Padding(3, 0, 3, 0);
                ld.Location = new Point(152, 7);
                p.Controls.Add(ld);
                Label ld_ = new Label();
                ld_.Text     = a.Designation;
                ld_.Size     = new Size(130, 13);
                ld_.Margin   = new Padding(3, 0, 3, 0);
                ld_.Location = new Point(236, 7);
                p.Controls.Add(ld_);
                Label lm = new Label();
                lm.Text     = Mots.Marque + " : ";
                lm.Size     = new Size(52, 13);
                lm.Margin   = new Padding(3, 0, 3, 0);
                lm.Location = new Point(152, 29);
                p.Controls.Add(lm);
                Label lm_ = new Label();
                if (a.Marque != null ? a.Marque.Id > 0 : false)
                {
                    lm_.Text = a.Marque.Designation;
                }
                lm_.Size     = new Size(130, 13);
                lm_.Margin   = new Padding(3, 0, 3, 0);
                lm_.Location = new Point(236, 29);
                p.Controls.Add(lm_);
                Label lc = new Label();
                lc.Text     = Mots.Date_Creation + " : ";
                lc.Size     = new Size(81, 13);
                lc.Margin   = new Padding(3, 0, 3, 0);
                lc.Location = new Point(152, 52);
                p.Controls.Add(lc);
                Label lc_ = new Label();
                lc_.Text     = a.DateSave.ToShortDateString();
                lc_.Size     = new Size(130, 13);
                lc_.Margin   = new Padding(3, 0, 3, 0);
                lc_.Location = new Point(236, 52);
                p.Controls.Add(lc_);
                Label lp = new Label();
                lp.Text     = Mots.Prix_Vente + " : ";
                lp.Size     = new Size(64, 13);
                lp.Margin   = new Padding(3, 0, 3, 0);
                lp.Location = new Point(152, 77);
                p.Controls.Add(lp);
                Label lp_ = new Label();
                lp_.Text     = string.Format("{0:#,##0}", a.Puv);
                lp_.Size     = new Size(130, 13);
                lp_.Margin   = new Padding(3, 0, 3, 0);
                lp_.Location = new Point(236, 77);
                p.Controls.Add(lp_);
                Label lf = new Label();
                lf.Text     = Mots.Famille + " : ";
                lf.Size     = new Size(48, 13);
                lf.Margin   = new Padding(3, 0, 3, 0);
                lf.Location = new Point(152, 101);
                p.Controls.Add(lf);
                Label lf_ = new Label();
                lf_.Text     = a.Famille != null ? a.Famille.Designation : "";
                lf_.Size     = new Size(130, 13);
                lf_.Margin   = new Padding(3, 0, 3, 0);
                lf_.Location = new Point(236, 101);
                p.Controls.Add(lf_);

                GroupBox g = new GroupBox();
                g.Text     = Mots.Description;
                g.Size     = new Size(375, 100);
                g.Margin   = new Padding(3, 3, 3, 3);
                g.Location = new Point(391, 7);
                RichTextBox r = new RichTextBox();
                r.Text     = a.Description;
                r.Size     = new Size(363, 75);
                r.Margin   = new Padding(3, 3, 3, 3);
                r.Location = new Point(6, 19);
                r.ReadOnly = true;
                g.Controls.Add(r);
                p.Controls.Add(g);

                panel_parent.Controls.Add(p);
                i++;
                y += 5;
            }
        }
示例#26
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     pings = Logs.ReadTxt(Chemins.CheminPing() + com_registre.Text + ".txt");
     LoadView();
 }
示例#27
0
        private void LoadPhoto(Articles a)
        {
            if (a != null ? a.Id > 0 : false)
            {
                if (a.Photos != null)
                {
                    string chemin = Chemins.getCheminArticle(a.Id.ToString());
                    if (a.Photos.Count > 0)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[0].Nom))
                        {
                            box_add_1.Image      = Image.FromFile(chemin + a.Photos[0].Nom);
                            box_add_1.Tag        = true;
                            lk_box_add_1.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 1)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[1].Nom))
                        {
                            box_add_2.Image      = Image.FromFile(chemin + a.Photos[1].Nom);
                            box_add_2.Tag        = true;
                            lk_box_add_2.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 2)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[2].Nom))
                        {
                            box_add_3.Image      = Image.FromFile(chemin + a.Photos[2].Nom);
                            box_add_3.Tag        = true;
                            lk_box_add_3.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 3)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[3].Nom))
                        {
                            box_add_4.Image      = Image.FromFile(chemin + a.Photos[3].Nom);
                            box_add_4.Tag        = true;
                            lk_box_add_4.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 4)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[4].Nom))
                        {
                            box_add_5.Image      = Image.FromFile(chemin + a.Photos[4].Nom);
                            box_add_5.Tag        = true;
                            lk_box_add_5.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 5)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[5].Nom))
                        {
                            box_add_6.Image      = Image.FromFile(chemin + a.Photos[5].Nom);
                            box_add_6.Tag        = true;
                            lk_box_add_6.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 6)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[6].Nom))
                        {
                            box_add_7.Image      = Image.FromFile(chemin + a.Photos[6].Nom);
                            box_add_7.Tag        = true;
                            lk_box_add_7.Visible = true;
                        }
                    }
                    if (a.Photos.Count > 7)
                    {
                        if (System.IO.File.Exists(chemin + a.Photos[7].Nom))
                        {
                            box_add_8.Image      = Image.FromFile(chemin + a.Photos[7].Nom);
                            box_add_8.Tag        = true;
                            lk_box_add_8.Visible = true;
                        }
                    }
                }
            }
            else
            {
                box_add_1.Image.Dispose();
                box_add_1.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_1.Tag        = false;
                lk_box_add_1.Visible = false;

                box_add_2.Image.Dispose();
                box_add_2.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_2.Tag        = false;
                lk_box_add_2.Visible = false;

                box_add_3.Image.Dispose();
                box_add_3.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_3.Tag        = false;
                lk_box_add_3.Visible = false;

                box_add_4.Image.Dispose();
                box_add_4.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_4.Tag        = false;
                lk_box_add_4.Visible = false;

                box_add_5.Image.Dispose();
                box_add_5.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_5.Tag        = false;
                lk_box_add_5.Visible = false;

                box_add_6.Image.Dispose();
                box_add_6.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_6.Tag        = false;
                lk_box_add_6.Visible = false;

                box_add_7.Image.Dispose();
                box_add_7.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_7.Tag        = false;
                lk_box_add_7.Visible = false;

                box_add_8.Image.Dispose();
                box_add_8.Image      = global::CATALOGUE_ARTICLE.Properties.Resources.ajouter;
                box_add_8.Tag        = false;
                lk_box_add_8.Visible = false;
            }
        }
示例#28
0
 private void lnk_default_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     txt_path_photo.Text = Chemins.CheminUser() + "lymytz" + Constantes.FILE_SEPARATOR + txt_name.Text.Trim() + Constantes.FILE_SEPARATOR + "documents" + Constantes.FILE_SEPARATOR + "docEmps" + Constantes.FILE_SEPARATOR + "perso" + Constantes.FILE_SEPARATOR + "photo" + Constantes.FILE_SEPARATOR;
 }