Example #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);
            }
        }
Example #3
0
        void seatBtn_Click(object sender, EventArgs e)
        {
            try
            {
                OftenUsedSeatButton seatBtn = sender as OftenUsedSeatButton;
                if (string.IsNullOrEmpty(seatBtn.SeatNo))
                {
                    return;
                }
                ReadingRoomInfo roomInfo = clientobject.ReadingRoomList[seatBtn.ReadingRoomNo];
                if (seatBtn != null)
                {
                    #region 验证黑名单
                    if (SelectSeatProven.ProvenReaderState(clientobject.EnterOutLogData.Student, roomInfo, clientobject.RegulationRulesSet.BlacklistSet, clientobject.ClientSetting.DeviceSetting))
                    {
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                        return;
                    }
                    #endregion

                    #region 检查阅览室当前状态
                    ReadingRoomStatus roomState = NowReadingRoomState.ReadingRoomOpenState(roomInfo.Setting.RoomOpenSet, ServiceDateTime.Now);
                    if (roomState == ReadingRoomStatus.Close || roomState == ReadingRoomStatus.BeforeClose)
                    {
                        SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.ReadingRoomClosing, 7);//显示提示窗体
                        tip.ShowDialog();
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                        return;
                    }
                    #endregion


                    #region 锁定座位。
                    SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
                    if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
                    {
                        string roomName = seatBtn.ReadingRoomName;
                        string seatNo   = seatBtn.ShortSeatNo;
                        clientobject.EnterOutLogData.Student.AtReadingRoom     = roomInfo;
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo        = seatBtn.SeatNo;
                        clientobject.EnterOutLogData.EnterOutlog.TerminalNum   = clientobject.ClientSetting.ClientNo;
                        clientobject.EnterOutLogData.FlowControl               = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
                        clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo = seatBtn.ReadingRoomNo;
                        clientobject.EnterOutLogData.EnterOutlog.Remark        = string.Format("在终端{0}选择常坐座位,{1},{2}号座位", clientobject.ClientSetting.ClientNo, roomName, seatNo);
                        this.Close();
                        this.Dispose();
                    }
                    else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)                                                                             //没有成功加锁
                    {
                        SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.SeatLocking, 7); //显示提示窗体
                        tip.ShowDialog();
                        clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write(string.Format("选择常坐座位遇到异常:{0}", ex.Message));
                SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.Exception, 7);//显示提示窗体
                tip.ShowDialog();
                clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
            }
        }
        /// <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();
                }
            }
        }