Exemplo n.º 1
0
        private void ajouterZone_Click(object sender, EventArgs e)
        {
            myDataObject.nomZonePrelevementProperty = Nom.Text;
            Decimal defaultValue = 0.0M; //si la string est abhérente, les lat et long par défaut sont de 0,0
            Decimal result;
            string  decimalValueToParse = Lat1.Text;

            myDataObject.lat1Property  = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Lat2.Text;
            myDataObject.lat2Property  = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Lat3.Text;
            myDataObject.lat3Property  = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Lat4.Text;
            myDataObject.lat4Property  = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Long1.Text;
            myDataObject.long1Property = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Long2.Text;
            myDataObject.long2Property = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Long3.Text;
            myDataObject.long3Property = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;
            decimalValueToParse        = Long4.Text;
            myDataObject.long4Property = Decimal.TryParse(decimalValueToParse, out result) ? result : defaultValue;

            ZonePrelevementViewModel nouveau = new ZonePrelevementViewModel(ZonePrelevementDAL.getMaxIdZonePrelevement() + 1, myDataObject.nomZonePrelevementProperty, myDataObject.lat1Property, myDataObject.lat2Property, myDataObject.lat3Property, myDataObject.lat4Property, myDataObject.long1Property, myDataObject.long2Property, myDataObject.long3Property, myDataObject.long4Property);

            lp.Add(nouveau);
            ZonePrelevementORM.insertZonePrelevement(nouveau);
            listeZonePrelevements.Items.Refresh();
        }
 public static void insertZonePrelevement(ZonePrelevementDAO zp)
 {
     ZonePrelevementDAL.insertZonePrelevement(zp);
 }
 public static void supprimerZonePrelevement(int id)
 {
     ZonePrelevementDAL.supprimerZonePrelevement(id);
 }
 public static void updateZonePrelevement(ZonePrelevementDAO zp)
 {
     ZonePrelevementDAL.updateZonePrelevement(zp);
 }
        public static ZonePrelevementDAO getZonePrelevements(int idZonePrelevement)
        {
            ZonePrelevementDAO p = ZonePrelevementDAL.getZonePrelevement(idZonePrelevement);

            return(p);
        }
        public static ObservableCollection <ZonePrelevementDAO> listeZonePrelevements()
        {
            ObservableCollection <ZonePrelevementDAO> l = ZonePrelevementDAL.selectZonePrelevements();

            return(l);
        }