/// <summary>
        /// 根据阅览室编号获取但个阅览室开闭状态
        /// </summary>
        /// <returns></returns>
        public string GetSingleRoomOpenState(string roomNo, string datetime)
        {
            AJM_HandleResult result = new AJM_HandleResult();

            try
            {
                if (string.IsNullOrEmpty(roomNo))
                {
                    result.Result = false;
                    result.Msg    = "阅览室编号不能为空!";
                    return(JSONSerializer.Serialize(result));
                }
                AJM_ReadingRoomState ajmReadingRoomState = new AJM_ReadingRoomState();
                List <string>        listNum             = new List <string>();
                listNum.Add(roomNo);
                ReadingRoomInfo readingRoomInfo = SeatManageDateService.GetReadingRoomInfo(listNum)[0];
                ajmReadingRoomState.OpenCloseState = readingRoomInfo.Setting.ReadingRoomOpenState(Convert.ToDateTime(datetime)).ToString();
                ajmReadingRoomState.RoomName       = readingRoomInfo.Name;
                ajmReadingRoomState.RoomNo         = readingRoomInfo.No;
                result.Result = true;
                result.Msg    = JSONSerializer.Serialize(ajmReadingRoomState);
                return(JSONSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                WriteLog.Write(string.Format("获取阅览室开闭状态异常:{0}", ex.Message));
                result.Result = false;
                result.Msg    = "获取阅览室开闭状态执行遇到异常!";
                return(JSONSerializer.Serialize(result));
            }
        }
        /// <summary>
        /// 获取全部图书馆的使用情况
        /// </summary>
        /// <returns></returns>
        public string GetLibraryNowState()
        {
            AJM_HandleResult result = new AJM_HandleResult();

            try
            {
                //获取阅览室座位使用状态
                List <ReadingRoomInfo> readingRoomInfos = SeatManageDateService.GetReadingRoomInfo(null);
                Dictionary <string, ReadingRoomSeatUsedState> roomSeatUsedStates = SeatManageDateService.GetRoomSeatUsedStateV5(readingRoomInfos.Select(u => u.No).ToList());
                List <AJM_LibraryStatus> ajmLibraryStates = new List <AJM_LibraryStatus>();

                foreach (ReadingRoomInfo room in readingRoomInfos)
                {
                    if (ajmLibraryStates.Count < 1 || !ajmLibraryStates.Exists(u => u.LibraryNo == room.Libaray.No))
                    {
                        AJM_LibraryStatus status = new AJM_LibraryStatus();
                        status.LibraryNo   = room.Libaray.No;
                        status.LibraryName = room.Libaray.Name;
                        ajmLibraryStates.Add(status);
                    }
                    AJM_ReadingRoomState ajmReadingRoomState = new AJM_ReadingRoomState();
                    ajmReadingRoomState.RoomName           = room.Name;
                    ajmReadingRoomState.RoomNo             = room.No;
                    ajmReadingRoomState.OpenCloseState     = room.Setting.ReadingRoomOpenState(DateTime.Now).ToString();
                    ajmReadingRoomState.IsCanBookNowSeat   = room.Setting.SeatBespeak.Used && room.Setting.SeatBespeak.NowDayBespeak;
                    ajmReadingRoomState.SeatAmount_All     = room.SeatList.Seats.Count(u => u.Value.IsSuspended != true);
                    ajmReadingRoomState.SeatAmount_Used    = roomSeatUsedStates[room.No].SeatAmountUsed;
                    ajmReadingRoomState.SeatAmount_Bespeak = roomSeatUsedStates[room.No].SeatBookingCount;
                    ajmReadingRoomState.SeatAmount_Last    = ajmReadingRoomState.SeatAmount_All - ajmReadingRoomState.SeatAmount_Used - ajmReadingRoomState.SeatAmount_Bespeak + roomSeatUsedStates[room.No].SeatTemUseCount;
                    ajmLibraryStates.Find(u => u.LibraryNo == room.Libaray.No).RoomStatus.Add(ajmReadingRoomState);
                }
                foreach (AJM_LibraryStatus status in ajmLibraryStates)
                {
                    status.AllSeats       = status.RoomStatus.Sum(u => u.SeatAmount_All);
                    status.AllBooked      = status.RoomStatus.Sum(u => u.SeatAmount_Bespeak);
                    status.AllUsed        = status.RoomStatus.Sum(u => u.SeatAmount_Used);
                    status.UsedPercentage = (int)((double)status.AllUsed / (double)status.AllSeats * 100);
                }


                result.Result = true;
                result.Msg    = JSONSerializer.Serialize(ajmLibraryStates);
                return(JSONSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                WriteLog.Write(string.Format("获取阅览室使用状态遇到异常:{0}", ex.Message));
                result.Result = false;
                result.Msg    = "获取阅览室使用状态执行遇到异常!";
                return(JSONSerializer.Serialize(result));
            }
        }
 /// <summary>
 /// 获取读者所在阅览室开闭状态
 /// </summary>
 /// <returns></returns>
 public AJM_ReadingRoomState GetSingleRoomOpenState(string roomNo)
 {
     try
     {
         if (string.IsNullOrEmpty(roomNo))
         {
             return(null);
         }
         AJM_ReadingRoomState ajmReadingRoomState = new AJM_ReadingRoomState();
         List <string>        listNum             = new List <string>();
         listNum.Add(roomNo);
         ReadingRoomInfo readingRoomInfo = SeatManageDateService.GetReadingRoomInfo(listNum)[0];
         ajmReadingRoomState.OpenCloseState = readingRoomInfo.Setting.ReadingRoomOpenState(DateTime.Now).ToString();
         ajmReadingRoomState.RoomName       = readingRoomInfo.Name;
         ajmReadingRoomState.RoomNo         = readingRoomInfo.No;
         return(ajmReadingRoomState);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取读者所在阅览室开闭状态遇到异常:{0}", ex.Message));
         return(null);
     }
 }
 /// <summary>
 /// 获取单个阅览室开闭状态
 /// </summary>
 /// <param name="roomNo"></param>
 /// <param name="datetime"></param>
 /// <param name="schoolNo"></param>
 /// <returns></returns>
 public AJM_ReadingRoomState GetSingleRoomOpenState(string roomNo, string datetime, string schoolNo)
 {
     try
     {
         IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo);
         string           result    = appService.GetAllRoomNowState();
         AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result);
         if (ajmResult == null)
         {
             throw new Exception("获取单个阅览室的当前的开闭状态失败!");
         }
         if (!ajmResult.Result)
         {
             throw new Exception(ajmResult.Msg);
         }
         AJM_ReadingRoomState ajmReadingRoomState = JSONSerializer.Deserialize <AJM_ReadingRoomState>(ajmResult.Msg);
         return(ajmReadingRoomState);
     }
     catch (Exception ex)
     {
         WriteLog.Write(string.Format("获取单个阅览室的当前的开闭状态失败:{0}", ex.Message));
         return(null);
     }
 }
        /// <summary>
        /// 获取全部阅览室的当前的使用状态(在座人数,是否开馆等)
        /// </summary>
        /// <returns></returns>
        public string GetAllRoomNowState()
        {
            AJM_HandleResult result = new AJM_HandleResult();

            try
            {
                //获取阅览室座位使用状态
                Dictionary <string, ReadingRoomSeatUsedState> roomSeatUsedStates = SeatManageDateService.GetRoomSeatUsedStateV5(null);
                List <AJM_ReadingRoomState> ajmReadingRoomStates = new List <AJM_ReadingRoomState>();
                foreach (ReadingRoomSeatUsedState seatUsedState in roomSeatUsedStates.Values)
                {
                    AJM_ReadingRoomState ajmReadingRoomState = new AJM_ReadingRoomState();
                    ajmReadingRoomState.RoomName = seatUsedState.RoomName;
                    ajmReadingRoomState.RoomNo   = seatUsedState.RoomNum;
                    List <string> listNum = new List <string>();
                    listNum.Add(seatUsedState.RoomNum);
                    ReadingRoomInfo readingRoomInfo = SeatManageDateService.GetReadingRoomInfo(listNum)[0];
                    ajmReadingRoomState.OpenCloseState     = readingRoomInfo.Setting.ReadingRoomOpenState(DateTime.Now).ToString();
                    ajmReadingRoomState.SeatAmount_All     = seatUsedState.SeatAmountAll;
                    ajmReadingRoomState.SeatAmount_Used    = seatUsedState.SeatAmountUsed;
                    ajmReadingRoomState.SeatAmount_Bespeak = seatUsedState.SeatBookingCount;
                    ajmReadingRoomState.SeatAmount_Last    = ajmReadingRoomState.SeatAmount_All - ajmReadingRoomState.SeatAmount_Used - ajmReadingRoomState.SeatAmount_Bespeak + seatUsedState.SeatTemUseCount;
                    ajmReadingRoomStates.Add(ajmReadingRoomState);
                }
                result.Result = true;
                result.Msg    = JSONSerializer.Serialize(ajmReadingRoomStates);
                return(JSONSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                WriteLog.Write(string.Format("获取阅览室使用状态遇到异常:{0}", ex.Message));
                result.Result = false;
                result.Msg    = "获取阅览室使用状态执行遇到异常!";
                return(JSONSerializer.Serialize(result));
            }
        }