private void cmbMaPhong_SelectedValueChanged(object sender, EventArgs e) { LoaiPhongControl lp = new LoaiPhongControl(); PhongControl p = new PhongControl(); if (cmbMaPhong.SelectedValue != null) { PhongInFo pi = p.LayMaPhong(cmbMaPhong.SelectedValue.ToString()); LoaiPhongInFo lpi = lp.LayLoaiPhong(pi.MaLoaiPhong); txtTienPhong.Text = lpi.DonGia.ToString(); } }
public LoaiPhongInFo LayLoaiPhongML(string id) { LoaiPhongInFo lph = null; DataTable tbl = data.LayMaLoaiPhongml(id); if (tbl.Rows.Count > 0) { lph = new LoaiPhongInFo(); lph.MaLoaiPhong = Convert.ToString(tbl.Rows[0]["MaLoaiPhong"]); lph.TenLoaiPhong = Convert.ToString(tbl.Rows[0]["TenLoaiPhong"]); lph.DonGia = Convert.ToInt64(tbl.Rows[0]["DonGia"]); lph.SoNguoiChuan = Convert.ToInt32(tbl.Rows[0]["SoNguoiChuan"]); lph.SoNguoiToiDa = Convert.ToInt32(tbl.Rows[0]["SoNguoiToiDa"]); lph.TyLeTang = Convert.ToInt16(tbl.Rows[0]["TyLeTang"] != DBNull.Value ? tbl.Rows[0]["TyLeTang"] : 0); } return(lph); }