//Sửa chi tiết thuê phòng public int updateChiTietThuePhong(ChiTietThuePhongDTO cttpDTO) { try { var querry = (from cttp in htDataContext.chitietthuephongs where cttp.maphieuthue == cttpDTO.Maphieuthue && cttp.maphong == cttpDTO.Maphong && cttp.ngay == cttpDTO.Ngay && cttp.madichvu == cttpDTO.Madichvu select cttp).FirstOrDefault <chitietthuephong>(); querry.soluong = cttpDTO.Soluong; htDataContext.SubmitChanges(); return(1); } catch { return(0); } }
//Thêm chi tiết thuê phòng public int insertChiTietThuePhong(ChiTietThuePhongDTO cttpDTO) { try { chitietthuephong cttp = new chitietthuephong(); cttp.maphieuthue = cttpDTO.Maphieuthue; cttp.maphong = cttpDTO.Maphong; cttp.ngay = (DateTime)cttpDTO.Ngay; cttp.madichvu = cttpDTO.Madichvu; cttp.soluong = (int)cttpDTO.Soluong; htDataContext.chitietthuephongs.InsertOnSubmit(cttp); htDataContext.SubmitChanges(); return(1); } catch { return(0); } }
public int updateChiTietThuePhong(ChiTietThuePhongDTO cttpDTO) { try { var querry = (from cttp in htDataContext.chitietthuephongs where cttp.maphieuthue == cttpDTO.Maphieuthue && cttp.maphong == cttpDTO.Maphong && cttp.ngay == cttpDTO.Ngay && cttp.madichvu == cttpDTO.Madichvu select cttp).FirstOrDefault<chitietthuephong>(); querry.soluong = cttpDTO.Soluong; htDataContext.SubmitChanges(); return 1; } catch { return 0; } }
public int insertChiTietThuePhong(ChiTietThuePhongDTO cttpDTO) { try { chitietthuephong cttp = new chitietthuephong(); cttp.maphieuthue = cttpDTO.Maphieuthue; cttp.maphong = cttpDTO.Maphong; cttp.ngay = (DateTime)cttpDTO.Ngay; cttp.madichvu = cttpDTO.Madichvu; cttp.soluong = (int)cttpDTO.Soluong; htDataContext.chitietthuephongs.InsertOnSubmit(cttp); htDataContext.SubmitChanges(); return 1; } catch { return 0; } }