/// <summary>
 /// 绑定管理的阅览室下拉列表
 /// </summary>
 private void BindDDLReadingRoom()
 {
     SeatManage.ClassModel.ManagerPotency potency = SeatManage.Bll.T_SM_ManagerPotency.GetManangePotencyByLoginID(this.LoginId);
     if (potency != null)
     {
         potency.RightRoomList.Insert(0, new SeatManage.ClassModel.ReadingRoomInfo()
         {
             Name = "所有阅览室", No = ""
         });
         ddlReadingRoom.DataTextField  = "Name";
         ddlReadingRoom.DataValueField = "No";
         ddlReadingRoom.DataSource     = potency.RightRoomList;
         ddlReadingRoom.DataBind();
     }
 }
예제 #2
0
        /// <summary>
        /// 绑定房间列表
        /// </summary>
        /// <returns></returns>
        public string GetRoomData()
        {
            SeatManage.ClassModel.ManagerPotency potency = SeatManage.Bll.T_SM_ManagerPotency.GetManangePotencyByLoginID(this.LoginId);
            StringBuilder sb = new StringBuilder();

            if (potency != null)
            {
                sb.Append("{\"list\":[");
                sb.Append("{\"key\":\"所有阅览室\",\"value\":\"\"},");
                foreach (var item in potency.RightRoomList)
                {
                    sb.Append("{\"key\":\"" + item.Name + "\",\"value\":\"" + item.No + "\"},");
                }
                sb.Remove(sb.Length - 1, 1);
                sb.Append("]}");
            }
            return(sb.ToString());
        }
        /// <summary>
        /// 获取阅览室列表
        /// </summary>
        /// <param name="LoginID"></param>
        /// <returns></returns>
        public static DataTable GetMonitorGraphReadingRoomList(string LoginID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("roomNum", typeof(string));
            dt.Columns.Add("roomName", typeof(string));
            dt.Columns.Add("libraryName", typeof(string));
            dt.Columns.Add("seatCountAll", typeof(int));
            dt.Columns.Add("seatCountUsed", typeof(int));
            dt.Columns.Add("seatCountShortLeave", typeof(int));

            SeatManage.ClassModel.ManagerPotency potency = SeatManage.Bll.T_SM_ManagerPotency.GetManangePotencyByLoginID(LoginID);
            List <string> roomNums = new List <string>();
            Dictionary <string, ReadingRoomSeatUsedState> roomSeatUsingState = new Dictionary <string, ReadingRoomSeatUsedState>();

            if (potency != null)
            {
                for (int i = 0; i < potency.RightRoomList.Count; i++)
                {
                    roomNums.Add(potency.RightRoomList[i].No);
                }
            }
            roomSeatUsingState = NowReadingRoomState.GetRoomSeatUsedState(roomNums);
            foreach (ReadingRoomInfo model in potency.RightRoomList)
            {
                DataRow dr = dt.NewRow();
                dr["roomNum"]     = model.No;
                dr["roomName"]    = model.Name;
                dr["libraryName"] = model.Libaray.Name;
                int stopSeatCount = 0;
                foreach (KeyValuePair <string, Seat> item in model.SeatList.Seats)
                {
                    if (item.Value.IsSuspended)
                    {
                        stopSeatCount++;
                    }
                }
                dr["seatCountAll"]        = roomSeatUsingState[model.No].SeatAmountAll - stopSeatCount;
                dr["seatCountUsed"]       = roomSeatUsingState[model.No].SeatAmountUsed;
                dr["seatCountShortLeave"] = roomSeatUsingState[model.No].SeatAmountShortLeave;
                dt.Rows.Add(dr);
            }
            return(dt);
        }