Exemple #1
0
        private void editerService_Click(object sender, RoutedEventArgs e)
        {
            ajouterService editerService = new ajouterService();

            editerService.Loaded               -= editerService.ajouterServiceWin_Loaded;
            editerService.nomTB.Text            = JeuxTest.Services[dataServices.SelectedIndex].Nom;
            editerService.descriptionTB.Text    = JeuxTest.Services[dataServices.SelectedIndex].Description;
            editerService.prixHTTB.Text         = JeuxTest.Services[dataServices.SelectedIndex].PrixHT.ToString();
            editerService.tauxTVATB.Text        = JeuxTest.Services[dataServices.SelectedIndex].TauxTVA.ToString();
            editerService.dureeNUD.Value        = JeuxTest.Services[dataServices.SelectedIndex].Duree;
            editerService.debutDTP.SelectedDate = JeuxTest.Services[dataServices.SelectedIndex].DebutAbo;
            editerService.ShowDialog();
            JeuxTest.Services[dataServices.SelectedIndex].Nom         = editerService.nomTB.Text;
            JeuxTest.Services[dataServices.SelectedIndex].Description = editerService.descriptionTB.Text;
            JeuxTest.Services[dataServices.SelectedIndex].PrixHT      = decimal.Parse(editerService.prixHTTB.Text);
            JeuxTest.Services[dataServices.SelectedIndex].TauxTVA     = decimal.Parse(editerService.tauxTVATB.Text);
            JeuxTest.Services[dataServices.SelectedIndex].Duree       = (int)editerService.dureeNUD.Value;
            JeuxTest.Services[dataServices.SelectedIndex].DebutAbo    = (DateTime)editerService.debutDTP.SelectedDate;
            //sert à actualiser l'affichage
            JeuxTest.Services.Add(JeuxTest.Services[dataServices.SelectedIndex]);
            JeuxTest.Services.Move(JeuxTest.Services.Count - 1, dataServices.SelectedIndex);
            JeuxTest.Services.RemoveAt(dataServices.SelectedIndex);
        }
Exemple #2
0
        void addService()
        {
            ajouterService fenetreAjout = new ajouterService();

            fenetreAjout.ShowDialog();
            if (!fenetreAjout.Canceled)
            {
                string   nomNouveauService         = fenetreAjout.nomTB.Text;
                int      dureeNouveauService       = (int)fenetreAjout.dureeNUD.Value;
                string   descriptionNouveauService = fenetreAjout.descriptionTB.Text;
                decimal  prixHT              = decimal.Parse(fenetreAjout.prixHTTB.Text);
                decimal  tauxTVA             = decimal.Parse(fenetreAjout.tauxTVATB.Text);
                DateTime debutNouveauService = (DateTime)fenetreAjout.debutDTP.SelectedDate;
                if ((bool)fenetreAjout.moisRB.IsChecked)
                {
                    JeuxTest.Services.Add(new Service(debutNouveauService, dureeNouveauService, nomNouveauService, descriptionNouveauService, prixHT, tauxTVA, true));
                }
                else if ((bool)fenetreAjout.semainesRB.IsChecked)
                {
                    JeuxTest.Services.Add(new Service(debutNouveauService, dureeNouveauService, nomNouveauService, descriptionNouveauService, prixHT, tauxTVA, false));
                }
            }
        }