コード例 #1
0
        private void addZoneEButton_Click(object sender, EventArgs e)
        {
            selectedEspeceId = (lespèces.ElementAt <EspèceViewModel>(listeEspeces.SelectedIndex)).idEspèceProperty;
            EspèceViewModel espece = ORMEspèce.getEspèce(selectedEspeceId);

            selectedZoneId = (lzonesP.ElementAt <ZonePrelevementViewModel>(listeZones.SelectedIndex)).idZonePrelevementProperty;
            ZonePrelevementViewModel zone = ORMZonePrelevement.getZone(selectedZoneId);

            selectedEtudeId = (letudes.ElementAt <EtudeViewModel>(listeEtudes2.SelectedIndex)).idEtudeProperty;
            EtudeViewModel etude = ORMEtude.getEtude(selectedEtudeId);

            selectedPlageId = (lplages.ElementAt <PlageViewModel>(listePlages2.SelectedIndex)).idPlageProperty;
            PlageViewModel plage = ORMPlage.getPlage(selectedPlageId);

            int nbr = int.Parse(nbrAnimaux.Text);

            zoneEDataObject = new ZoneEspeceViewModel();
            zoneEDataObject.idEspeceProperty          = espece;
            zoneEDataObject.idZonePrelevementProperty = zone;
            zoneEDataObject.idEtudeProperty           = etude;
            zoneEDataObject.idPlageProperty           = plage;
            zoneEDataObject.nombreProperty            = nbr;

            ZoneEspeceViewModel nouvelle = new ZoneEspeceViewModel(DALZoneEspece.getMaxIdZone(), zoneEDataObject.idEspeceProperty, zoneEDataObject.idZonePrelevementProperty, zoneEDataObject.idEtudeProperty, zoneEDataObject.idPlageProperty, zoneEDataObject.nombreProperty);

            ORMZoneEspece.addZone(nouvelle);
        }
コード例 #2
0
ファイル: PlageORM.cs プロジェクト: gongwang/Ifroc-an
        public static PlageViewModel getPlage(int idPlage)
        {
            PlageDAO       pDAO = PlageDAO.getPlage(idPlage);
            PlageViewModel p    = new PlageViewModel(pDAO.idPlageDAO, pDAO.nomPlageDAO, pDAO.superficiePlageDAO, pDAO.idVilleDAO);

            return(p);
        }
コード例 #3
0
 public AfficherPlages()
 {
     InitializeComponent();
     lp = PlageORM.listePlages();
     listePlages.ItemsSource = lp;
     myDataObject            = new PlageViewModel();
 }
コード例 #4
0
        public static PlageViewModel getPlage(int id)
        {
            DAOPlage       daoplage = DAOPlage.getPlage(id);
            PlageViewModel plage    = new PlageViewModel(daoplage.idPlageDAO, daoplage.NomDAO, daoplage.CommuneDAO, daoplage.DépartementDAO, daoplage.SuperficieDAO);

            return(plage);
        }
コード例 #5
0
        private void addZonePButton_Click(object sender, EventArgs e)
        {
            selectedEtudeId = (letudes.ElementAt <EtudeViewModel>(listeEtudeSelect.SelectedIndex)).idEtudeProperty;
            EtudeViewModel etude = ORMEtude.getEtude(selectedEtudeId);

            selectedPlageId = (lplages.ElementAt <PlageViewModel>(listePlageSelect.SelectedIndex)).idPlageProperty;
            PlageViewModel plage = ORMPlage.getPlage(selectedPlageId);

            selectedAdminId = (ladmins.ElementAt <PersonneViewModel>(liste2AdminSelect.SelectedIndex)).idPersonneProperty;
            PersonneViewModel personne = ORMPersonne.getPersonne(selectedAdminId);

            int angle1 = int.Parse(Angle1TextBox.Text);
            int angle2 = int.Parse(Angle2TextBox.Text);
            int angle3 = int.Parse(Angle3TextBox.Text);
            int angle4 = int.Parse(Angle4TextBox.Text);

            zonePDataObject = new ZonePrelevementViewModel();
            zonePDataObject.idEtudeProperty    = etude;
            zonePDataObject.idPlageProperty    = plage;
            zonePDataObject.Angle1Property     = angle1;
            zonePDataObject.Angle2Property     = angle2;
            zonePDataObject.Angle3Property     = angle3;
            zonePDataObject.Angle4Property     = angle4;
            zonePDataObject.idPersonneProperty = personne;

            ZonePrelevementViewModel nouvelle = new ZonePrelevementViewModel(DALZonePrelevement.getMaxIdZone(), zonePDataObject.idEtudeProperty, zonePDataObject.idPlageProperty, zonePDataObject.Angle1Property, zonePDataObject.Angle2Property, zonePDataObject.Angle3Property, zonePDataObject.Angle4Property, zonePDataObject.idPersonneProperty);

            lzonesP.Add(nouvelle);
            ORMZonePrelevement.addZone(nouvelle);
            listeZones2.Items.Refresh();
        }
コード例 #6
0
        private void ajouterButton(object sender, RoutedEventArgs e)
        {
            myDataObject.nomPlageProperty = nomTextBox.Text;

            int defaultValueCommune = 1; //si la string est abhérente, le département par défaut est 1 -> mauvaisNumDépartement
            int resultCommune;

            myDataObject.communePlage = CommuneORM.getCommune(int.TryParse(idCommuneTextBox.Text, out resultCommune) ? resultCommune : defaultValueCommune);

            int.TryParse(nbEspecesDifferentesTextBox.Text, out int resultNbEspeces);
            myDataObject.nbEspecesDifferentesPlageProperty = resultNbEspeces;

            float resultSurface;
            float defaultValueSurface = 0.0F;

            myDataObject.surfacePlageProperty = float.TryParse(surfaceTextBox.Text, out resultSurface) ? resultSurface : defaultValueSurface;

            PlageViewModel nouveau = new PlageViewModel(PlageDAL.getMaxIdPlage() + 1, myDataObject.nomPlageProperty, myDataObject.communePlage, myDataObject.nbEspecesDifferentesPlageProperty, myDataObject.surfacePlageProperty);

            lp.Add(nouveau);
            PlageORM.insertPlage(nouveau);
            listePlages.Items.Refresh();
            compteur     = lp.Count();
            myDataObject = new PlageViewModel(PlageDAL.getMaxIdPlage() + 1, "", myDataObject.communePlage, myDataObject.nbEspecesDifferentesPlageProperty, myDataObject.surfacePlageProperty);
        }
コード例 #7
0
        private void supprimerButton(object sender, RoutedEventArgs e)
        {
            PlageViewModel toRemove = (PlageViewModel)listePlages.SelectedItem;

            lp.Remove(toRemove);
            listePlages.Items.Refresh();
            PlageORM.supprimerPlage(selectedPlageId);
        }
コード例 #8
0
        public static PlageViewModel getPlage(int idPlage)
        {
            PlageDAO pDAO = PlageDAO.getPlage(idPlage);
            //int idMetier = pDAO.idMetierPersonneDAO;
            //MetierViewModel m = MetierORM.getMetier(idMetier);
            PlageViewModel p = new PlageViewModel(pDAO.id, pDAO.nom, pDAO.departement, pDAO.commune, pDAO.superficie, pDAO.coord1long, pDAO.coord1larg, pDAO.coord2long, pDAO.coord2larg, pDAO.coord3long, pDAO.coord3larg, pDAO.coord4long, pDAO.coord4larg);

            return(p);
        }
コード例 #9
0
        public static PlageViewModel getPlage(int idPlage)
        {
            PlageDAO         pDAO      = PlageDAO.getPlage(idPlage);
            int              idCommune = pDAO.idCommunePlageDAO;
            CommuneViewModel m         = CommuneORM.getCommune(idCommune);
            PlageViewModel   p         = new PlageViewModel(pDAO.idPlageDAO, pDAO.nomPlageDAO, m, pDAO.nbEspecesDifferentesPlageDAO, pDAO.surfacePlageDAO);

            return(p);
        }
コード例 #10
0
        public static EtudeViewModel getEtude(int idEtude)
        {
            EtudeDAO       pDAO    = EtudeDAO.getEtude(idEtude);
            int            idPlage = pDAO.PlageEtudeDAO;
            PlageViewModel m       = PlageORM.getPlage(idPlage);
            EtudeViewModel p       = new EtudeViewModel(pDAO.idEtudeDAO, pDAO.NbPersonneEtudeDAO, pDAO.TitreEtudeEtudeDAO, m, pDAO.dateCreationDAO, pDAO.dateFinDAO);

            return(p);
        }
コード例 #11
0
        private void supprimerButton_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            PlageViewModel toRemove = (PlageViewModel)listePlages.SelectedItem;

            lp1.Remove(toRemove);
            listePlages.Items.Refresh();
            PlageORM.supprimerPlage(selectedPlagesId);
            MessageBox.Show("Plage supprimée avec succes ! ");
        }
コード例 #12
0
ファイル: PlageORM.cs プロジェクト: romaingrimault/Ifrocean
        public static PlageViewModel getPlage(int idPlage)
        {
            PlageDAO         pDAO = PlageDAO.getPlage(idPlage);
            int              id   = pDAO.idCommunePlageDAO;
            CommuneViewModel m    = CommuneORM.getCommune(id);
            PlageViewModel   p    = new PlageViewModel(pDAO.idPlageDAO, pDAO.nomPlageDAO, m);

            return(p);
        }
コード例 #13
0
 public EspeceNombreViewModel(int IdNombreE, ZoneInvestigationViewModel IdZone, EspeceViewModel idEspece, PlageViewModel idPlage, EtudeViewModel idEtude, Decimal Nombre)
 {
     this.IdNombreE = IdNombreE;
     this.IdZone    = IdZone;
     this.IdEtude   = idEtude;
     this.IdPlage   = idPlage;
     this.IdEspece  = idEspece;
     this.Nombre    = Nombre;
 }
コード例 #14
0
        public static PlageViewModel getPlage(int idPlage)
        {
            PlageDAO pDAO      = PlageDAO.getPlages(idPlage);
            int      idCommune = pDAO.idCommuneDAO;

            CommuneViewModel m = CommuneORM.getCommune(idCommune); // Plus propre que d'aller chercher la commune dans la DAO.
            PlageViewModel   u = new PlageViewModel(pDAO.idPlageDAO, pDAO.nomPlageDAO, m, pDAO.nbEspecesDifferentesDAO, pDAO.surfaceDAO);

            return(u);
        }
コード例 #15
0
        public static ObservableCollection <PlageViewModel> listePlages()
        {
            ObservableCollection <DAOPlage>       listeDAO    = DAOPlage.listePlages();
            ObservableCollection <PlageViewModel> listePlages = new ObservableCollection <PlageViewModel>();

            foreach (DAOPlage item in listeDAO)
            {
                PlageViewModel plage = new PlageViewModel(item.idPlageDAO, item.NomDAO, item.CommuneDAO, item.DépartementDAO, item.SuperficieDAO);
                listePlages.Add(plage);
            }
            return(listePlages);
        }
コード例 #16
0
ファイル: PlageORM.cs プロジェクト: gongwang/Ifroc-an
        public static ObservableCollection <PlageViewModel> listePlages()
        {
            ObservableCollection <PlageDAO>       lDAO = PlageDAO.listePlages();
            ObservableCollection <PlageViewModel> l    = new ObservableCollection <PlageViewModel>();

            foreach (PlageDAO element in lDAO)
            {
                PlageViewModel p = new PlageViewModel(element.idPlageDAO, element.nomPlageDAO, element.superficiePlageDAO, element.idVilleDAO);
                l.Add(p);
            }
            return(l);
        }
コード例 #17
0
        public static ZoneEtudeViewModel getZoneEtude(int idZoneEtude)
        {
            ZoneEtudeDAO       pDAO       = ZoneEtudeDAO.getZoneEtude(idZoneEtude);
            int                idPersonne = pDAO.idPersonneDAO;
            PersonneViewModel  personne   = PersonenORM.getPersonne(2);
            int                idEtude    = pDAO.idEtudeDAO;
            EtudeViewModel     etude      = EtudeORM.getEtude(idEtude);
            int                idPlage    = pDAO.idPlageDAO;
            PlageViewModel     plage      = PlageORM.getPlage(idPlage);
            ZoneEtudeViewModel p          = new ZoneEtudeViewModel(pDAO.dateEtudeDAO, pDAO.CoordonnéeADAO, pDAO.CoordonnéeBDAO, pDAO.CoordonnéeCDAO, pDAO.CoordonnéeDDAO, pDAO.superficieZoneEtudeDAO, pDAO.idZoneEtudeDAO, personne, etude, plage);

            return(p);
        }
コード例 #18
0
        private void AjoutPlage_Click_1(object sender, EventArgs e)
        {
            myDataObject5 = new PlageViewModel();
            myDataObject5.nomPlageProperty = nomPlage.Text;
            var            list    = (CommuneViewModel)listeCommune.SelectedItem;
            PlageViewModel nouveau = new PlageViewModel(0, myDataObject5.nomPlageProperty, new CommuneViewModel(list.idCommuneProperty, "", "", null));

            lp5.Add(nouveau);
            PlageORM.insertPlage(nouveau);
            lp5                      = PlageORM.listePlage();
            nomPlage.Text            = string.Empty;
            listeCommune.ItemsSource = null;
        }
コード例 #19
0
        ////////////////////////////////////////////////////////////////////////////////



        /////////////// Plage////////////////////////////////////////////////////////

        private void ajouterPlageButton_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            myDataObject_Plage = new PlageViewModel();

            myDataObject_Plage.nomProperty = nomPlageTextBox.Text;
            //  myDataObject_Plage.TypeProperty = TypeTextBox.Text;
            PlageViewModel nouveau = new PlageViewModel(PlageDAL.getMaxIdPlage() + 1, myDataObject_Plage.nomProperty, new CommuneViewModel(1, "", ""), new PrelevementViewModel(1, "", ""), new DepartementViewModel(1, "boulanger"));

            lp_Pl.Add(nouveau);
            PlageDAO.insertPlage(nouveau);
            listePlages.Items.Refresh();
            compteur           = lp_Pl.Count();
            myDataObject_Plage = new PlageViewModel(PlageDAL.getMaxIdPlage() + 1, "", new CommuneViewModel(1, "", ""), new PrelevementViewModel(1, "", ""), new DepartementViewModel(1, "boulanger"));
        }
コード例 #20
0
        public static EspeceHasPlageViewModel getEspeceHasPlage(int idEspece, int idPlage)
        {
            EspeceHasPlageDAO eDAO = EspeceHasPlageDAO.getEspeceHasPlage(idEspece, idPlage);

            int             Espece_idEspece = eDAO.Espece_idEspeceDAO;
            EspeceViewModel e = EspeceORM.getEspece(Espece_idEspece);

            int            Plage_idPlage = eDAO.Plage_idPlageDAO;
            PlageViewModel p             = PlageORM.getPlage(Plage_idPlage);

            EspeceHasPlageViewModel ep = new EspeceHasPlageViewModel(e, p, eDAO.densiteDAO, eDAO.populationTotaleDAO);

            return(ep);
        }
コード例 #21
0
        public static ObservableCollection <EtudeViewModel> ListeEtude()
        {
            ObservableCollection <EtudeDAO>       lDAO = EtudeDAO.listeEtudes();
            ObservableCollection <EtudeViewModel> l    = new ObservableCollection <EtudeViewModel>();

            foreach (EtudeDAO element in lDAO)
            {
                int            idPlage = element.PlageEtudeDAO;
                PlageViewModel m       = PlageORM.getPlage(idPlage);
                EtudeViewModel p       = new EtudeViewModel(element.idEtudeDAO, element.NbPersonneEtudeDAO, element.TitreEtudeEtudeDAO, m, element.dateCreationDAO, element.dateFinDAO);
                l.Add(p);
            }
            return(l);
        }
コード例 #22
0
        private void AjoutZone_Click_1(object sender, EventArgs e)
        {
            try
            {
                Regex coordonne = new Regex(@"^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$");
                if (!coordonne.Match(CoordonneATextBox.Text).Success)
                {
                    throw new CoordonneInvalidExeption("Coordonnée A invalide");
                }
                if (!coordonne.Match(CoordonneBTextBox.Text).Success)
                {
                    throw new CoordonneInvalidExeption("Coordonnée B invalide");
                }
                if (!coordonne.Match(CoordonneCTextBox.Text).Success)
                {
                    throw new CoordonneInvalidExeption("Coordonnée C invalide");
                }
                if (!coordonne.Match(CoordonneDTextBox.Text).Success)
                {
                    throw new CoordonneInvalidExeption("Coordonnée D invalide");
                }
                string pointA = coordonnee(CoordonneATextBox.Text);
                string pointB = coordonnee(CoordonneBTextBox.Text);
                string pointC = coordonnee(CoordonneCTextBox.Text);
                string pointD = coordonnee(CoordonneDTextBox.Text);

                myDataObject7 = new ZoneEtudeViewModel();
                EtudeViewModel etude = (EtudeViewModel)listeEtude.SelectedItem;
                PlageViewModel plage = (PlageViewModel)listePlage.SelectedItem;

                int idZone = ZoneEtudeORM.getMaxIdZone(etude, plage);
                idZone += 1;
                PersonneViewModel personne = new PersonneViewModel(2, "", "", "", "", "", 0);

                ZoneEtudeViewModel nouveau = new ZoneEtudeViewModel(DateTime.Now, pointA, pointB, pointC, pointD, 10, idZone, personne, etude, plage);
                lp7.Add(nouveau);
                ZoneEtudeORM.insertZoneEtude(nouveau);
                lp7 = ZoneEtudeORM.listeZoneEtude();
            }
            catch (CoordonneInvalidExeption coordExpte)
            {
                MessageBox.Show(coordExpte.Message);
            }
            CoordonneATextBox.Text = string.Empty;
            CoordonneBTextBox.Text = string.Empty;
            CoordonneCTextBox.Text = string.Empty;
            CoordonneDTextBox.Text = string.Empty;
            listeEtude.Items.Refresh();
            listePlage.Items.Refresh();
        }
コード例 #23
0
        private void plageButton_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            myDataObject2 = new PlageViewModel();
            myDataObject2.nomPlageProperty        = nompTextBox.Text;
            myDataObject2.superficiePlageProperty = superficieTextBox.Text;
            myDataObject2.villeProperty           = idvilleTextBox.Text;
            PlageViewModel nouveau = new PlageViewModel(PlageDAL.getMaxIdPlage() + 1, myDataObject2.nomPlageProperty, myDataObject2.superficiePlageProperty, myDataObject2.villeProperty);

            pl.Add(nouveau);
            PlageORM.insertPlage(nouveau);
            listePlages.Items.Refresh();
            compteur      = pl.Count();
            myDataObject2 = new PlageViewModel(PlageDAL.getMaxIdPlage() + 1, "", "", "");
        }
コード例 #24
0
ファイル: PlageORM.cs プロジェクト: romaingrimault/Ifrocean
        public static ObservableCollection <PlageViewModel> listePlageParCommune(CommuneViewModel commune)
        {
            ObservableCollection <PlageDAO>       lDAO = PlageDAO.listePlageParCommune(commune.idCommuneProperty);
            ObservableCollection <PlageViewModel> l    = new ObservableCollection <PlageViewModel>();

            foreach (PlageDAO element in lDAO)
            {
                int id = element.idCommunePlageDAO;

                PlageViewModel p = new PlageViewModel(element.idPlageDAO, element.nomPlageDAO, commune);
                l.Add(p);
            }
            return(l);
        }
コード例 #25
0
ファイル: PlageORM.cs プロジェクト: romaingrimault/Ifrocean
        public static ObservableCollection <PlageViewModel> listePlage()
        {
            ObservableCollection <PlageDAO>       lDAO = PlageDAO.listePlage();
            ObservableCollection <PlageViewModel> l    = new ObservableCollection <PlageViewModel>();

            foreach (PlageDAO element in lDAO)
            {
                int id             = element.idCommunePlageDAO;
                CommuneViewModel m = CommuneORM.getCommune(id);
                PlageViewModel   p = new PlageViewModel(element.idPlageDAO, element.nomPlageDAO, m);
                l.Add(p);
            }
            return(l);
        }
コード例 #26
0
        public static ObservableCollection <PlageViewModel> listePlages()
        {
            ObservableCollection <PlageDAO>       lDAO = PlageDAO.listePlages();
            ObservableCollection <PlageViewModel> l    = new ObservableCollection <PlageViewModel>();

            foreach (PlageDAO element in lDAO)
            {
                //int idMetier = element.idMetierPersonneDAO;
                //MetierDAO m = MetierDAO.getMetier(idMetier);
                //MetierViewModel metier = new MetierViewModel(m.idMetierDAO, m.libMetierDAO);
                PlageViewModel p = new PlageViewModel(element.id, element.nom, element.departement, element.commune, element.superficie, element.coord1long, element.coord1larg, element.coord2long, element.coord2larg, element.coord3long, element.coord3larg, element.coord4long, element.coord4larg);
                l.Add(p);
            }
            return(l);
        }
コード例 #27
0
        public static ObservableCollection <PlageViewModel> listePlages()
        {
            ObservableCollection <PlageDAO>       lDAO = PlageDAO.listePlages();
            ObservableCollection <PlageViewModel> l    = new ObservableCollection <PlageViewModel>();

            foreach (PlageDAO element in lDAO)
            {
                int idCommune = element.idCommuneDAO;

                CommuneViewModel m = CommuneORM.getCommune(idCommune); // Plus propre que d'aller chercher la commune dans la DAO.
                PlageViewModel   u = new PlageViewModel(element.idPlageDAO, element.nomPlageDAO, m, element.nbEspecesDifferentesDAO, element.surfaceDAO);
                l.Add(u);
            }
            return(l);
        }
コード例 #28
0
        public static PlageViewModel getPlage(int idPlage)
        {
            PlageDAO pDAO          = PlageDAO.getPlage(idPlage);
            int      idPrelevement = pDAO.prelevement_idprelevementDAO;
            int      idVille       = pDAO.Ville_idVilleDAO;
            int      iDepartement  = pDAO.Departement_idDepartementDAO;

            PrelevementViewModel pr = PrelevementORM.getPrelevement(idPrelevement);
            CommuneViewModel     c  = CommuneORM.getCommune(idVille);
            DepartementViewModel d  = DepartementORM.getDepartement(iDepartement);

            PlageViewModel p = new PlageViewModel(pDAO.idPlageDAO, pDAO.nomDAO, c, pr, d);

            return(p);
        }
コード例 #29
0
        public static ZonePrelevementViewModel getZone(int id)
        {
            DAOZonePrelevement daozone = DAOZonePrelevement.getZone(id);
            int idEtude    = daozone.idEtudeDAO;
            int idPlage    = daozone.idPlageDAO;
            int idPersonne = daozone.idPersonneDAO;

            EtudeViewModel    etude    = ORMEtude.getEtude(idEtude);
            PlageViewModel    plage    = ORMPlage.getPlage(idPlage);
            PersonneViewModel personne = ORMPersonne.getPersonne(idPersonne);

            ZonePrelevementViewModel zone = new ZonePrelevementViewModel(daozone.idZoneDAO, etude, plage, daozone.Angle1DAO, daozone.Angle2DAO, daozone.Angle3DAO, daozone.Angle4DAO, personne);

            return(zone);
        }
コード例 #30
0
        private void addPlageButton_Click(object sender, EventArgs e)
        {
            int superficie = int.Parse(superficieTextBox.Text);

            plageDataObject = new PlageViewModel();
            plageDataObject.nomPlageProperty    = nomPlageTextBox.Text;
            plageDataObject.communeProperty     = communeTextBox.Text;
            plageDataObject.départementProperty = departementTextBox.Text;
            plageDataObject.superficieProperty  = superficie;

            PlageViewModel nouvelle = new PlageViewModel(DALPlage.getMaxIdlage(), plageDataObject.nomPlageProperty, plageDataObject.communeProperty, plageDataObject.départementProperty, plageDataObject.superficieProperty);

            lplages.Add(nouvelle);
            ORMPlage.addPlage(nouvelle);
            listePlages.Items.Refresh();
        }