Exemplo n.º 1
0
 // Insert kind of flower
 public bool InsertLoaihoa(LoaiHoa loai)
 {
     try
     {
         using (var connection = new
                                 SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
         {
             connection.Insert(loai);
             return(true);
         }
     }
     catch (SQLiteException)
     {
         return(false);
     }
 }
        private void CmdGhi_Clicked(object sender, EventArgs e)
        {
            database db = new database();
            LoaiHoa  lh = new LoaiHoa {
                TenLoai = txtTenLoai.Text
            };

            if (db.InsertLoaihoa(lh) == true)
            {
                DisplayAlert("Thông Báo", "Thêm loại hoa thành công", "OK");
            }
            else
            {
                DisplayAlert("Thông Báo", "Thêm loại hoa Lỗi", "OK");
            }
        }
        private void Lstdsloaihoa_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            LoaiHoa lh = (LoaiHoa)e.SelectedItem;

            Navigation.PushAsync(new PageListFlower(lh.MaLoai));
        }