コード例 #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)
         {
             DDLRoomFormat.DataSource = bll.GetType("RoomFormat");
             DDLRoomFormat.DataBind();
             DDLSunny.DataSource = bll.GetType("Sunny");
             DDLSunny.DataBind();
             DDLRoomUse.DataSource = bll.GetType("RoomUse");
             DDLRoomUse.DataBind();
             DDLIndoor.DataSource = bll.GetType("Indoor");
             DDLIndoor.DataBind();
             string    code = Request.QueryString["ID"].ToString();
             RoomModel room = roombll.GetRoomByID(code);
             lbCode.Text                 = room.Code;
             lbRoomID.Text               = room.RoomID;
             lbPaName.Text               = room.PaName;
             txtBuildArea.Text           = room.BuildArea.ToString();
             txtUseArea.Text             = room.UseArea.ToString();
             DDLRoomFormat.SelectedValue = room.RoomFormatID.ToString();
             DDLSunny.SelectedValue      = room.SunnyID.ToString();
             DDLRoomUse.SelectedValue    = room.RoomUseID.ToString();
             DDLIndoor.SelectedValue     = room.IndoorID.ToString();
         }
     }
 }
コード例 #2
0
        protected void Build_Click(object sender, EventArgs e)
        {
            int end   = Convert.ToInt32(DDLLayerEnd.SelectedValue);
            int begin = Convert.ToInt32(DDLLayerBegin.SelectedValue);

            if (begin > end)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "OnSubmit", "<script>alert('开始楼层不应大于结束楼层');</script>");
            }
            else
            {
                DDLSunny.DataSource = bll.GetType("Sunny");
                DDLSunny.DataBind();
                DDLFormat.DataSource = bll.GetType("RoomFormat");
                DDLFormat.DataBind();
                DDLRoomUse.DataSource = bll.GetType("RoomUse");
                DDLRoomUse.DataBind();
                DDLIndoor.DataSource = bll.GetType("Indoor");
                DDLIndoor.DataBind();
                for (int i = 0; i <= Convert.ToInt32(txtCount.Text.Trim()); i++)
                {
                    DDLRow.Items.Add(i.ToString());
                }
                ModifyPanel.Visible = true;
                dttable.Rows.Clear();
                int count = Convert.ToInt32(txtCount.Text.Trim()) * (end - begin + 1);
                for (int i = 1; i <= count; i++)
                {
                    DataRow row = dttable.NewRow();
                    row[0]  = i;
                    row[1]  = Convert.ToInt32(DDLSunny.SelectedValue);
                    row[2]  = DDLSunny.SelectedItem.Text;
                    row[3]  = Convert.ToInt32(DDLIndoor.SelectedValue);
                    row[4]  = DDLIndoor.SelectedItem.Text;
                    row[5]  = Convert.ToInt32(DDLRoomUse.SelectedValue);
                    row[6]  = DDLRoomUse.SelectedItem.Text;
                    row[7]  = Convert.ToInt32(DDLFormat.SelectedValue);
                    row[8]  = DDLFormat.SelectedItem.Text;
                    row[9]  = Convert.ToDouble(txtArea.Text.Trim());
                    row[10] = Convert.ToDouble(txtUseArea.Text.Trim());
                    dttable.Rows.Add(row);
                }
                RoomGridView.DataSource = dttable;
                RoomGridView.DataBind();
                DDLPa.Enabled         = false;
                DDLCell.Enabled       = false;
                DDLLayerBegin.Enabled = false;
                DDLLayerEnd.Enabled   = false;
                txtCount.Enabled      = false;
                txtPrefix.Enabled     = false;
                Build.Enabled         = false;
            }
        }