Esempio n. 1
0
 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;
             }
         }
     }
 }
Esempio n. 2
0
        protected void DDLPa_SelectedIndexChanged(object sender, EventArgs e)
        {
            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();
        }