예제 #1
0
        //Class principale de l'interface des types de prets

        public NouveauPrêts()
        {
            InitializeComponent();

            List <PRET> prets = new List <PRET>();

            Types_Prets.ItemsSource = null;
            prets.Clear();
            foreach (KeyValuePair <int, Type_pret> liste in responsable.liste_types)
            {
                PRET pret = new PRET();
                pret.Description = liste.Value.Description;
                if (liste.Value.Disponibilité == 1)
                {
                    pret.Disponible = "oui";
                }
                else
                {
                    pret.Disponible = "non";
                }
                if (liste.Value.Remboursable == 1)
                {
                    pret.Remboursable = "oui";
                }
                else
                {
                    pret.Remboursable = "non";
                }
                prets.Add(pret);
            }

            Types_Prets.ItemsSource = prets;
        }
예제 #2
0
        private void actualiser()
        {
            List <PRET> prets = new List <PRET>();

            Types_Prets.ItemsSource = null;
            prets.Clear();
            foreach (KeyValuePair <int, Type_pret> liste in responsable.liste_types)
            {
                PRET pret = new PRET();
                pret.Description = liste.Value.Description;
                if (liste.Value.Disponibilité == 1)
                {
                    pret.Disponible = "oui";
                }
                else
                {
                    pret.Disponible = "non";
                }
                if (liste.Value.Remboursable == 1)
                {
                    pret.Remboursable = "oui";
                }
                else
                {
                    pret.Remboursable = "non";
                }
                prets.Add(pret);
            }
            Types_Prets.ItemsSource = prets;
        }
예제 #3
0
        private void Confirmer_modification_Click(object sender, RoutedEventArgs e)
        {
            bool   b     = (bool)Disponible_existant.IsChecked;
            PRET   pret  = (PRET)Types_Prets.SelectedItem;
            string c     = pret.Description;
            int    dispo = 1;

            if (b == false)
            {
                dispo = 0;
            }
            foreach (KeyValuePair <int, Type_pret> liste in responsable.liste_types)
            {
                if (liste.Value.Description.Equals(c))
                {
                    liste.Value.Disponibilité = dispo;
                    responsable.pile_modifications.Add(new Modification(2, liste.Key));
                }
            }

            Mise_a_jour_type.Visibility = Visibility.Visible;
            DoubleAnimation k = new DoubleAnimation();

            k.From     = 1.0; k.To = 0.0;
            k.Duration = new Duration(TimeSpan.FromSeconds(4));
            Mise_a_jour_type.BeginAnimation(OpacityProperty, k);
            k.Completed += new EventHandler(k_completed);
            actualiser();
        }
예제 #4
0
        private void Confirmer_formulaire_Click(object sender, RoutedEventArgs e)
        {
            if (Description.Text != "")
            {
                bool   a = (bool)Remboursable.IsChecked;
                bool   b = (bool)Disponible.IsChecked;
                string c = Description.Text;

                //ajout dans la datagrid

                List <PRET> prets = new List <PRET>();
                Types_Prets.ItemsSource = null;
                prets.Clear();
                foreach (KeyValuePair <int, Type_pret> liste in responsable.liste_types)
                {
                    PRET pret = new PRET();
                    pret.Description = liste.Value.Description;
                    if (liste.Value.Disponibilité == 1)
                    {
                        pret.Disponible = "oui";
                    }
                    else
                    {
                        pret.Disponible = "non";
                    }
                    if (liste.Value.Remboursable == 1)
                    {
                        pret.Remboursable = "oui";
                    }
                    else
                    {
                        pret.Remboursable = "non";
                    }
                    prets.Add(pret);
                }

                PRET nouveauPret = new PRET();
                nouveauPret.Description = c;
                if (b)
                {
                    nouveauPret.Disponible = "oui";
                }
                else
                {
                    nouveauPret.Disponible = "non";
                }
                if (a)
                {
                    nouveauPret.Remboursable = "oui";
                }
                else
                {
                    nouveauPret.Remboursable = "non";
                }
                prets.Add(nouveauPret);
                Types_Prets.ItemsSource = prets;

                int cpt = 1;
                foreach (KeyValuePair <int, Type_pret> liste in responsable.liste_types)
                {
                    if (liste.Value.Type_de_pret >= cpt)
                    {
                        cpt = liste.Value.Type_de_pret + 1;
                    }
                }
                int dispo = 1;
                if (b == false)
                {
                    dispo = 0;
                }
                int remb = 1;
                if (a == false)
                {
                    remb = 0;
                }
                responsable.Creer_Type_pret(cpt, dispo, c, remb);

                Erreur_formulaire.Visibility  = Visibility.Hidden;
                Ajouter_type_label.Visibility = Visibility.Visible;
                DoubleAnimation d = new DoubleAnimation();
                d.From     = 1.0; d.To = 0.0;
                d.Duration = new Duration(TimeSpan.FromSeconds(4));
                Ajouter_type_label.BeginAnimation(OpacityProperty, d);

                d.Completed += new EventHandler(d_completed);
            }
            else
            {
                Erreur_formulaire.Visibility  = Visibility.Visible;
                Ajouter_type_label.Visibility = Visibility.Hidden;
                DoubleAnimation k = new DoubleAnimation();
                k.From     = 1.0; k.To = 0.0;
                k.Duration = new Duration(TimeSpan.FromSeconds(4));
                Erreur_formulaire.BeginAnimation(OpacityProperty, k);
            }
            actualiser();
        }