Beispiel #1
0
 public LoaihoaViewModel()
 {
     loaihoaRepository = new LoaihoaRepository();
     LoadLoaihoa();
     AddLoaiHoa    = new Command(Insert);
     UpdateLoaiHoa = new Command(Update, CanExe);
     DeleteLoaiHoa = new Command(Delete, CanExe);
     loaihoa       = new Loaihoa();
 }
 public ThemHoaViewMode()
 {
     loaihoaRepository = new LoaihoaRepository();
     hoaRepository     = new HoaRepository();
     loaihoas          = loaihoaRepository.GetLoaihoas();
     dshoa             = hoaRepository.GetHoas();
     loaihoa           = new Loaihoa();
     hoa    = new Hoa();
     AddHoa = new Command(InsertHoa);
 }
Beispiel #3
0
 public bool DeleteLoaihoa(Loaihoa h)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
         {
             connection.Delete(h);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         return(false);
     }
 }
Beispiel #4
0
 public bool UpdateLoaihoa(Loaihoa lh)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder)))
         {
             connection.Update(lh);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         return(false);
     }
 }
Beispiel #5
0
 public bool InsertLoaihoa(Loaihoa lh)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
         {
             connection.Insert(lh);
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
        private void cmdGhi_Clicked(Object sender, EventArgs e)
        {
            HoaDatabase db = new HoaDatabase();
            Loaihoa     l  = new Loaihoa {
                Tenloai = txtTenLoai.Text
            };

            if (db.InsertLoaiHoa(l) == true)
            {
                DisplayAlert("Thông báo", "Thêm loại hoa thành công", "OK");
            }
            else
            {
                DisplayAlert("Thông báo", "Thêm hoa bị lỗi", "OK");
            }
        }
Beispiel #7
0
 public bool UpdateLoaihoa(Loaihoa h)
 {
     try
     {
         using (var connection = new
                                 SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
         {
             connection.Update(h);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         //   Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }
Beispiel #8
0
        public bool InsertLoaiHoa(Loaihoa loai)
        {
            try
            {
                //using (var connection = new
                //    SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
                //{
                //    connection.Insert(loai);
                //    return true;
                //}

                using (var connection = new
                                        SQLiteConnection(System.IO.Path.Combine(folder, "qlhoa.db")))
                {
                    connection.Insert(loai);
                    return(true);
                }
            }
            catch (SQLiteException ex)
            {
                //   Log.Info("SQLiteEx", ex.Message);
                return(false);
            }
        }
 public bool Insert(Loaihoa lh)
 {
     return db.InsertLoaihoa(lh);
 }
 public bool Update(Loaihoa loaihoa)
 {
     return(db.UpdateLoaihoa(loaihoa));
 }
 public bool Delete(Loaihoa loaihoa)
 {
     return(db.DeleteLoaihoa(loaihoa));
 }
 public bool Insert(Loaihoa loaihoa)
 {
     return(db.InsertLoaihoa(loaihoa));
 }
        public bool Delete(Loaihoa lh)
        {
            return db.DeleteLoaihoa(lh);

        }
        public bool Update(Loaihoa lh)
        {
            return db.UpdateLoaihoa(lh);

        }
Beispiel #15
0
 public bool Delete(Loaihoa h)
 {
     return(db.DeleteLoaihoa(h));
 }
Beispiel #16
0
 public bool Update(Loaihoa h)
 {
     return(db.UpdateLoaihoa(h));
 }
Beispiel #17
0
 public bool Insert(Loaihoa h)
 {
     return(db.InserLoaihoa(h));
 }