예제 #1
0
 public bool DeleteHoa(Hoa h)
 {
     try
     {
         using (var connection = new
                                 SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
         {
             connection.Delete(h);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         //   Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }
        private void Cmdthem_Clicked(object sender, EventArgs e)
        {
            database db = new database();
            Hoa      l  = new Hoa {
                Mahoa  = picdsloai.SelectedIndex + 1,
                Tenhoa = txttenhoa.Text,
                Hinh   = txthinh.Text,
                Mota   = txtmota.Text,
                Gia    = double.Parse(txtgia.Text)
            };

            if (db.InsertHoa(l) == true)
            {
                DisplayAlert("Thông Báo", "Thêm hoa thành công", "OK");
            }
            else
            {
                DisplayAlert("Thông Báo", "Thêm hoa Lỗi", "OK");
            }
        }