Exemplo n.º 1
0
        private void OnInsertPlant(object sender, EventArgs e)
        {
            Plant currentPlant = (Plant)sender;

            model.insertPlant(currentPlant);
        }
Exemplo n.º 2
0
        private void OnUpdatePlant(object sender, EventArgs e)
        {
            Plant currentPlant = (Plant)sender;

            model.updatePlant(currentPlant);
        }
Exemplo n.º 3
0
 public void deletePlant(Plant tmp)
 {
     DB.getInstance().executeNonQuery(String.Format("delete from plants where id='{0}'", tmp.shortName));
 }
Exemplo n.º 4
0
 public void updatePlant(Plant currentPlant)
 {
     try
     {
         string query = String.Format(@"update plants set id='{0}', full_name='{1}', typeName='{2}' where id='{3}'", currentPlant.shortName, currentPlant.fullName, currentPlant.idType, currentPlant.oldShortName);
         DB.getInstance().executeNonQuery(query);
     }
     catch (Exception ex) {
         MessageBox.Show("Помилка зміни даних! Введено некоректні дані. \n" + ex.Message);
     }
 }
Exemplo n.º 5
0
 public void insertPlant(Plant insertedPlant)
 {
     try
     {
         string query = String.Format("insert into plants (id,full_name,typeName) values ('{0}','{1}','{2}')", insertedPlant.shortName, insertedPlant.fullName, insertedPlant.idType);
         DB.getInstance().executeNonQuery(query);
     }
     catch (Exception ex) {
         MessageBox.Show("Помилка додавання станції в базу даних! ВВедено некоректні дані. \n" + ex.Message);
     }
 }
Exemplo n.º 6
0
 public void deletePlant(Plant tmp)
 {
     DB.getInstance().executeNonQuery(String.Format("delete from plants where id='{0}'", tmp.shortName));
 }