Esempio n. 1
0
        private void AddSeats(byte hallId, int posterId, Panel panel)
        {
            Hall hall = db.Halls.FirstOrDefault(m => m.Id == hallId);

            if (hall != null)
            {
                int  randomRowIdOfHall      = db.Rows.First(m => m.HallId == hall.Id).Id;
                byte countOfRandomRowSeats  = (byte)db.Seats.Where(k => k.RowId == randomRowIdOfHall).Count();
                int  MarginFromLeftAndRight = 5;
                int  MarginFromTop          = 5;
                int  TopPosition            = MarginFromTop;
                int  LeftPosition           = MarginFromLeftAndRight;
                byte WidthOfOneSeat         = (panel != null) ? (byte)((panel.Width - countOfRandomRowSeats * MarginFromLeftAndRight - 15) / countOfRandomRowSeats) : (byte)10;
                byte HeightOfOneSeat        = WidthOfOneSeat;

                foreach (Row row in db.Rows.Where(m => m.HallId == hallId).OrderBy(m => m.Number))
                {
                    foreach (Seat seat in db.Seats.Where(k => k.RowId == row.Id).OrderBy(k => k.Number))
                    {
                        SeatButton seatButton = new SeatButton(posterId, seat.Id)
                        {
                            Left      = LeftPosition,
                            Top       = TopPosition,
                            Width     = WidthOfOneSeat,
                            Height    = HeightOfOneSeat,
                            Text      = seat.Number.ToString(),
                            BackColor = (db.Tickets.Any(m => m.SeatId == seat.Id && m.SeansId == posterId))?Color.Black:Color.LightGray,
                            Enabled   = (db.Tickets.Any(m => m.SeatId == seat.Id && m.SeansId == posterId))?false:true
                        };
                        seatButton.Click += new EventHandler(SelectSeat);
                        panel.Controls.Add(seatButton);
                        LeftPosition += WidthOfOneSeat + MarginFromLeftAndRight;
                    }
                    LeftPosition = MarginFromLeftAndRight;
                    TopPosition += HeightOfOneSeat + MarginFromTop * 2;
                }
                Button ekran = new Button()
                {
                    Width  = panel.Width - 15 - MarginFromLeftAndRight * 2,
                    Height = 50,
                    Text   = "Ekran",
                    Left   = LeftPosition,
                    Top    = TopPosition,
                };
                panel.Controls.Add(ekran);
            }
            else
            {
                MessageBox.Show("Tekniki seflik bash vermishdir . Bir daha daxil olmaga calishin .");
                this.Hide();
                AboutForm.Show();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 选座座位
 /// </summary>
 /// <param name="seatBtn"></param>
 /// <returns></returns>
 public bool SelectSeat(SeatButton seatBtn)
 {
     SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
     if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
     {
         clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
         clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = _ReadingRoomName;
         clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = _ReadingRoomNo;
         MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SelectSeatConfirm);
         CountDown.Pause();
         popWindow.ShowDialog();
         CountDown.Start();
         if (popWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Successed)
         {
             clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = _ReadingRoomName;
             clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = _ReadingRoomNo;
             clientObject.EnterOutLogData.EnterOutlog.SeatNo          = seatBtn.SeatNo;
             clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
             clientObject.EnterOutLogData.EnterOutlog.TerminalNum     = clientObject.ClientSetting.ClientNo;
             clientObject.EnterOutLogData.FlowControl        = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
             clientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}手动选择,{1},{2}号座位", clientObject.ClientSetting.ClientNo, clientObject.EnterOutLogData.Student.AtReadingRoom.Name, seatBtn.ShortSeatNo);
             RoomSelectSeatMethod = SeatManage.EnumType.SelectSeatMode.ManualMode;
             return(true);
         }
         else
         {
             T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
         }
     }
     else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)//没有成功加锁
     {
         MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatIsLocked);
         CountDown.Pause();
         popWindow.ShowDialog();
         CountDown.Start();
     }
     else if (lockseat == SeatManage.EnumType.SeatLockState.NotExists)
     {
         MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatNotExist);
         CountDown.Pause();
         popWindow.ShowDialog();
         CountDown.Start();
     }
     return(false);
 }
Esempio n. 3
0
        private void SelectSeat(object sender, EventArgs e)
        {
            SeatButton seatButton = sender as SeatButton;

            if (!SelectedSeats.Any(m => m == seatButton))
            {
                seatButton.BackColor = Color.Red;
                SelectedSeats.Add(seatButton);
                Count++;
                Price        += (int)db.Seans.FirstOrDefault(m => m.Id == PosterId).Price;
                lblCount.Text = Count.ToString();
                lblPrice.Text = Price.ToString() + " azn";
            }
            else
            {
                Count--;
                Price               -= (int)db.Seans.FirstOrDefault(m => m.Id == PosterId).Price;
                lblCount.Text        = Count.ToString();
                lblPrice.Text        = Price.ToString() + " azn";
                seatButton.BackColor = Color.LightGray;
                SelectedSeats.Remove(seatButton);
            }
        }
Esempio n. 4
0
        void seatBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            SeatButton seatBtn = sender as SeatButton;

            SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
            if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
            {
                string roomName = frmResolution.ViewModel.RoomName;
                string seatNo   = seatBtn.ShortSeatNo;
                TipForm_SelectSeatConfinmed tip = new TipForm_SelectSeatConfinmed(roomName, seatNo, frmResolution.ViewModel.CountDownSeconds);//显示提示窗体
                countDownSeconds.Pause();
                tip.ShowDialog();
                countDownSeconds.Start();
                if (tip.IsTrue)
                {
                    clientobject.EnterOutLogData.EnterOutlog.SeatNo      = seatBtn.SeatNo;
                    clientobject.EnterOutLogData.EnterOutlog.TerminalNum = clientobject.ClientSetting.ClientNo;
                    clientobject.EnterOutLogData.FlowControl             = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
                    clientobject.EnterOutLogData.EnterOutlog.Remark      = string.Format("在终端{0}手动选择,{1},{2}号座位", clientobject.ClientSetting.ClientNo, clientobject.EnterOutLogData.Student.AtReadingRoom.Name, seatBtn.ShortSeatNo);
                    this.Hide();
                }
                else
                {
                    T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)                                                                                                                    //没有成功加锁
            {
                SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.SeatLocking, frmResolution.ViewModel.CountDownSeconds); //显示提示窗体
                tip.ShowDialog();

                drowSeatLayout();
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.NotExists)
            {
            }
        }
        void seatLayout()
        {
            this.canvas_Thumbnail.Children.Clear();
            this.canvas_Seat.Children.Clear();//座位图中移除所有子元素

            viewModel.AllSeatCount = viewModel.Layout.Seats.Count;

            int SeatWidth  = 24 * viewModel.Layout.SeatCol;
            int SeatHeight = 24 * viewModel.Layout.SeatRow;

            this.canvas_Seat.Width  = SeatWidth;
            this.canvas_Seat.Height = SeatHeight;
            double areaScaleX = SeatWidth / SeatWindow.Width;
            double areaScaleY = SeatHeight / SeatWindow.Height;

            if (SeatWidth >= SeatHeight)
            {
                scaleX = SeatWidth / canvas_Thumbnail.Width;
                scaleY = SeatWidth / canvas_Thumbnail.Height;
                moveY  = (SeatWidth - SeatHeight) / 2 / scaleY;
            }
            else
            {
                scaleX = SeatHeight / canvas_Thumbnail.Width;
                scaleY = SeatHeight / canvas_Thumbnail.Height;
                moveX  = (SeatHeight - SeatWidth) / 2 / scaleX;
            }
            //scaleX = SeatWidth / canvas_Thumbnail.Width;
            //scaleY = SeatHeight / canvas_Thumbnail.Height;

            try
            {
                Canvas.SetLeft(canvas_Seat, 0);
                Canvas.SetTop(canvas_Seat, 0);
            }
            catch
            { }

            #region 布局座位
            Code.GetSeatNoteImage getImage = new GetSeatNoteImage();
            ReadingRoomInfo       roomInfo = viewModel.clientObject.EnterOutLogData.Student.AtReadingRoom;
            DateTime startTime             = DateTime.Now;
            foreach (Seat seat in viewModel.Layout.Seats.Values)
            {
                seat.ShortSeatNo = SeatComm.SeatNoToShortSeatNo(roomInfo.Setting.SeatNumAmount, seat.SeatNo);
                #region 布局实际图,
                double     canLeft = 24 * (double)seat.PositionX;
                double     canTop  = 24 * (double)seat.PositionY;
                SeatButton seatBtn = new SeatButton();
                seatBtn.Width       = 48;
                seatBtn.Height      = 48;
                seatBtn.ShortSeatNo = seat.ShortSeatNo;
                seatBtn.SeatNo      = seat.SeatNo;
                seatBtn.Background  = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgSeat;
                if (seat.HavePower)
                {
                    seatBtn.PowerImg = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgPower;
                }
                switch (seat.SeatUsedState)
                {
                case SeatManage.EnumType.EnterOutLogType.Leave:
                    if (seat.IsSuspended)
                    {
                        seatBtn.ReaderBackground = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgStopUse;
                        viewModel.AllSeatCount  -= 1;
                    }
                    else
                    {
                        seatBtn.MouseLeftButtonUp   += new MouseButtonEventHandler(seatBtn_MouseLeftButtonUp);
                        viewModel.LastSeatCount     += 1;
                        seatBtn.lblSeatNo.Visibility = System.Windows.Visibility.Visible;
                    }
                    //frmResolution.ViewModel.SeatAmcountFree += 1;//遇到空闲座位,ViewModel空闲座位数+1
                    //seatBtn.MouseLeftButtonUp += new MouseButtonEventHandler(seatBtn_MouseLeftButtonUp);
                    break;

                case SeatManage.EnumType.EnterOutLogType.SelectSeat:
                case SeatManage.EnumType.EnterOutLogType.ReselectSeat:
                case SeatManage.EnumType.EnterOutLogType.ComeBack:
                case SeatManage.EnumType.EnterOutLogType.ContinuedTime:
                case SeatManage.EnumType.EnterOutLogType.BookingConfirmation:
                case SeatManage.EnumType.EnterOutLogType.WaitingSuccess:
                    seatBtn.ReaderBackground = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgReader;
                    if (roomInfo.Setting.NoManagement.Used)
                    {
                        seatBtn.MouseLeftButtonUp += new MouseButtonEventHandler(seatBtn_WaitSeat);
                    }
                    break;

                case SeatManage.EnumType.EnterOutLogType.ShortLeave:
                    seatBtn.ReaderBackground = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgReader;
                    seatBtn.ShowleaveImg     = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgShortLeave;
                    break;

                case SeatManage.EnumType.EnterOutLogType.BespeakWaiting:
                    seatBtn.ReaderBackground = SeatFormImageBrush.GetInstance(viewModel.clientObject.ClientSetting.DeviceSetting.BackImgage).ImgBook;
                    if (roomInfo.Setting.SeatBespeak.SelectBespeakSeat)
                    {
                        seatBtn.MouseLeftButtonUp += new MouseButtonEventHandler(seatBtn_SelectBookingSeat);
                    }
                    break;
                }
                seatBtn.lblSeatNo.RenderTransform       = new RotateTransform(-seat.RotationAngle);
                seatBtn.lblSeatNo.RenderTransformOrigin = new Point(0.5, 0.5);
                seatBtn.RenderTransform       = new RotateTransform(seat.RotationAngle);
                seatBtn.RenderTransformOrigin = new Point(0.5, 0.5);
                this.canvas_Seat.Children.Add(seatBtn);
                Canvas.SetLeft(seatBtn, canLeft);
                Canvas.SetTop(seatBtn, canTop);
                #endregion

                #region 布局缩略图
                Rectangle rec = new Rectangle();
                rec.Width  = 36 / scaleX;
                rec.Height = 36 / scaleY;
                double thumbLeft = (double)(seat.PositionX * (double)24 + 6) / scaleX;
                double thumbTop  = (double)(seat.PositionY * (double)24 + 6) / scaleY;
                switch (seat.SeatUsedState)
                {
                case SeatManage.EnumType.EnterOutLogType.Leave:
                    rec.Fill = new SolidColorBrush(Color.FromRgb(220, 220, 220));
                    if (seat.IsSuspended)
                    {
                        rec.Fill = new SolidColorBrush(Color.FromRgb(234, 38, 52));
                    }
                    break;

                case SeatManage.EnumType.EnterOutLogType.SelectSeat:
                case SeatManage.EnumType.EnterOutLogType.ReselectSeat:
                case SeatManage.EnumType.EnterOutLogType.ComeBack:
                case SeatManage.EnumType.EnterOutLogType.ContinuedTime:
                case SeatManage.EnumType.EnterOutLogType.ShortLeave:
                case SeatManage.EnumType.EnterOutLogType.BespeakWaiting:
                case SeatManage.EnumType.EnterOutLogType.BookingConfirmation:
                case SeatManage.EnumType.EnterOutLogType.WaitingSuccess:
                    rec.Fill = new SolidColorBrush(Color.FromRgb(234, 38, 52));
                    break;
                }
                rec.RenderTransformOrigin = new Point(0.5, 0.5);
                rec.RenderTransform       = new RotateTransform(seat.RotationAngle);
                this.canvas_Thumbnail.Children.Add(rec);
                Canvas.SetZIndex(rec, 0);
                Canvas.SetLeft(rec, thumbLeft + moveX);
                Canvas.SetTop(rec, thumbTop + moveY);
                #endregion
            }
            TimeSpan ts = DateTime.Now - startTime;
            Console.WriteLine("执行时间:" + ts.TotalSeconds);
            //frmResolution.ViewModel.SeatAmcountUsed = frmResolution.ViewModel.SeatAmcountAll - frmResolution.ViewModel.SeatAmcountFree;
            #endregion

            #region 布局备注
            foreach (Note note in viewModel.Layout.Notes)
            {
                #region 实际图

                NoteElement element = new NoteElement();
                if (note.Type == SeatManage.EnumType.OrnamentType.Table)
                {
                    element.BorderThickness = new Thickness(1);
                    element.BorderBrush     = new SolidColorBrush(Colors.Black);
                }
                //element.BorderThickness = new Thickness(1);
                //element.BorderBrush = new SolidColorBrush(Colors.Yellow);
                element.Width  = note.BaseWidth * 24;
                element.Height = note.BaseHeight * 24;
                element.Notes  = note.Remark;
                element.RenderTransformOrigin = new Point(0.5, 0.5);
                element.RenderTransform       = new RotateTransform(note.RotationAngle);
                element.NoteType = note.Type;
                Canvas.SetLeft(element.lbRemark, element.Width / 2 - element.lbRemark.Width / 2);
                this.canvas_Seat.Children.Add(element);
                double canLeft = 24 * (double)note.PositionX;
                double canTop  = 24 * (double)note.PositionY;
                Canvas.SetLeft(element, canLeft);
                Canvas.SetTop(element, canTop);
                #endregion

                #region 缩略图

                switch (note.Type)
                {
                case SeatManage.EnumType.OrnamentType.Door:
                case SeatManage.EnumType.OrnamentType.Steps:
                    break;

                case SeatManage.EnumType.OrnamentType.Roundtable:
                case SeatManage.EnumType.OrnamentType.Plant:
                {
                    Border br = new Border();
                    br.CornerRadius    = new CornerRadius(note.BaseWidth * (double)12 / scaleX);
                    br.BorderThickness = new Thickness(note.BaseWidth * (double)12 / scaleX);
                    br.BorderBrush     = new SolidColorBrush(Color.FromRgb(231, 186, 100));
                    double thumbLeft = (double)(24 / scaleX) * (double)note.PositionX;
                    double thumbTop  = (double)(24 / scaleY) * (double)note.PositionY;
                    this.canvas_Thumbnail.Children.Add(br);
                    Canvas.SetLeft(br, thumbLeft + moveX);
                    Canvas.SetTop(br, thumbTop + moveY);
                }
                break;

                default:
                {
                    Rectangle rec = new Rectangle();
                    rec.Width  = (double)24 * note.BaseWidth / scaleX;
                    rec.Height = (double)24 * note.BaseHeight / scaleY;
                    double thumbLeft = (double)(24 / scaleX) * (double)note.PositionX;
                    double thumbTop  = (double)(24 / scaleY) * (double)note.PositionY;
                    rec.RenderTransformOrigin = new Point(0.5, 0.5);
                    rec.RenderTransform       = new RotateTransform(note.RotationAngle);
                    rec.Fill = new SolidColorBrush(Color.FromRgb(231, 186, 100));
                    this.canvas_Thumbnail.Children.Add(rec);
                    Canvas.SetLeft(rec, thumbLeft + moveX);
                    Canvas.SetTop(rec, thumbTop + moveY);
                }
                break;
                }

                #endregion
            }
            #endregion


            areaSimle      = new System.Windows.Shapes.Rectangle();
            areaSimle.Name = "areaSimle";
            if (areaScaleX != 0)
            {
                areaSimle.Width = (canvas_Thumbnail.Width - moveX * 2) / areaScaleX;//按比例缩小层的宽度
            }
            else
            {
                areaSimle.Width = canvas_Thumbnail.Width;
            }
            if (areaScaleY != 0)
            {
                areaSimle.Height = (canvas_Thumbnail.Height - moveY * 2) / areaScaleY; //按比例缩小层的高度
            }
            else
            {
                areaSimle.Height = canvas_Thumbnail.Height;
            }

            areaSimle.Fill    = new SolidColorBrush(Colors.White);
            areaSimle.Opacity = 0.5;

            this.canvas_Thumbnail.Children.Add(areaSimle);
            Canvas.SetZIndex(areaSimle, 1000);
            Canvas.SetTop(areaSimle, moveY);
            Canvas.SetLeft(areaSimle, moveX);
            //小的范围层。最后创建,防止被遮盖
        }
Esempio n. 6
0
        /// <summary>
        /// 选择预约的座位
        /// </summary>
        /// <param name="seatBtn"></param>
        /// <returns></returns>
        public bool SelectBookingSeat(SeatButton seatBtn)
        {
            DateTime datetimeNow = SeatManage.Bll.ServiceDateTime.Now;
            List <SeatManage.ClassModel.BespeakLogInfo> bespeakLogList = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoBySeatNo(seatBtn.SeatNo, datetimeNow.Date);

            if (bespeakLogList.Count > 0)
            {
                if (bespeakLogList[0].BsepeakTime.AddMinutes(-double.Parse(clientObject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatBespeak.ConfirmTime.BeginTime)) <= datetimeNow)
                {
                    MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatIsBespaeked);
                    CountDown.Pause();
                    popWindow.ShowDialog();
                    CountDown.Start();
                    return(false);
                }
                else
                {
                    clientObject.EnterOutLogData.BespeakLogInfo = bespeakLogList[0];
                    MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SelectBespeakSeatConfrim);
                    CountDown.Pause();
                    popWindow.ShowDialog();
                    CountDown.Start();
                    if (popWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Failed)
                    {
                        clientObject.EnterOutLogData.BespeakLogInfo = null;
                        return(false);
                    }
                }
            }
            else
            {
                SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
                if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
                {
                    clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
                    clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = _ReadingRoomName;
                    clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = _ReadingRoomNo;
                    MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SelectBespeakSeatConfrim);
                    CountDown.Pause();
                    popWindow.ShowDialog();
                    CountDown.Start();

                    if (popWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Failed)
                    {
                        T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                        return(false);
                    }
                }
                else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)//没有成功加锁
                {
                    MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatIsLocked);
                    CountDown.Pause();
                    popWindow.ShowDialog();
                    CountDown.Start();
                    return(false);
                }
                else if (lockseat == SeatManage.EnumType.SeatLockState.NotExists)
                {
                    MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatNotExist);
                    CountDown.Pause();
                    popWindow.ShowDialog();
                    CountDown.Start();
                    return(false);
                }
            }
            clientObject.EnterOutLogData.EnterOutlog.ReadingRoomName = _ReadingRoomName;
            clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo   = _ReadingRoomNo;
            clientObject.EnterOutLogData.EnterOutlog.SeatNo          = seatBtn.SeatNo;
            clientObject.EnterOutLogData.EnterOutlog.ShortSeatNo     = seatBtn.ShortSeatNo;
            clientObject.EnterOutLogData.EnterOutlog.TerminalNum     = clientObject.ClientSetting.ClientNo;
            clientObject.EnterOutLogData.FlowControl        = SeatManage.EnumType.ClientOperation.SelectSeat; //操作为选择座位
            clientObject.EnterOutLogData.EnterOutlog.Remark = string.Format("在终端{0}手动选择,{1},{2}号座位", clientObject.ClientSetting.ClientNo, clientObject.EnterOutLogData.Student.AtReadingRoom.Name, seatBtn.ShortSeatNo);
            return(true);
        }
Esempio n. 7
0
        /// <summary>
        /// 等待座位
        /// </summary>
        /// <returns></returns>
        public bool WaitSeat(SeatButton seatBtn)
        {
            WaitSeatLogInfo lastWaitInfo = T_SM_SeatWaiting.GetListWaitLogByCardNo(clientObject.EnterOutLogData.EnterOutlog.CardNo, clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
            ReadingRoomInfo roomInfo     = clientObject.EnterOutLogData.Student.AtReadingRoom;


            if (!string.IsNullOrEmpty(clientObject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.WaitSeatWithSeat);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                return(false);
            }

            if (lastWaitInfo != null && lastWaitInfo.SeatWaitTime.AddMinutes(roomInfo.Setting.NoManagement.OperatingInterval).CompareTo(ServiceDateTime.Now) >= 0)
            {
                clientObject.EnterOutLogData.Student.WaitSeatLog = lastWaitInfo;
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.WaitSeatFrequent);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                return(false);
            }
            SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
            if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
            {
                clientObject.EnterOutLogData.WaitSeatLogModel = new WaitSeatLogInfo()
                {
                    SeatNo = seatBtn.ShortSeatNo
                };
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.WaitSeatConfirm);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
                if (popWindow.viewModel.OperateResule == SeatManage.EnumType.HandleResult.Successed)
                {
                    //初始化等待记录 记录ID需要待执行之后添加。
                    WaitSeatLogInfo waitInfo = new WaitSeatLogInfo();
                    waitInfo.CardNo       = clientObject.EnterOutLogData.EnterOutlog.CardNo;
                    waitInfo.NowState     = SeatManage.EnumType.LogStatus.Valid;
                    waitInfo.OperateType  = SeatManage.EnumType.Operation.Reader;
                    waitInfo.WaitingState = SeatManage.EnumType.EnterOutLogType.Waiting;

                    EnterOutLogInfo seatUsingEnterOutInfo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatBtn.SeatNo);
                    seatUsingEnterOutInfo.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
                    seatUsingEnterOutInfo.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
                    seatUsingEnterOutInfo.Flag          = SeatManage.EnumType.Operation.OtherReader;
                    seatUsingEnterOutInfo.TerminalNum   = clientObject.ClientSetting.ClientNo;
                    seatUsingEnterOutInfo.Remark        = string.Format("在{0} {1}号座位,被读者{2}在终端{3}设置为暂离并等待该座位", seatUsingEnterOutInfo.ReadingRoomName, seatUsingEnterOutInfo.ShortSeatNo, waitInfo.CardNo, clientObject.ClientSetting.ClientNo);

                    clientObject.EnterOutLogData.EnterOutlog      = seatUsingEnterOutInfo; //要等待读者的暂离记录
                    clientObject.EnterOutLogData.WaitSeatLogModel = waitInfo;              //等待记录

                    return(true);
                }
                else
                {
                    T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)//没有成功加锁
            {
                MessageWindow popWindow = new MessageWindow(SeatManage.EnumType.MessageType.SeatIsLocked);
                CountDown.Pause();
                popWindow.ShowDialog();
                CountDown.Start();
            }
            return(false);
        }
Esempio n. 8
0
        /// <summary>
        /// 读者等待座位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void seatBtn_WaitSeat(object sender, MouseButtonEventArgs e)
        {
            WaitSeatLogInfo lastWaitInfo = T_SM_SeatWaiting.GetListWaitLogByCardNo(clientobject.EnterOutLogData.EnterOutlog.CardNo, clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo);
            ReadingRoomInfo roomInfo     = clientobject.EnterOutLogData.Student.AtReadingRoom;


            if (!string.IsNullOrEmpty(clientobject.EnterOutLogData.EnterOutlog.SeatNo))
            {
                SeatManage.SeatClient.Tip.Tip_Framework tipForm = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.WaitSeatWithSeat, 7);
                countDownSeconds.Pause();
                tipForm.ShowDialog();
                countDownSeconds.Start();
                return;
            }

            if (lastWaitInfo != null && lastWaitInfo.SeatWaitTime.AddMinutes(roomInfo.Setting.NoManagement.OperatingInterval).CompareTo(ServiceDateTime.Now) >= 0)
            {
                SeatManage.SeatClient.Tip.Tip_Framework tipForm = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.WaitSeatFrequent, 7);
                countDownSeconds.Pause();
                tipForm.ShowDialog();
                countDownSeconds.Start();
                return;
            }
            SeatButton seatBtn = sender as SeatButton;

            SeatManage.EnumType.SeatLockState lockseat = T_SM_Seat.LockSeat(seatBtn.SeatNo);
            if (lockseat == SeatManage.EnumType.SeatLockState.Locked)//座位成功加锁
            {
                SetShortWarning warnForm = new SetShortWarning(seatBtn.ShortSeatNo);
                countDownSeconds.Pause();
                warnForm.ShowDialog();
                countDownSeconds.Start();
                if (warnForm.IsTrue)
                {
                    //初始化等待记录 记录ID需要待执行之后添加。
                    WaitSeatLogInfo waitInfo = new WaitSeatLogInfo();
                    waitInfo.CardNo       = clientobject.EnterOutLogData.EnterOutlog.CardNo;
                    waitInfo.NowState     = SeatManage.EnumType.LogStatus.Valid;
                    waitInfo.OperateType  = SeatManage.EnumType.Operation.Reader;
                    waitInfo.WaitingState = SeatManage.EnumType.EnterOutLogType.Waiting;

                    EnterOutLogInfo seatUsingEnterOutInfo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatBtn.SeatNo);
                    seatUsingEnterOutInfo.EnterOutState = SeatManage.EnumType.EnterOutLogType.ShortLeave;
                    seatUsingEnterOutInfo.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
                    seatUsingEnterOutInfo.Flag          = SeatManage.EnumType.Operation.OtherReader;
                    seatUsingEnterOutInfo.TerminalNum   = clientobject.ClientSetting.ClientNo;
                    seatUsingEnterOutInfo.Remark        = string.Format("在{0} {1}号座位,被读者{2}在终端{3}设置为暂离并等待该座位", seatUsingEnterOutInfo.ReadingRoomName, seatUsingEnterOutInfo.ShortSeatNo, waitInfo.CardNo, clientobject.ClientSetting.ClientNo);

                    clientobject.EnterOutLogData.EnterOutlog      = seatUsingEnterOutInfo; //要等待读者的暂离记录
                    clientobject.EnterOutLogData.WaitSeatLogModel = waitInfo;              //等待记录
                    this.Hide();
                }
                else
                {
                    T_SM_Seat.UnLockSeat(seatBtn.SeatNo);//确认窗口点击取消或者自动关闭,则解锁。
                }
            }
            else if (lockseat == SeatManage.EnumType.SeatLockState.UnLock)                                                                                                                    //没有成功加锁
            {
                SeatManage.SeatClient.Tip.Tip_Framework tip = new SeatManage.SeatClient.Tip.Tip_Framework(SeatManage.EnumType.TipType.SeatLocking, frmResolution.ViewModel.CountDownSeconds); //显示提示窗体
                tip.ShowDialog();

                drowSeatLayout();
            }
        }