public bool CheckIfExist(string maPhieuThue) { tbLapPhieuThue pttemp = db.tbLapPhieuThues.Where(x => x.MaPhieuThue == maPhieuThue).FirstOrDefault(); if (pttemp != null) { return(true); } return(false); }
//Nguyễn Lê Ngân Bình //Kiểm tra khách hàng có tồn tại trong lập phiếu thuê hay không? public Boolean kiemTraTonTaiKhachHang(string maKhachHang) { tbLapPhieuThue diaThue = (from n in db.tbLapPhieuThues where n.MaKhachHang.Equals(maKhachHang) select n).FirstOrDefault(); if (diaThue != null) { return(true); } return(false); }
public int LapPhieuThue(eLapPhieuThue NewPhieuThue) { if (CheckIfExist(NewPhieuThue.MaPhieuThue) == true) { return(0); } tbLapPhieuThue pttam = new tbLapPhieuThue(); pttam.MaPhieuThue = NewPhieuThue.MaPhieuThue; pttam.MaKhachHang = NewPhieuThue.MaKhachHang; pttam.NgayThueDia = Convert.ToDateTime(NewPhieuThue.NgayThueDia); pttam.NgayPhaiTra = NewPhieuThue.NgayPhaiTra; pttam.GiaDiaThue = NewPhieuThue.GiaDiaThue; pttam.MaDiaCD = NewPhieuThue.MaDiaCD; db.tbLapPhieuThues.InsertOnSubmit(pttam); db.SubmitChanges(); return(1); }