コード例 #1
0
 public void ShowMessage()
 {
     viewModel.CloseTime = 60;
     viewModel.CountDown = new FormCloseCountdown(viewModel.CloseTime);
     viewModel.CountDown.EventCountdown += CountDown_EventCountdown;
     viewModel.CountDown.Start();
     viewModel.GetUsingState();
     canvas_Thumbnail.Children.RemoveRange(0, viewModel.Layout.Seats.Count);
     foreach (KeyValuePair <string, Seat> seat in viewModel.Layout.Seats)
     {
         #region 布局缩略图
         Rectangle rec = new Rectangle();
         rec.Name   = "recSeat_" + seat.Key;
         rec.Width  = 36 / scaleX;
         rec.Height = 36 / scaleY;
         double thumbLeft = (seat.Value.PositionX * 24 + 6) / scaleX;
         double thumbTop  = (seat.Value.PositionY * 24 + 6) / scaleY;
         if (viewModel.SeatLayoutList[seat.Key].IsStop || viewModel.SeatLayoutList[seat.Key].IsUsing)
         {
             rec.Fill = new SolidColorBrush(Color.FromRgb(234, 38, 52));
         }
         else
         {
             rec.Fill = new SolidColorBrush(Color.FromRgb(220, 220, 220));
         }
         rec.RenderTransformOrigin = new Point(0.5, 0.5);
         rec.RenderTransform       = new RotateTransform(seat.Value.RotationAngle);
         canvas_Thumbnail.Children.Insert(0, rec);
         Panel.SetZIndex(rec, 0);
         Canvas.SetLeft(rec, thumbLeft + moveX);
         Canvas.SetTop(rec, thumbTop + moveY);
         #endregion
     }
     if (viewModel.ClientObject.SeatAutoAddSize)
     {
         SystemObject clientObject = SystemObject.GetInstance();
         this.Height  = viewModel.WindowHeight += clientObject.AddSize;
         this.Top     = viewModel.WindowTop -= clientObject.AddSize;
         G_bg.Height += clientObject.AddSize;
         seatLayout();
         btn_MaxWindow.Visibility    = Visibility.Collapsed;
         btn_NormnlWindow.Visibility = Visibility.Visible;
         WPFMessage.MessageHelper.SendMessage(clientObject.MediaClient, SeatManage.EnumType.SendClentMessageType.MoveUp, clientObject.AddSize.ToString());
         WeiCharOperationWindowObject.GetInstance().Window.WinChange((int)(Top));
     }
     //this.Topmost = true;
     this.Owner = ReadingRoomWindowObject.GetInstance().Window;
     //ReadingRoomWindowObject.GetInstance().Window.Hide();
     this.Topmost = true;
     this.Topmost = false;
     ShowDialog();
 }
コード例 #2
0
        public void ShowMessage()
        {
            viewModel.CloseTime = 60;
            viewModel.CountDown = new FormCloseCountdown(viewModel.CloseTime);
            viewModel.CountDown.EventCountdown += CountDown_EventCountdown;
            viewModel.CountDown.Start();

            this.viewModel.LastSeatCount = this.viewModel.AllSeatCount;
            this.viewModel.Layout        = EnterOutOperate.GetRoomSeatLayOut(this.viewModel.ReadingRoomNo);
            foreach (object obj in this.canvas_Seat.Children)
            {
                try
                {
                    if (obj.GetType().Name == "UC_Seat")
                    {
                        UC_Seat          UC     = obj as UC_Seat;
                        Seat             value  = this.viewModel.Layout.Seats.Where(p => p.Value.SeatNo == UC.ViewModel.LongSeatNo).FirstOrDefault().Value;
                        SeatUC_ViewModel value2 = this.viewModel.SeatLayoutList.Where(p => p.Value.LongSeatNo == UC.ViewModel.LongSeatNo).FirstOrDefault().Value;
                        if (value == null || value2 == null)
                        {
                            continue;
                        }
                        UC.ViewModel              = value2;
                        UC.ViewModel.IsBespeak    = false;
                        UC.ViewModel.IsShortLeave = false;
                        UC.ViewModel.IsUsing      = false;
                        switch (value.SeatUsedState)
                        {
                        case EnterOutLogType.Leave:
                            UC.ViewModel.IsUsing      = false;
                            UC.ViewModel.IsBespeak    = false;
                            UC.ViewModel.IsShortLeave = false;
                            UC.ViewModel.IsWaiting    = false;
                            break;

                        case EnterOutLogType.SelectSeat:
                        case EnterOutLogType.ReselectSeat:
                        case EnterOutLogType.ComeBack:
                        case EnterOutLogType.ContinuedTime:
                        case EnterOutLogType.BookingConfirmation:
                        case EnterOutLogType.WaitingSuccess:
                        {
                            UC.ViewModel.IsUsing      = true;
                            UC.ViewModel.IsBespeak    = false;
                            UC.ViewModel.IsShortLeave = false;
                            UC.ViewModel.IsWaiting    = false;
                            this.viewModel.LastSeatCount--;
                            break;
                        }

                        case EnterOutLogType.ShortLeave:
                        {
                            UC.ViewModel.IsUsing      = true;
                            UC.ViewModel.IsShortLeave = true;
                            UC.ViewModel.IsBespeak    = false;
                            UC.ViewModel.IsWaiting    = false;
                            this.viewModel.LastSeatCount--;
                            break;
                        }

                        case EnterOutLogType.BespeakWaiting:
                        {
                            UC.ViewModel.IsUsing      = false;
                            UC.ViewModel.IsBespeak    = true;
                            UC.ViewModel.IsShortLeave = false;
                            UC.ViewModel.IsWaiting    = false;
                            if (!UC.ViewModel.IsCanSelectBespeakSeat)
                            {
                                this.viewModel.LastSeatCount--;
                            }
                            break;
                        }
                        }
                        UC.Background         = UC.ViewModel.SeatStateImage;
                        UC.ReaderImg.Fill     = UC.ViewModel.ReaderStateImage;
                        UC.PowerImg.Fill      = UC.ViewModel.PowerImage;
                        UC.ShortleaveImg.Fill = UC.ViewModel.ShortLeaveImage;
                        UC.BespeakImg.Fill    = UC.ViewModel.BespeakImage;
                    }
                    if (obj.GetType().Name == "Rectangle")
                    {
                        Rectangle rectangle = obj as Rectangle;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }

            canvas_Thumbnail.Children.RemoveRange(0, viewModel.Layout.Seats.Count);
            seatLayout_thumb();
            if (viewModel.ClientObject.SeatAutoAddSize)
            {
                SystemObject clientObject = SystemObject.GetInstance();
                this.Height  = viewModel.WindowHeight += clientObject.AddSize;
                this.Top     = viewModel.WindowTop -= clientObject.AddSize;
                G_bg.Height += clientObject.AddSize;
                seatLayout();
                btn_MaxWindow.Visibility    = Visibility.Collapsed;
                btn_NormnlWindow.Visibility = Visibility.Visible;
                WPFMessage.MessageHelper.SendMessage(clientObject.MediaClient, SeatManage.EnumType.SendClentMessageType.MoveUp, clientObject.AddSize.ToString());
                WeiCharOperationWindowObject.GetInstance().Window.WinChange((int)(Top));
            }
            //this.Topmost = true;
            this.Owner = ReadingRoomWindowObject.GetInstance().Window;
            //ReadingRoomWindowObject.GetInstance().Window.Hide();
            this.Topmost = true;
            this.Topmost = false;
            ShowDialog();
        }
        /// <summary>
        /// 选座操作
        /// </summary>
        public void ChooseSeat()
        {
            //进出记录相关属性赋值。
            Clientobject.EnterOutLogData.EnterOutlog.EnterOutLogNo = SeatComm.RndNum();
            Clientobject.EnterOutLogData.EnterOutlog.EnterOutState = EnterOutLogType.SelectSeat;
            Clientobject.EnterOutLogData.EnterOutlog.Flag          = Operation.Reader;
            Clientobject.EnterOutLogData.EnterOutlog.EnterOutType  = LogStatus.Valid;
            ReadingRoomWindowObject.GetInstance().Window.ShowMessage();
            //阅览室选座操作为退出,结束选座流程
            if (Clientobject.EnterOutLogData.FlowControl == ClientOperation.Exit)
            {
                return;
            }
            //返回为自动选座
            if (string.IsNullOrEmpty(Clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo) || string.IsNullOrEmpty(Clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                //如果阅览室编号或者座位号为空,则不执行插入操作。
                if (!string.IsNullOrEmpty(Clientobject.EnterOutLogData.EnterOutlog.SeatNo))
                {
                    T_SM_Seat.UnLockSeat(Clientobject.EnterOutLogData.EnterOutlog.SeatNo);
                }
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
                return;
            }
            int newLogId = -1;

            if (EnterOutOperate.AddEnterOutLog(Clientobject.EnterOutLogData.EnterOutlog, ref newLogId) == HandleResult.Failed)
            {
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
                return;
            }
            T_SM_Seat.UnLockSeat(Clientobject.EnterOutLogData.EnterOutlog.SeatNo);//记录插入成功,解锁座位

            if (Clientobject.EnterOutLogData.FlowControl == ClientOperation.WaitSeat)
            {
                //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo();
                //rni.CardNo = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                //rni.Type = NoticeType.OtherSetShortLeaveWarning;
                //rni.Note = Clientobject.EnterOutLogData.EnterOutlog.Remark;
                //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni);

                //PushMsgInfo msg = new PushMsgInfo();
                //msg.Title = "您好,您已被设置为暂离";
                //msg.MsgType = MsgPushType.OtherUser;
                //msg.StudentNum = Clientobject.EnterOutLogData.EnterOutlog.CardNo;
                //msg.Message = Clientobject.EnterOutLogData.EnterOutlog.Remark;
                //SeatManage.Bll.T_SM_ReaderNotice.SendPushMsg(msg);

                //TODO:添加等待记录
                Clientobject.EnterOutLogData.WaitSeatLogModel.EnterOutLogID = newLogId;
                if (T_SM_SeatWaiting.AddWaitSeatLog(Clientobject.EnterOutLogData.WaitSeatLogModel) > 0)
                {
                    PrintData data;
                    switch (Clientobject.ClientSetting.DeviceSetting.UsingPrintSlip)
                    {
                    case PrintSlipMode.AutoPrint:
                        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;
                        data.WaitEndDateTime = data.EnterTime.AddMinutes(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.GetSeatHoldTime(data.EnterTime));

                        printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo);
                        break;

                    case PrintSlipMode.UserChoose:
                        PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.PrintConfIrm);
                        if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule == HandleResult.Successed)
                        {
                            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;
                            data.WaitEndDateTime = data.EnterTime.AddMinutes(Clientobject.EnterOutLogData.Student.AtReadingRoom.Setting.GetSeatHoldTime(data.EnterTime));

                            printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo);
                        }
                        break;

                    case PrintSlipMode.NotPrint:
                        break;
                    }
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.WaitSeatSuccess);
                }
                else
                {
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.Exception);
                }
            }
            else
            {
                PrintData data;
                switch (Clientobject.ClientSetting.DeviceSetting.UsingPrintSlip)
                {
                case PrintSlipMode.AutoPrint:
                    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);

                    printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo);
                    break;

                case PrintSlipMode.UserChoose:
                    PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.PrintConfIrm);
                    if (PopupWindowsObject.GetInstance().Window.ViewModel.OperateResule == HandleResult.Successed)
                    {
                        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);

                        printer.ThreadPrint(PrintStatus.General, data, Clientobject.ClientSetting.ClientNo);
                    }
                    break;

                case PrintSlipMode.NotPrint:
                    break;
                }
                //提示选座成功
                PopupWindowsObject.GetInstance().Window.ShowMessage(TipType.SelectSeatResult);
            }
        }