private void ViewAcc() { try { DataTable dtPhong = new DataTable(); dtPhong = TblRoom_BLL.SelectRoom_ID(int.Parse(Request.QueryString["id"].ToString())); int SoNguoi = int.Parse(dtPhong.Rows[0][0].ToString()); if (SoNguoi == 1)//Hiên thị nhân vật bên phải và trái { DataTable dtWarRoom = new DataTable(); dtWarRoom = TblRoom_BLL.SelectWarRoom(int.Parse(Request.QueryString["id"].ToString())); int IDAcc = int.Parse(dtWarRoom.Rows[0][1].ToString()); RptAcc1.DataSource = TblAcc_BLL.ViewAccID(IDAcc); RptAcc1.DataBind(); Timer1.Enabled = true; lblTime.Visible = false; } else { //Hiển thị từ dữ liệu. if (SoNguoi == 2) { DataTable dtWarRoom = new DataTable(); dtWarRoom = TblRoom_BLL.SelectWarRoom(int.Parse(Request.QueryString["id"].ToString())); int IDAcc = int.Parse(dtWarRoom.Rows[0][1].ToString()); int IDAcc2 = int.Parse(dtWarRoom.Rows[0][2].ToString()); RptAcc1.DataSource = TblAcc_BLL.ViewAccID(IDAcc); RptAcc1.DataBind(); RptAcc2.DataSource = TblAcc_BLL.ViewAccID(IDAcc2); RptAcc2.DataBind(); Timer1.Enabled = false; Panel1.Visible = true; lblTime.Visible = true; Page.ClientScript.RegisterStartupScript(this.GetType(), "lblTime", "countDownTimer()", true); } } } catch (Exception) { //Label1.Visible = true; //Label1.Text = "Chờ chút"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["TrangThai"].Equals("notlogin")) { Response.Redirect("Default.aspx"); } else { if (Session["TrangThai"].ToString() == "Nor") { DataTable dtAcc = new DataTable(); dtAcc = TblAcc_BLL.ViewAccID(int.Parse(Session["IDAcc"].ToString())); string iDRoom = dtAcc.Rows[0][17].ToString(); string rques = Request.QueryString["id"].ToString(); if (iDRoom != rques) { Response.Redirect("chd-join.aspx"); } else { ViewAcc1(); ViewTest(); RptAcc2.DataSource = TblAcc_BLL.ViewBoss(); RptAcc2.DataBind(); } } else { if (Session["TrangThai"].ToString() == "XH") { Response.Redirect("mem-login.aspx"); } } } } }