Exemple #1
0
        public override bool Supprimer()
        {
            if (!EstCharge)
            {
                return(false);
            }

            while (ListeAchat.Count > 0)
            {
                ListeAchat[0].Supprimer();
            }

            while (ListeHeure.Count > 0)
            {
                ListeHeure[0].Supprimer();
            }

            Chantier.ListePoste.Remove(this);

            Bdd2.Supprimer(this);

            Chantier.CalculerMontant();

            return(true);
        }
Exemple #2
0
 private void MajMontant()
 {
     CalculerMontant();
     CalculerAvanceMt();
     CalculerMarge();
     Chantier.CalculerMontant();
 }
        private void Editer_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Chantier EC = ((FrameworkElement)sender).DataContext as Chantier;

            if (EC != null)
            {
                return;
            }
        }
        private void ButtonImporter_Click(object sender, RoutedEventArgs e)
        {
            Button B = sender as Button;

            if (B == null)
            {
                return;
            }
            Chantier chantier = B.DataContext as Chantier;

            if (chantier == null)
            {
                return;
            }

            System.Windows.Forms.OpenFileDialog pDialogue = new System.Windows.Forms.OpenFileDialog
            {
                Title            = "Format du fichier .csv : " + "Reference;Description;Montant",
                Filter           = "Fichier csv (*.csv)|*.csv",
                Multiselect      = false,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                RestoreDirectory = true
            };

            String pChemin = "";

            if (pDialogue.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                pChemin = pDialogue.FileName;
            }

            if (pChemin != "" && File.Exists(pChemin))
            {
                try
                {
                    using (StreamReader sr = new StreamReader(pChemin, System.Text.Encoding.GetEncoding(1252)))
                    {
                        while (sr.Peek() > -1)
                        {
                            var l = sr.ReadLine();
                            var t = l.Split(new char[] { ';' }, StringSplitOptions.None);

                            var p = new Poste(chantier);

                            if (t.Length > 0)
                            {
                                p.Reference = t[0];
                            }

                            if (t.Length > 1)
                            {
                                p.Description = t[1];
                            }

                            if (t.Length > 2 && Double.TryParse(t[2].Trim(), out double r))
                            {
                                p.Montant = r;
                            }
                        }
                    }
                }
                catch (Exception ex)
                { this.LogMethode(new Object[] { ex }); }
            }
        }
 public AnalyseChantier(Chantier chantier)
 {
     _Chantier = chantier;
 }
Exemple #6
0
 public void CalculerMontant()
 {
     Chantier.CalculerMontant();
 }
Exemple #7
0
        public Poste(Chantier chantier)
        {
            Bdd2.Ajouter(this);

            Chantier = chantier;
        }