public void Tang(int temp, int a, out string laytenphong, BunifuFlatButton btdattraphong) { string ghepmaphong; laytenphong = null; HotelObject.PhongHo p = new HotelObject.PhongHo(); HotelObject.PhongHo p1 = new HotelObject.PhongHo(); HotelObject.PhongHo p2 = new HotelObject.PhongHo(); HotelObject.PhongHo p3 = new HotelObject.PhongHo(); p.TenPhong = null; p1.TenPhong = null; p2.TenPhong = null; p3.TenPhong = null; if (a.ToString().Length == 1) { ghepmaphong = "P" + temp.ToString() + "0" + a.ToString(); } else { ghepmaphong = "P" + temp.ToString() + a.ToString(); } p.TenPhong = conn.LayBien("EXEC PROC_SELECT_PHONGDANGO1 " + temp + ",'" + ghepmaphong + "'", 0); p1.TenPhong = conn.LayBien("EXEC PROC_SELECT_PHONGDANGTHUE1 " + temp + ", '" + ghepmaphong + "'", 0); p2.TenPhong = conn.LayBien("EXEC PROC_SELECT_PHONGTRAMUON1 " + temp + ",'" + ghepmaphong + "'", 0); p3.TenPhong = conn.LayBien("EXEC PROC_SELECT_PHONGDATCOCTRUOC1 " + temp + ",'" + ghepmaphong + "'", 0); if (p.TenPhong != null) { btdattraphong.Text = "Trả Phòng"; btdattraphong.Cursor = Cursors.Hand; //label16.Text = "phong dang o"; laytenphong = p.TenPhong; } if (p1.TenPhong != null) { btdattraphong.Text = "Đặt Phòng"; btdattraphong.Cursor = Cursors.Default; FormDatPhong dp = new FormDatPhong(p1.TenPhong, temp.ToString()); dp.Show(); } if (p2.TenPhong != null) { //label16.Text = "phong dang tra muon"; btdattraphong.Text = "Trả Phòng"; btdattraphong.Cursor = Cursors.Hand; laytenphong = p2.TenPhong; } if (p3.TenPhong != null) { // label16.Text = "phong dang dat coc"; btdattraphong.Text = "Trả Phòng"; btdattraphong.Cursor = Cursors.Hand; laytenphong = p3.TenPhong; } }
private void btnDatPhong_ItemClick(object sender, ItemClickEventArgs e) { Form frm = this.CheckExists(typeof(FormDatPhong)); if (frm != null) { frm.Activate(); } else { FormDatPhong f = new FormDatPhong(); f.MdiParent = this; f.Show(); } }