/// <summary> /// 下拉框绑定 /// </summary> private void ddlBind(DataTable dtBuildingName) { Pager mPager = null; #region 宿舍区 //DormAreaBLL mDormAreaBLL = new DormAreaBLL(); //this.ddlDormArea.DataValueField = TB_DormArea.col_ID; //this.ddlDormArea.DataTextField = TB_DormArea.col_Name; //this.ddlDormArea.DataSource = mDormAreaBLL.GetTable(new TB_DormArea() { SiteID = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID) }, ref mPager); //this.ddlDormArea.DataBind(); //this.ddlDormArea.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 楼栋 this.ddlBuildingName.DataSource = dtBuildingName.DefaultView; this.ddlBuildingName.DataValueField = TB_DormArea.col_ID; this.ddlBuildingName.DataTextField = TB_DormArea.col_Name; this.ddlBuildingName.DataBind(); this.ddlBuildingName.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 单元 this.ddlUnit.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 楼层 this.ddlFloor.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 房间类型 RoomTypeBLL mRoomTypeBLL = new RoomTypeBLL(); this.ddlRoomType.DataValueField = TB_RoomType.col_ID; this.ddlRoomType.DataTextField = TB_RoomType.col_Name; this.ddlRoomType.DataSource = mRoomTypeBLL.GetTable(base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID); this.ddlRoomType.DataBind(); this.ddlRoomType.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 房间号 this.ddlRoom.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion }
/// <summary> /// 下拉框绑定 /// </summary> private void ddlBind() { #region 宿舍区 this.ddlDormArea0.DataValueField = "DormAreaID"; this.ddlDormArea0.DataTextField = "DormAreaName"; DataTable dt = ViewState["dtAssignedRoom"] as DataTable; IEnumerable <object> dataSource = (from v in dt.AsEnumerable() select new { DormAreaID = v.Field <int>("DormAreaID"), DormAreaName = v.Field <string>("DormAreaName") }).ToList().Distinct(); this.ddlDormArea0.DataSource = dataSource; this.ddlDormArea0.DataBind(); this.ddlDormArea0.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); foreach (var item in this.ddlDormArea0.Items) { this.ddlDormArea1.Items.Add((ListItem)item); this.ddlDormArea2.Items.Add((ListItem)item); this.ddlDormArea3.Items.Add((ListItem)item); this.ddlDormArea4.Items.Add((ListItem)item); this.ddlDormArea5.Items.Add((ListItem)item); this.ddlDormArea6.Items.Add((ListItem)item); this.ddlDormArea7.Items.Add((ListItem)item); this.ddlDormArea8.Items.Add((ListItem)item); this.ddlDormArea9.Items.Add((ListItem)item); this.ddlFemaleDormArea0.Items.Add((ListItem)item); this.ddlFemaleDormArea1.Items.Add((ListItem)item); this.ddlFemaleDormArea2.Items.Add((ListItem)item); this.ddlFemaleDormArea3.Items.Add((ListItem)item); this.ddlFemaleDormArea4.Items.Add((ListItem)item); this.ddlFemaleDormArea5.Items.Add((ListItem)item); this.ddlFemaleDormArea6.Items.Add((ListItem)item); this.ddlFemaleDormArea7.Items.Add((ListItem)item); this.ddlFemaleDormArea8.Items.Add((ListItem)item); this.ddlFemaleDormArea9.Items.Add((ListItem)item); } #endregion #region 楼栋 this.ddlBuilding0.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding1.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding2.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding3.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding4.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding5.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding6.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding7.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding8.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlBuilding9.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding0.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding1.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding2.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding3.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding4.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding5.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding6.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding7.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding8.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); this.ddlFemaleBuilding9.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 单元 //this.ddlUnit.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 楼层 //this.ddlFloor.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 房间类型 RoomTypeBLL mRoomTypeBLL = new RoomTypeBLL(); this.ddlRoomType0.DataValueField = TB_RoomType.col_ID; this.ddlRoomType0.DataTextField = TB_RoomType.col_Name; this.ddlRoomType0.DataSource = mRoomTypeBLL.GetTable(base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID); this.ddlRoomType0.DataBind(); this.ddlRoomType0.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); foreach (var item in this.ddlRoomType0.Items) { this.ddlRoomType1.Items.Add((ListItem)item); this.ddlRoomType2.Items.Add((ListItem)item); this.ddlRoomType3.Items.Add((ListItem)item); this.ddlRoomType4.Items.Add((ListItem)item); this.ddlRoomType5.Items.Add((ListItem)item); this.ddlRoomType6.Items.Add((ListItem)item); this.ddlRoomType7.Items.Add((ListItem)item); this.ddlRoomType8.Items.Add((ListItem)item); this.ddlRoomType9.Items.Add((ListItem)item); this.ddlFemaleRoomType0.Items.Add((ListItem)item); this.ddlFemaleRoomType1.Items.Add((ListItem)item); this.ddlFemaleRoomType2.Items.Add((ListItem)item); this.ddlFemaleRoomType3.Items.Add((ListItem)item); this.ddlFemaleRoomType4.Items.Add((ListItem)item); this.ddlFemaleRoomType5.Items.Add((ListItem)item); this.ddlFemaleRoomType6.Items.Add((ListItem)item); this.ddlFemaleRoomType7.Items.Add((ListItem)item); this.ddlFemaleRoomType8.Items.Add((ListItem)item); this.ddlFemaleRoomType9.Items.Add((ListItem)item); } #endregion #region BU this.ddlBU0.DataTextField = "Name"; this.ddlBU0.DataValueField = "Name"; this.ddlBU0.DataSource = new BUBLL().GetTable(base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID); this.ddlBU0.DataBind(); this.ddlBU0.Items.Insert(0, new ListItem() { Value = "", Text = "--请选择--" }); foreach (ListItem item in ddlBU0.Items) { this.ddlBU1.Items.Add(item); this.ddlBU2.Items.Add(item); this.ddlBU3.Items.Add(item); this.ddlBU4.Items.Add(item); this.ddlBU5.Items.Add(item); this.ddlBU6.Items.Add(item); this.ddlBU7.Items.Add(item); this.ddlBU8.Items.Add(item); this.ddlBU9.Items.Add(item); this.ddlFemaleBU0.Items.Add(item); this.ddlFemaleBU1.Items.Add(item); this.ddlFemaleBU2.Items.Add(item); this.ddlFemaleBU3.Items.Add(item); this.ddlFemaleBU4.Items.Add(item); this.ddlFemaleBU5.Items.Add(item); this.ddlFemaleBU6.Items.Add(item); this.ddlFemaleBU7.Items.Add(item); this.ddlFemaleBU8.Items.Add(item); this.ddlFemaleBU9.Items.Add(item); } #endregion }