Beispiel #1
0
 //根据房间的id显示里面的餐桌
 private void LoadDeakInfoByTabpageSelect(TabPage tp)
 {
     RoomInfo room = (RoomInfo)tp.Tag;//获取房间对象
     //获取tabpage控件中的listview控件
     ListView lv = (ListView)tp.Controls[0];//获取包含在控件内的控件
     lv.Clear();//清除
     //根据房间Id查询该房间下所有的餐桌
     DeskInfoBLL dkBll = new DeskInfoBLL();
     List<DeskInfo> listDesk = dkBll.GetAllDeskInfoByRoomId(room.RoomId);
     for (int i = 0; i < listDesk.Count; i++)
     {
         lv.Items.Add(listDesk[i].DeskName, listDesk[i].DeskState);//用指定的文本和图像创建一个项并添加到集合中
         lv.Items[i].Tag = listDesk[i];//餐桌对象存起来
     }
 }