private void listViewLoaiHoa_ItemSelected(object sender, SelectedItemChangedEventArgs e) { LoaiHoa lh = (LoaiHoa)listViewLoaiHoa.SelectedItem; int Id = lh.MaLoai; Navigation.PushAsync(new HienThiHoa(Id)); }
public ManHinhThemLoai() { InitializeComponent(); //listViewLoaiHoa.ItemsSource = App.db.selectLoaiHoa(); lh = new LoaiHoa(); lh.TenLoai = "DF"; this.BindingContext = lh; }
public ThemLoaiHoa() { InitializeComponent(); listViewLoaiHoa.ItemsSource = App.db.SelectAllLoaiHoa(); lh = new LoaiHoa(); lh.TenLoai = "DF"; this.BindingContext = lh; }
public bool DeleteLoaiHoa(LoaiHoa loaiHoa) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db"))) { connection.Delete(loaiHoa); return(true); } } catch (SQLiteException ex) { return(false); } }
private void btn_themhoa(object sender, EventArgs e) { Hoa hoa = new Hoa(); LoaiHoa loaihoa = (LoaiHoa)pickerLoaiHoa.SelectedItem; hoa.MaLoai = loaihoa.MaLoai; hoa.TenHoa = txtTenHoa.Text.ToString(); hoa.Hinh = pickerHinh.SelectedItem.ToString(); hoa.DonGia = int.Parse(txtGiaBan.Text); hoa.Mota = txtMoTa.Text.ToString(); if (App.db.InsertHoa(hoa)) { DisplayAlert("Notification", "Thêm hoa thành công", "OK"); } else { DisplayAlert("Notification", "Thất bại ...", "OK"); } Clear(); }