public static void UpdatePhieuMua(PhieuMuaModel PhieuMua) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("update PhieuMua set NGAYLAP=@NgayLap,MANCC=@MaNCC, GHICHU = @GhiChu, THANHTIEN = @ThanhTien WHERE MAPHIEU = @maPhieu", PhieuMua); } }
public static void RemovePhieuMua(PhieuMuaModel PhieuMua) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { cnn.Execute("DELETE FROM PhieuMua WHERE MAPHIEU = @maPhieu", PhieuMua); } }
public static long SavePhieuMua(PhieuMuaModel PhieuMua) { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { long lastRowID = (long)cnn.ExecuteScalar("insert into PhieuMua(MAPHIEU,NGAYLAP,MANCC,GHICHU) values (@MaPhieu,@NgayLap,@MaNCC, @GhiChu); SELECT last_insert_rowid()", PhieuMua); //lastRowID dùng để xác định ID của một hàng vừa được thêm vào. return(lastRowID); } }