Exemplo n.º 1
0
        /// <summary>
        /// 进入阅览室前判断
        /// </summary>
        /// <param name="roomNo"></param>
        public void EnterReadingRoom(ReadingRoomUC_ViewModel vm_Room)
        {
            try
            {
                this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = vm_Room.ReadingRoomNo;
                ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(vm_Room.ReadingRoomNo);
                if (vm_Room.Status == SeatManage.EnumType.ReadingRoomStatus.Close || vm_Room.Status == SeatManage.EnumType.ReadingRoomStatus.BeforeClose)
                {
                    clientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;
                    PopupWindow fullWindow = new PopupWindow(SeatManage.EnumType.TipType.ReadingRoomClosing);
                    fullWindow.ShowDialog();
                    clientObject.EnterOutLogData.Student.AtReadingRoom = null;
                    return;
                }
                if (vm_Room.Usage == SeatManage.EnumType.ReadingRoomUsingStatus.Full && (!roomInfo.Setting.NoManagement.Used))
                {
                    PopupWindow fullWindow = new PopupWindow(SeatManage.EnumType.TipType.ReadingRoomFull);
                    fullWindow.ShowDialog();
                    return;
                }
                clientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//给读者所在的阅览室赋值。

                //验证读者身份是否允许选择该阅览室。
                if (!Code.SelectSeatProven.ProvenReaderType(clientObject.EnterOutLogData.Student, roomInfo.Setting))
                {
                    PopupWindow popWindow = new PopupWindow(SeatManage.EnumType.TipType.ReaderTypeInconformity);
                    popWindow.ShowDialog();
                    return;
                }
                //验证读者黑名单,选座次数。
                if (Code.SelectSeatProven.ProvenReaderState(clientObject.EnterOutLogData.Student, roomInfo, clientObject.RegulationRulesSet.BlacklistSet, clientObject.ClientSetting.DeviceSetting))
                {
                    this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                    return;
                }
                //TODO:验证终端选座方式
                if (vm_Room.Usage == SeatManage.EnumType.ReadingRoomUsingStatus.Full && roomInfo.Setting.NoManagement.Used)
                {
                    this._RoomSelectSeatMethod = SeatManage.EnumType.SelectSeatMode.ManualMode;
                    this.clientObject.EnterOutLogData.FlowControl = SeatManage.EnumType.ClientOperation.SelectSeat;
                    this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = roomInfo.No;
                    this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name;
                    RoomSeatWindow roomSeatWindow = new RoomSeatWindow();
                    roomSeatWindow.ShowDialog();
                    return;
                }
                else
                {
                    SeatManage.EnumType.SelectSeatMode selectSeatMethod = SeatClientV2.Code.SelectSeatProven.ProvenSelectSeatMethod(clientObject.ClientSetting.DeviceSetting, roomInfo.Setting.SeatChooseMethod);

                    if (selectSeatMethod == SeatManage.EnumType.SelectSeatMode.OptionalMode || selectSeatMethod == SeatManage.EnumType.SelectSeatMode.ManualMode)
                    {
                        this._RoomSelectSeatMethod = selectSeatMethod;
                        this.clientObject.EnterOutLogData.FlowControl = SeatManage.EnumType.ClientOperation.SelectSeat;
                        this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = roomInfo.No;
                        this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name;
                        RoomSeatWindow roomSeatWindow = new RoomSeatWindow();
                        roomSeatWindow.ShowDialog();
                        this._RoomSelectSeatMethod = roomSeatWindow.viewModel.RoomSelectSeatMethod;
                        return;
                    }
                    else
                    {
                        this._RoomSelectSeatMethod = selectSeatMethod;
                        this.clientObject.EnterOutLogData.FlowControl = SeatManage.EnumType.ClientOperation.SelectSeat;
                        this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = roomInfo.No;
                        this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name;
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                SeatManage.SeatManageComm.WriteLog.Write("加载阅览室遇到异常" + ex.Message);
                PopupWindow errorWindow = new PopupWindow(SeatManage.EnumType.TipType.Exception);
                errorWindow.ShowDialog();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 分区域排列
        /// </summary>
        public void GetRoomUsage()
        {
            try
            {
                //添加区域
                List <LibraryInfo> linList = SeatManage.Bll.T_SM_Library.GetLibraryInfoList(null, null, null);
                foreach (LibraryInfo lib in linList)
                {
                    foreach (AreaInfo area in lib.AreaList)
                    {
                        if (!ReadingRoomUsage.ContainsKey(area.AreaName))
                        {
                            ReadingRoomUsage.Add(area.AreaName, new List <ReadingRoomUC_ViewModel>());
                        }
                    }
                }
                if (!ReadingRoomUsage.ContainsKey("阅览室"))
                {
                    ReadingRoomUsage.Add("阅览室", new List <ReadingRoomUC_ViewModel>());
                }

                DateTime nowDateTime = SeatManage.Bll.ServiceDateTime.Now;
                Dictionary <string, ReadingRoomSeatUsedState> roomStateList = SeatManage.Bll.NowReadingRoomState.GetRoomSeatUsedState(clientObject.ClientSetting.DeviceSetting.Rooms);
                foreach (KeyValuePair <string, ReadingRoomInfo> item in clientObject.ReadingRoomList)
                {
                    if (item.Value.Area.AreaName == "")
                    {
                        item.Value.Area.AreaName = "阅览室";
                    }
                    if (roomStateList.ContainsKey(item.Key))
                    {
                        SeatManage.EnumType.ReadingRoomStatus roomStatus = SeatClientV2.Code.NowReadingRoomState.ReadingRoomOpenState(item.Value.Setting.RoomOpenSet, nowDateTime);
                        if (roomStatus == SeatManage.EnumType.ReadingRoomStatus.Close && !clientObject.ClientSetting.DeviceSetting.IsShowClosedRoom)
                        {
                            continue;
                        }
                        SeatClientV2.ViewModel.ReadingRoomUC_ViewModel viewModel = new ReadingRoomUC_ViewModel();
                        viewModel.ReadingRoomName  = item.Value.Name;
                        viewModel.ReadingRoomNo    = item.Value.No;
                        viewModel.IsBook           = item.Value.Setting.SeatBespeak.Used;
                        viewModel.AllSeatCount     = roomStateList[item.Key].SeatAmountAll;
                        viewModel.UsedSeatCount    = roomStateList[item.Key].SeatAmountUsed;
                        viewModel.BookingSeatCount = roomStateList[item.Key].SeatBookingCount;
                        viewModel.Usage            = roomStateList[item.Key].RoomSeatUsingState;
                        viewModel.Status           = roomStatus;
                        ReadingRoomUsage[item.Value.Area.AreaName].Add(viewModel);
                    }
                }
                //删除空区域
                List <string> deleteArea = new List <string>();
                foreach (KeyValuePair <string, List <ReadingRoomUC_ViewModel> > item in ReadingRoomUsage)
                {
                    if (item.Value.Count < 1)
                    {
                        deleteArea.Add(item.Key);
                    }
                }
                foreach (string a in deleteArea)
                {
                    ReadingRoomUsage.Remove(a);
                }
            }
            catch (Exception ex)
            {
                SeatManage.SeatManageComm.WriteLog.Write("加载阅览室遇到异常" + ex.Message);
                PopupWindow errorWindow = new PopupWindow(SeatManage.EnumType.TipType.Exception);
                errorWindow.ShowDialog();
            }
        }