private void ajouterEtude_Click(object sender, EventArgs e)
        {
            myDataObject.titreEtudeProperty = Titre.Text;
            if ((EquipeViewModel)listeEquipeCombo.SelectedItem != null)
            {
                myDataObject.equipeEtude = (EquipeViewModel)listeEquipeCombo.SelectedItem;
            }
            else
            {
                myDataObject.equipeEtude = new EquipeViewModel(1, "MauvaisNumeroEquipe", 0);
            }
            //////////////////////////////////////////////////nombre especes
            string valueToParse = nbEspeces.Text;
            int    result;
            int    defaultValue = 0;

            myDataObject.nbTotalEspeceRencontreeEtudeProperty = int.TryParse(valueToParse, out result) ? result : defaultValue;
            //////////////////////////////////////////////////date
            string   valueToParse2 = Date.Text;
            DateTime result2;
            DateTime defaultValue2 = DateTime.Now;

            myDataObject.dateEtudeProperty = DateTime.TryParse(valueToParse2, out result2) ? result2 : defaultValue2;
            //////////////////////////////////////////////////insert
            EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject.dateEtudeProperty, myDataObject.titreEtudeProperty, myDataObject.nbTotalEspeceRencontreeEtudeProperty, myDataObject.equipeEtudeProperty);

            lu.Add(nouveau);
            EtudeORM.insertEtude(nouveau);
            listeEquipeCombo.ItemsSource = lp;
            listeEtudes.Items.Refresh();
            listeEquipeCombo.Items.Refresh();
            listeEtudes.ItemsSource = lu;
        }
Beispiel #2
0
        ////////////////////////////////////////////////////////////////////////////////

        /////////////// Etude////////////////////////////////////////////////////////

        private void ajouterEtudeButton_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            myDataObject_Etude = new EtudeViewModel();
            myDataObject_Etude.DateProperty = Date_etudeTextBox.Text;
            myDataObject_Etude.SuperficieEtudierProperty = Super_etudeTextBox.Text;
            EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject_Etude.DateProperty, myDataObject_Etude.SuperficieEtudierProperty);

            lp_Et.Add(nouveau);
            EtudeORM.insertEtude(nouveau);
            listeEtude.Items.Refresh();
            compteur           = lp_Et.Count();
            myDataObject_Etude = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, "", "");
        }
Beispiel #3
0
        private void etudeButton_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            myDataObject3 = new EtudeViewModel();
            myDataObject3.nomEtudeProperty   = nomeTextBox.Text;
            myDataObject3.dateEtudeProperty  = dateDatePicker.DisplayDate;
            myDataObject3.nbPersonneProperty = nbpersTextBox.Text;
            myDataObject3.idPersonneProperty = Convert.ToInt32(idpersTextBox.Text);
            EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject3.nomEtudeProperty, myDataObject3.dateEtudeProperty, myDataObject3.nbPersonneProperty, myDataObject3.idPersonneProperty);

            et.Add(nouveau);
            EtudeORM.insertEtude(nouveau);
            listeEtudes.Items.Refresh();
            compteur      = et.Count();
            myDataObject3 = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, "", myDataObject3.dateEtudeProperty, "", myDataObject3.idPersonneProperty);
        }
        /////////////////////////////////////    Etudes    /////////////////////////////////////
        /////////////////////////////////////    Etudes    /////////////////////////////////////
        ///
        private void ValideEtude_Click(object sender, RoutedEventArgs e)
        {
            myDataObject4 = new EtudeViewModel();
            myDataObject4.NbPersonneEtudeProperty = Convert.ToDecimal(NbPersonne.SelectionBoxItem);
            myDataObject4.dateCreationProperty    = Convert.ToDateTime(dateCreationDatePicker.SelectedDate);
            myDataObject4.dateFinProperty         = Convert.ToDateTime(dateFinDatePicker1.SelectedDate);
            myDataObject4.PlageEtude         = (PlageViewModel)listePlagesCombo.SelectedItem;
            myDataObject4.TitreEtudeProperty = Titre.Text;

            EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject4.NbPersonneEtudeProperty, myDataObject4.TitreEtudeProperty, myDataObject4.PlageEtudeProperty, myDataObject4.dateCreationProperty, myDataObject4.dateFinProperty);

            lp4.Add(nouveau);
            EtudeORM.insertEtude(nouveau);
            compteur = lp4.Count();

            listeEtudes.ItemsSource = lp4;

            ((TextBox)Titre).Text = string.Empty;

            MessageBox.Show("Etude ajoutée avec succes ! ");
        }
        private void ajouterButton(object sender, RoutedEventArgs e)
        {
            myDataObject.dateEtudeProperty = (DateTime)dateTextBox.SelectedDate;
            //DateTime defaultValDate = DateTime.Now;
            //myDataObject.dateEtudeProperty = DateTime.TryParse(, out DateTime resultDate) ? resultDate : defaultValDate;


            myDataObject.titreEtudeProperty = titreTextBox.Text;

            int.TryParse(nbTotalEspeceRencontreeTextBox.Text, out int resultNbEspece);
            myDataObject.nbTotalEspeceRencontreeEtudeProperty = resultNbEspece;

            //int defaultValEquipe = 1; //si mauvaise valeur -> équipe 1 par default
            myDataObject.equipeEtude = (EquipeViewModel)idEquipeTextBox.SelectedItem;

            EtudeViewModel nouveau = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject.dateEtudeProperty, myDataObject.titreEtudeProperty, myDataObject.nbTotalEspeceRencontreeEtudeProperty, myDataObject.equipeEtudeProperty);

            lp.Add(nouveau);
            EtudeORM.insertEtude(nouveau);
            listeEtudes.Items.Refresh();
            myDataObject = new EtudeViewModel(EtudeDAL.getMaxIdEtude() + 1, myDataObject.dateEtudeProperty, "", myDataObject.nbTotalEspeceRencontreeEtudeProperty, myDataObject.equipeEtudeProperty);
        }
        private void AjouterEtude_Click_1(object sender, EventArgs e)
        {
            myDataObject2 = new EtudeViewModel();
            myDataObject2.nomEtudeProperty = nomEtudeTextBox.Text;

            myDataObject6 = new PlageDeEtudeViewModel();

            EtudeViewModel nouveau = new EtudeViewModel(0, myDataObject2.nomEtudeProperty);

            lp2.Add(nouveau);
            EtudeORM.insertEtude(nouveau);
            lp2 = EtudeORM.listeEtude();
            EtudeViewModel newEtude = EtudeORM.listeEtude().Last();

            foreach (PlageViewModel plage in lp5)
            {
                if (plage.isChekedProperty)
                {
                    PlageDeEtudeViewModel ajoutNouveau = new PlageDeEtudeViewModel(newEtude, plage);
                    PlageDeEtudeORM.insertPlageDeEtude(ajoutNouveau);
                }
            }
            nomEtudeTextBox.Text = string.Empty;
        }