/// <summary>
        /// 选座方式验证
        /// </summary>
        /// <param name="clientset">终端选座方式</param>
        /// <param name="roomSelectSeatSet">阅览室设置的选座方式</param>
        /// <returns></returns>
        public static SelectSeatMode ProvenSelectSeatMethod(ClientConfigV2 clientset, SeatChooseMethodSet roomSelectSeatSet)
        {
            SelectSeatMode method = SelectSeatMode.OptionalMode;

            if (clientset.SelectMethod == SelectSeatMode.Default)
            {
                method = NowReadingRoomState.RoomSelectSeatMode(roomSelectSeatSet, SeatManage.Bll.ServiceDateTime.Now);
            }
            else
            {
                method = clientset.SelectMethod;
            }
            return(method);
        }
 /// <summary>
 /// 暂离
 /// </summary>
 public void ShortLeave()
 {
     clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo;
     int newLogId = -1;
     clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂时离开,保留{1} {2}号座位{3}分钟",
         clientobject.ClientSetting.ClientNo,
         clientobject.EnterOutLogData.Student.AtReadingRoom.Name,
         clientobject.EnterOutLogData.Student.EnterOutLog.ShortSeatNo,
         NowReadingRoomState.GetSeatHoldTime(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatHoldTime, ServiceDateTime.Now));
     HandleResult result = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录
     if (result == HandleResult.Successed)
     {
         MessageWindow popWindow = new MessageWindow(MessageType.ShortLeave);
         popWindow.ShowDialog();
     }
     else
     {
         MessageWindow popWindow = new MessageWindow(MessageType.Exception);
         popWindow.ShowDialog();
     }
 }
        /// <summary>
        /// 选座操作
        /// </summary>
        public void ChooseSeat()
        {
            //进出记录相关属性赋值。
            clientobject.EnterOutLogData.EnterOutlog.EnterOutLogNo = SeatManage.SeatManageComm.SeatComm.RndNum();
            clientobject.EnterOutLogData.EnterOutlog.EnterOutState = SeatManage.EnumType.EnterOutLogType.SelectSeat;
            clientobject.EnterOutLogData.EnterOutlog.Flag          = SeatManage.EnumType.Operation.Reader;
            clientobject.EnterOutLogData.EnterOutlog.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;

            ReadingRoomWindow readingRoomWindow = new ReadingRoomWindow();

            readingRoomWindow.ShowDialog();
            switch (clientobject.EnterOutLogData.FlowControl)
            {
            case ClientOperation.Exit: return;

            case ClientOperation.SelectSeat: break;

            case ClientOperation.RandonSelect:
                string tempSeatNo = T_SM_Seat.RandomAllotSeat(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
                SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(tempSeatNo);
                if (lockseat == SeatLockState.Locked)    //座位锁定失败,则提示
                {
                    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);
                }
                else
                {
                    clientobject.EnterOutLogData.EnterOutlog.SeatNo = "";
                    MessageWindow popWindow = new MessageWindow(MessageType.SeatIsLocked);
                    popWindow.ShowDialog();
                }
                break;
            }
            //判断阅览室和座位号是否为空
            if (string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo) || string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                //如果阅览室编号或者座位号为空,则不执行插入操作。
                MessageWindow popWindow = new MessageWindow(MessageType.Exception);
                popWindow.ShowDialog();
                return;
            }
            int          newLogId = -1;
            HandleResult result   = EnterOutOperate.AddEnterOutLog(clientobject.EnterOutLogData.EnterOutlog, ref newLogId);//插入进出记录

            if (result == HandleResult.Successed)
            {
                T_SM_Seat.UnLockSeat(clientobject.EnterOutLogData.EnterOutlog.SeatNo);//记录插入成功,解锁座位
                if (clientobject.EnterOutLogData.WaitSeatLogModel != null)
                {
                    //等待记录的实体不为空,说明当前读者操作为等待座位。
                    //TODO:添加等待记录
                    clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID = newLogId;
                    T_SM_SeatWaiting.AddWaitSeatLog(clientobject.EnterOutLogData.WaitSeatLogModel);
                    PrintData data = new PrintData();
                    data.CardNo          = clientobject.EnterOutLogData.WaitSeatLogModel.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                    data.SecCardNo       = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    double timelength = NowReadingRoomState.GetSeatHoldTime(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatHoldTime, data.EnterTime);
                    data.WaitEndDateTime = data.EnterTime.AddMinutes(timelength);
                    if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip == PrintSlipMode.AutoPrint)
                    {
                        printer.ThreadPrint(PrintStatus.Wait, data, clientobject.ClientSetting.ClientNo);
                    }
                    if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip == PrintSlipMode.UserChoose)
                    {
                        MessageWindow printWindow = new MessageWindow(MessageType.PrintConfirm);
                        printWindow.ShowDialog();
                        if (printWindow.viewModel.OperateResule == HandleResult.Successed)
                        {
                            printer.ThreadPrint(PrintStatus.Wait, data, clientobject.ClientSetting.ClientNo);
                        }
                    }
                    //等待成功提示
                    MessageWindow popWindow = new MessageWindow(MessageType.WaitSeatSuccess);
                    popWindow.ShowDialog();
                }
                else
                {
                    PrintData data = new PrintData();
                    data.CardNo          = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    data.EnterTime       = ServiceDateTime.Now;
                    data.ReaderName      = clientobject.EnterOutLogData.Student.Name;
                    data.ReadingRoomName = clientobject.EnterOutLogData.Student.AtReadingRoom.Name;
                    data.SeatNo          = SeatComm.SeatNoToShortSeatNo(clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatNumAmount, clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                    if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip == PrintSlipMode.AutoPrint)
                    {
                        printer.ThreadPrint(PrintStatus.General, data, clientobject.ClientSetting.ClientNo);
                    }
                    if (clientobject.ClientSetting.DeviceSetting.UsingPrintSlip == PrintSlipMode.UserChoose)
                    {
                        MessageWindow printWindow = new MessageWindow(MessageType.PrintConfirm);
                        printWindow.ShowDialog();
                        if (printWindow.viewModel.OperateResule == HandleResult.Successed)
                        {
                            printer.ThreadPrint(PrintStatus.General, data, clientobject.ClientSetting.ClientNo);
                        }
                    }
                    //提示选座成功
                    MessageWindow popWindow = new MessageWindow(MessageType.SelectSeatSuccess);
                    popWindow.ShowDialog();
                }
            }
            else
            {
                MessageWindow popWindow = new MessageWindow(MessageType.SeatIsLocked);
                popWindow.ShowDialog();
            }
        }
        /// <summary>
        /// 暂离
        /// </summary>
        public void ShortLeave()
        {
            Clientobject.EnterOutLogData.EnterOutlog.TerminalNum = Clientobject.ClientSetting.ClientNo;
            int newLogId = -1;

            Clientobject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}刷卡暂时离开,保留{1} {2}号座位{3}分钟", Clientobject.ClientSetting.ClientNo, Clientobject.EnterOutLogData.Student.AtReadingRoom.Name, Clientobject.EnterOutLogData.Student.EnterOutLog.ShortSeatNo, NowReadingRoomState.GetSeatHoldTime(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatHoldTime, ServiceDateTime.Now));
            PopupWindowsObject.GetInstance().Window.ShowMessage(EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newLogId) == HandleResult.Successed ? TipType.ShortLeave : TipType.Exception);
        }