Пример #1
0
        /// <summary>
        /// 选座座位
        /// </summary>
        /// <param name="seatBtn"></param>
        /// <returns></returns>
        public bool SelectSeat(UsuallySeatUC_ViewModel seatBtn)
        {
            ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(seatBtn.ReadingRoomNo);

            ClientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//给读者所在的阅览室赋值。

            //验证读者身份是否允许选择该阅览室。
            if (!SelectSeatProven.ProvenReaderType(ClientObject.EnterOutLogData.Student, roomInfo.Setting))
            {
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReaderTypeInconformity);
                return(false);
            }
            //验证读者黑名单,选座次数。
            if (SelectSeatProven.ProvenReaderState(ClientObject.EnterOutLogData.Student, roomInfo, ClientObject.RegulationRulesSet.BlacklistSet, ClientObject.ClientSetting.DeviceSetting))
            {
                //ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                return(false);
            }
            SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);

            if (lockseat != SeatLockState.Locked) //座位成功加锁
            {
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SeatLocking);
                return(false);
            }

            ClientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
            ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = seatBtn.ReadingRoomName;
            PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SelectSeatConfinmed);
            if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule != HandleResult.Successed)
            {
                T_SM_Seat.UnLockSeat(seatBtn.SeatNo); //确认窗口点击取消或者自动关闭,则解锁。
                return(false);
            }
            ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = seatBtn.ReadingRoomName;
            ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = seatBtn.ReadingRoomNo;
            ClientObject.EnterOutLogData.EnterOutlog.SeatNo          = seatBtn.SeatNo;
            ClientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
            ClientObject.EnterOutLogData.EnterOutlog.TerminalNum     = ClientObject.ClientSetting.ClientNo;
            ClientObject.EnterOutLogData.FlowControl        = ClientOperation.SelectSeat; //操作为选择座位
            ClientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}选择常坐座位,{1},{2}号座位", ClientObject.ClientSetting.ClientNo, ClientObject.EnterOutLogData.Student.AtReadingRoom.Name, seatBtn.ShortSeatNo);
            return(true);
        }
        /// <summary>
        /// 进入阅览室前判断
        /// </summary>
        /// <param name="roomNo"></param>
        public void EnterReadingRoom(ReadingRoomUC_ViewModel vm_Room)
        {
            try
            {
                //ClientObject.EnterOutLogData.FlowControl = ClientOperation.Back;
                ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = vm_Room.ReadingRoomNo;
                ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(vm_Room.ReadingRoomNo);
                if (vm_Room.Status == ReadingRoomStatus.Close || vm_Room.Status == ReadingRoomStatus.BeforeClose)
                {
                    ClientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReadingRoomClosing);
                    ClientObject.EnterOutLogData.Student.AtReadingRoom = null;
                    return;
                }
                if (vm_Room.Usage == ReadingRoomUsingStatus.Full && (!roomInfo.Setting.NoManagement.Used))
                {
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReadingRoomFull);
                    return;
                }
                ClientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//给读者所在的阅览室赋值。

                //验证读者身份是否允许选择该阅览室。
                if (!SelectSeatProven.ProvenReaderType(ClientObject.EnterOutLogData.Student, roomInfo.Setting))
                {
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.ReaderTypeInconformity);
                    return;
                }
                //验证读者黑名单,选座次数。
                if (SelectSeatProven.ProvenReaderState(ClientObject.EnterOutLogData.Student, roomInfo, ClientObject.RegulationRulesSet.BlacklistSet, ClientObject.ClientSetting.DeviceSetting))
                {
                    ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                    return;
                }
                //TODO:验证终端选座方式
                if (vm_Room.Usage == ReadingRoomUsingStatus.Full && roomInfo.Setting.NoManagement.Used)
                {
                    ClientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat;
                    ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = roomInfo.No;
                    ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name;
                    //ReadingRoomWindowObject.GetInstance().Window.Hide();
                    RoomSeatWindowObject.GetInstance(roomInfo.No).Window[roomInfo.No].ShowMessage();
                }
                else
                {
                    SelectSeatMode selectSeatMethod = SelectSeatProven.ProvenSelectSeatMethod(ClientObject.ClientSetting.DeviceSetting, roomInfo.Setting.SeatChooseMethod);

                    if (selectSeatMethod == SelectSeatMode.OptionalMode || selectSeatMethod == SelectSeatMode.ManualMode)
                    {
                        ClientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat;
                        ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = roomInfo.No;
                        ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name;
                        //ReadingRoomWindowObject.GetInstance().Window.Hide();
                        RoomSeatWindowObject.GetInstance(roomInfo.No).Window[roomInfo.No].ShowMessage();
                    }
                    else
                    {
                        ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = roomInfo.No;
                        ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = roomInfo.Name;
                        string tempSeatNo = T_SM_Seat.RandomAllotSeat(ClientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
                        if (T_SM_Seat.LockSeat(tempSeatNo) != SeatLockState.Locked)//座位锁定失败,则提示
                        {
                            ClientObject.EnterOutLogData.EnterOutlog.SeatNo = "";
                            PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SeatLocking);
                            return;
                        }
                        ClientObject.EnterOutLogData.EnterOutlog.Remark      = string.Format("在终端{0}刷卡,自动选择{1} {2}号座位", ClientObject.ClientSetting.ClientNo, ClientObject.EnterOutLogData.Student.AtReadingRoom.Name, tempSeatNo.Substring(tempSeatNo.Length - ClientObject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount));
                        ClientObject.EnterOutLogData.EnterOutlog.SeatNo      = tempSeatNo;
                        ClientObject.EnterOutLogData.EnterOutlog.TerminalNum = ClientObject.ClientSetting.ClientNo;
                        ClientObject.EnterOutLogData.EnterOutlog.ShortSeatNo = SeatComm.SeatNoToShortSeatNo(ClientObject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, ClientObject.EnterOutLogData.EnterOutlog.SeatNo);
                        ClientObject.EnterOutLogData.FlowControl             = ClientOperation.SelectSeat; //操作为选择座位
                    }
                }
                //RoomSeatWindowObject.GetInstance(roomInfo.No).Window[roomInfo.No] = null;
            }
            catch (Exception ex)
            {
                WriteLog.Write("加载阅览室遇到异常" + ex.Message);
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
            }
        }
        /// <summary>
        /// Ñ¡Ôñ×ùλ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void roomButton_Click(object sender, EventArgs e)
        {
            SeatManage.MyUserControl.ReadingRoomButton room = sender as ReadingRoomButton;
            this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum;
            ReadingRoomInfo roomInfo = T_SM_ReadingRoom.GetSingleRoomInfo(room.RoomNum);

            if (room.SeatUsingStatus == ReadingRoomUsingStatus.Full && (!roomInfo.Setting.NoManagement.Used))
            {
                Tip_Framework tipForm = new Tip_Framework(TipType.ReadingRoomFull, 9);
                formClose.Pause();
                tipForm.ShowDialog();
                formClose.Start();
                return;
            }


            clientObject.EnterOutLogData.Student.AtReadingRoom = roomInfo;//¸ø¶ÁÕßËùÔÚµÄÔÄÀÀÊÒ¸³Öµ¡£

            //ÑéÖ¤¶ÁÕßÉí·ÝÊÇ·ñÔÊÐíÑ¡Ôñ¸ÃÔÄÀÀÊÒ¡£
            if (!SelectSeatProven.ProvenReaderType(clientObject.EnterOutLogData.Student, roomInfo.Setting))
            {
                Tip_Framework tipForm = new Tip_Framework(TipType.ReaderTypeInconformity, 9);
                formClose.Pause();
                tipForm.ShowDialog();
                formClose.Start();
                return;
            }
            //ÑéÖ¤¶ÁÕߺÚÃûµ¥£¬Ñ¡×ù´ÎÊý¡£
            if (SelectSeatProven.ProvenReaderState(clientObject.EnterOutLogData.Student, roomInfo, clientObject.RegulationRulesSet.BlacklistSet, clientObject.ClientSetting.DeviceSetting))
            {
                this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                return;
            }
            //TODO:ÑéÖ¤ÖÕ¶ËÑ¡×ù·½Ê½
            if (room.SeatUsingStatus == ReadingRoomUsingStatus.Full && roomInfo.Setting.NoManagement.Used)
            {
                this._RoomSelectSeatMethod = SelectSeatMode.ManualMode;
                this.clientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat;
                this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum;
                this.Close();
            }
            else
            {
                SelectSeatMode selectSeatMethod = SelectSeatProven.ProvenSelectSeatMethod(clientObject.ClientSetting.DeviceSetting, roomInfo.Setting.SeatChooseMethod);

                if (selectSeatMethod == SelectSeatMode.OptionalMode)
                {
                    ChooseSeatState frmChooseSeatState = new ChooseSeatState();
                    frmChooseSeatState.ShowDialog();
                    _RoomSelectSeatMethod = frmChooseSeatState.RoomSelectSeatMethod;
                    if (frmChooseSeatState.RoomSelectSeatMethod != SelectSeatMode.None)
                    {
                        this.clientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat;
                        this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum;
                        this.Close();
                    }
                    else
                    {
                        this.clientObject.EnterOutLogData.FlowControl = ClientOperation.None;
                        this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = "";
                    }
                }
                else
                {
                    this._RoomSelectSeatMethod = selectSeatMethod;
                    this.clientObject.EnterOutLogData.FlowControl = ClientOperation.SelectSeat;
                    this.clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo = room.RoomNum;
                    this.Close();
                }
            }
        }