Пример #1
0
 public bool Inserthoa(Hoa Hoa)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
         {
             connection.Insert(Hoa);
             return(true);
         }
     }
     catch (SQLiteException)
     {
         return(false);
     }
 }
Пример #2
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            Database db  = new Database();
            Hoa      Hoa = new Hoa
            {
                Maloai = mySelectedFlower.Maloai,
                Tenhoa = txttenhoa.Text,
                Hinh   = txthinh.Text,
                Mota   = txtmota.Text,
                Gia    = Convert.ToInt32(txtgia.Text),
            };

            if (db.Inserthoa(Hoa))
            {
                DisplayAlert("Notice", "Add Flower Successful!", "OK");
            }
            else
            {
                DisplayAlert("Notice", "Add Flower Failed!", "OK");
            }
        }