public static void UpdatePhieuBan(PhieuBanModel phieuBan) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("update PhieuBan set NGAYLAP=@NgayLap,MAKH=@MaKH,CHIETKHAU = @ChietKhau, THUE = @Thue, THANHTIEN = @ThanhTien, GHICHU = @GhiChu WHERE MAPHIEU = @maPhieu", phieuBan); } }
public static void RemovePhieuBan(PhieuBanModel phieuBan) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("DELETE FROM PhieuBan WHERE MAPHIEU = @maPhieu", phieuBan); } }
public static long SavePhieuBan(PhieuBanModel phieuBan) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { long lastRowID = (long)cnn.ExecuteScalar("insert into PhieuBan(MAPHIEU,NGAYLAP,MAKH,CHIETKHAU, THUE, THANHTIEN, GHICHU) values (@MaPhieu,@NgayLap,@MaKH,@ChietKhau, @Thue, @ThanhTien, @GhiChu); SELECT last_insert_rowid()", phieuBan); //lastRowID dùng để xác định ID của một hàng vừa được thêm vào. return(lastRowID); } }