protected void Page_Load(object sender, EventArgs e) { user = (UserModel)Session["User"]; if (Session["User"] == null || Session["User"].ToString() == "" || user.UserType != 1) { Response.Redirect("../Login.aspx"); } else { if (!IsPostBack) { DDLPa.DataSource = pabll.GetAllPavilion(); DDLPa.DataBind(); DDLCell.DataSource = bll.GetType("Cell"); DDLCell.DataBind(); DDLLayerBegin.Items.Clear(); DDLLayerEnd.Items.Clear(); PavilionModel pavilion = pabll.GetPavilionByID(DDLPa.SelectedValue); for (int i = 1; i <= pavilion.Layer; i++) { ListItem items = new ListItem(); items.Text = i.ToString(); if (i < 10) { items.Value = "0" + i.ToString(); } else { items.Value = i.ToString(); } DDLLayerBegin.Items.Add(items); DDLLayerEnd.Items.Add(items); } DDLLayerBegin.DataBind(); DDLLayerEnd.DataBind(); if (dttable.Columns.Count == 0) { dttable.Columns.Add("ID", typeof(int)); dttable.Columns.Add("SunnyID", typeof(int)); dttable.Columns.Add("SunnyName", typeof(string)); dttable.Columns.Add("IndoorID", typeof(int)); dttable.Columns.Add("IndoorName", typeof(string)); dttable.Columns.Add("RoomUseID", typeof(int)); dttable.Columns.Add("RoomUseName", typeof(string)); dttable.Columns.Add("RoomFormatID", typeof(int)); dttable.Columns.Add("RoomFormatName", typeof(string)); dttable.Columns.Add("BuildArea", typeof(double)); dttable.Columns.Add("UseArea", typeof(double)); DataColumn[] key = { dttable.Columns["ID"] }; dttable.PrimaryKey = key; } } } }
protected void Page_Load(object sender, EventArgs e) { user = (UserModel)Session["User"]; if (Session["User"] == null || Session["User"].ToString() == "" || user.UserType != 1) { Response.Redirect("../Login.aspx"); } else { if (!IsPostBack) { DDLType.DataSource = parkbll.GetBasePark(); DDLType.DataBind(); DDLPa.DataSource = pabll.GetAllPavilion(); DDLPa.DataBind(); DDLCell.DataSource = typebll.GetType("Cell"); DDLCell.DataBind(); string str = DDLPa.SelectedValue; int i = Convert.ToInt32(DDLCell.SelectedValue); if (i < 10) { str += "0" + i.ToString(); } else { str += i.ToString(); } List <RoomModel> list = roombll.GetAllRoomUsed(str); if (list.Count != 0) { DDLRoomID.DataSource = list; DDLRoomID.DataBind(); Panel1.Visible = true; Panel2.Visible = false; } else { Panel1.Visible = false; Panel2.Visible = true; } } } }