public static int AddPhieuThu(int nguoiDung, int khuVuc) { using (var db = new DB()) { // ---- Tạo mới một đối tượng phiếu thu var phieuThu = new DAL.PhieuThu() { NguoiDung = nguoiDung, KhuVuc = khuVuc, // ---- Lấy thời gian hiện tại ThoiGian = DateTime.Now, // ---- Tổng tiền ban đầu bằng 0 khi thêm chi tiết sẽ tự cập nhật TongTien = 0, // ---- Tiền nhận cập nhật khi thanh toán phiếu thu TienNhan = 0, SoNguoi = 1, ThanhToan = false, }; // ---- Thêm phiếu thu vào cơ sở dữ liệu db.PhieuThus.InsertOnSubmit(phieuThu); // ---- Cập nhật thay đổi db.SubmitChanges(); // ---- Trả về PhieuThuID mới thêm vào return phieuThu.PhieuThuID; } }
private void detach_PhieuThus(PhieuThu entity) { this.SendPropertyChanging(); entity.NguoiDung1 = null; }
private void detach_PhieuThus(PhieuThu entity) { this.SendPropertyChanging(); entity.KhuVuc1 = null; }
private void attach_PhieuThus(PhieuThu entity) { this.SendPropertyChanging(); entity.KhuVuc1 = this; }
partial void DeletePhieuThu(PhieuThu instance);
partial void UpdatePhieuThu(PhieuThu instance);
partial void InsertPhieuThu(PhieuThu instance);