//Thêm public void insertPhieuThuePhong(PhieuThuePhongDTO ptpDTO) { phieuthuephong ptp = new phieuthuephong(); ptp.maphieuthue = ptpDTO.Maphieuthue; ptp.maphieudat = ptpDTO.Maphieudat; ptp.username = ptpDTO.Username; htDataContext.phieuthuephongs.InsertOnSubmit(ptp); htDataContext.SubmitChanges(); }
private void cmbMaPT_SelectedIndexChanged(object sender, EventArgs e) { phieuthuephong phieuthuephong = dt.phieuthuephongs.Where(p => p.matp == cmbMaPT.SelectedValue.ToString()).FirstOrDefault(); if (phieuthuephong != null) { txtNgayThuePhong.Text = phieuthuephong.ngaythue.ToString(); s = phieuthuephong.maphong; phong phong = dt.phongs.Where(p => p.maphong == s.ToString()).FirstOrDefault(); string c = phong.maloai; loaiphong loaiphong = dt.loaiphongs.Where(p => p.maloai == c).FirstOrDefault(); d = Convert.ToInt32(loaiphong.gia); labGia.Text = d.ToString(); } }
//Thêm nhân viên public int insertPhieuThuePhong(PhieuThuePhongDTO ptpDTO) { try { phieuthuephong ptp = new phieuthuephong(); ptp.maphieuthue = ptpDTO.Maphieuthue; ptp.maphieudat = ptpDTO.Maphieudat; ptp.username = ptpDTO.Username; htDataContext.phieuthuephongs.InsertOnSubmit(ptp); htDataContext.SubmitChanges(); return(1); } catch { return(0); } }