Ejemplo n.º 1
0
        private void SendLiveSystemInfoToManagingSystem(ConnectionInfo connectionInfo)
        {
            LiveSystemInfo lsi = new LiveSystemInfo();

            foreach (InternalClientStatus ics in _internalClientStatus)
            {
                TimeSpan timeLeft = new TimeSpan(0, 0, 0);

                if (ics.ClientRunningModeSetup.RunningMode == VRGameSelectorDTO.Enums.ClientRunningMode.TIMING_ON)
                {
                    timeLeft = (ics.ClientRunningModeSetup.StartTime != DateTime.MinValue) ? ics.ClientRunningModeSetup.StartTime.AddMinutes(ics.ClientRunningModeSetup.Duration).Subtract(DateTime.Now) : timeLeft;
                }
                else if (ics.ClientRunningModeSetup.RunningMode == VRGameSelectorDTO.Enums.ClientRunningMode.NO_TIMING_ON)
                {
                    timeLeft = (ics.ClientRunningModeSetup.StartTime != DateTime.MinValue) ? DateTime.Now.Subtract(ics.ClientRunningModeSetup.StartTime) : timeLeft;
                }

                lsi.LiveClientStatus.Add(new LiveClientStatus()
                {
                    ClientID              = ics.ClientID,
                    ClientIP              = ics.ClientIP,
                    ClientName            = string.IsNullOrEmpty(ics.ClientName) ? ics.ClientIP : ics.ClientName,
                    AdditionalInfo        = ics.AdditionalInfo,
                    ClientStatus          = ics.ClientStatus ?? default(VRGameSelectorServerDTO.Enums.LiveClientStatus),
                    IsAssistanceRequested = ics.IsRequireAssistance ?? default(bool),
                    TimeLeft              = timeLeft,
                    Mode = ics.ClientRunningModeSetup.RunningMode.ToString()
                });
            }

            VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_LIVE_SYSTEM_INFO, lsi);

            SendCommandToPeer(connectionInfo, vcs);
        }
Ejemplo n.º 2
0
        private void GetConfiguredClientList(ConnectionInfo connectionInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                List <VRClient> vc = m.VRClients.Where(x => !x.IsDeleted).ToList();
                List <Client>   lc = new List <Client>();

                foreach (VRClient item in vc)
                {
                    string tcsName = "";

                    if (item.Tileconfigset != null)
                    {
                        tcsName = item.Tileconfigset.Name;
                    }

                    lc.Add(new Client(item.ID, item.IPAddress, item.DashboardModuleIP, item.MachineName, item.TileConfigSetID, tcsName));
                }



                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_CONFIGED_CLIENT_LIST, lc);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 3
0
        private void GetSysConfig(ConnectionInfo connectionInfo, List <SystemConfig> systemConfig)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                List <SystemConfig> lsc = new List <SystemConfig>();

                foreach (SystemConfig sc in systemConfig)
                {
                    VRConfiguration vc = m.VRConfigurations.Where(x => x.Type == Enum.GetName(typeof(VRGameSelectorServerDTO.Enums.SysConfigType), sc.Type)).FirstOrDefault();

                    if (vc != null)
                    {
                        lsc.Add(new SystemConfig((VRGameSelectorServerDTO.Enums.SysConfigType)Enum.Parse(typeof(VRGameSelectorServerDTO.Enums.SysConfigType), vc.Type, true), vc.Value));
                    }
                    else
                    {
                        lsc.Add(new SystemConfig(sc.Type, ""));
                    }
                }

                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_SYSCONFIG, lsc);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 4
0
        private void GetBookingReferenceSetting(ConnectionInfo connectionInfo, BookingReference bookingReference)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                VRBookingReference vbr = m.VRBookingReferences.Where(x => x.Reference == bookingReference.Reference && x.BookingDeleted == null && x.NumberOfBookingLeft > 0).FirstOrDefault();

                if (vbr != null)
                {
                    bookingReference.IsNonTimedTiming     = vbr.IsNonTimedTiming;
                    bookingReference.IsTimedTiming        = vbr.IsTimedTiming;
                    bookingReference.Duration             = vbr.Duration;
                    bookingReference.NumberOfBookingLeft  = vbr.NumberOfBookingLeft;
                    bookingReference.NumberOfBookingTotal = vbr.NumberOfBookingTotal;
                    bookingReference.BookingStartTime     = (vbr.BookingStartTime != null) ? (DateTime)vbr.BookingStartTime : DateTime.MinValue;
                    bookingReference.BookingEndTime       = (vbr.BookingEndTime != null) ? (DateTime)vbr.BookingEndTime : DateTime.MinValue;
                }
                else
                {
                    bookingReference.Reference = "";
                }

                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_BOOKING_REF_SETTING, bookingReference);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 5
0
        public static void GetGamePlayHistory(int clientID)
        {
            List <ClientParm> cp = new List <ClientParm>();

            cp.Add(new ClientParm(clientID));

            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GET_GAME_PLAY_HISTORY, cp);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 6
0
        public static void SetSystemConfig(SystemConfig systemConfig)
        {
            List <SystemConfig> lsc = new List <SystemConfig>();

            lsc.Add(systemConfig);

            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.SET_SYSCONFIG, lsc);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 7
0
        public static void GetTileConfig(int tileConfigSetID)
        {
            TileConfig tc = new TileConfig()
            {
                TileConfigSetID = tileConfigSetID
            };

            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GET_TILE_CONFIG, tc);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 8
0
        private void GetGamePlayHistory(ConnectionInfo connection, List <ClientParm> clientParm)
        {
            ClientParm cp = clientParm.FirstOrDefault();

            System.IO.StringWriter output = new System.IO.StringWriter();

            if (cp != null)
            {
                using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
                {
                    List <VRClienthistory> lvch = m.VRClienthistories.Where(x => x.VRClientID == cp.ClientID).OrderByDescending(y => y.ID).Take(500).ToList();

                    List <GamePlayHistory> lgph = new List <GamePlayHistory>();

                    foreach (VRClienthistory vch in lvch)
                    {
                        GamePlayHistory gph = new GamePlayHistory();

                        gph.TileID    = vch.TileConfigID;
                        gph.StartTime = vch.StartTime ?? DateTime.MinValue;
                        gph.EndTime   = vch.EndTime ?? DateTime.MinValue;

                        if (vch.TileConfigID != -1)
                        {
                            VRTileconfig vtc = m.VRTileconfigs.Where(x => x.ID == vch.TileConfigID).FirstOrDefault();

                            gph.TileName = (vtc != null) ? vtc.TileTitle : "ERROR!";
                        }
                        else
                        {
                            gph.TileName = "VR Game Selector Interface";
                        }

                        lgph.Add(gph);
                    }

                    VRCommandServer vrc = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_GAME_PLAY_HISTORY, lgph);

                    SendCommandToPeer(connection, vrc);
                }
            }
        }
Ejemplo n.º 9
0
        private void GetConfigSetList(ConnectionInfo connectionInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                List <VRTileconfigset> lvrcs = m.VRTileconfigsets.Where(x => !x.IsDeleted).ToList();
                List <ConfigSet>       lcs   = new List <ConfigSet>();

                foreach (VRTileconfigset item in lvrcs)
                {
                    lcs.Add(new ConfigSet()
                    {
                        ID = item.ID, Name = item.Name
                    });
                }


                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_CONFIG_SET_LIST, lcs);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 10
0
        private void GetKeyType(ConnectionInfo connectionInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                List <VRTicketType> lvrTicketType = m.VRTicketTypes.Where(x => x.Type.StartsWith("KEY-")).ToList();
                List <KeyTypeInfo>  keyTypeInfo   = new List <KeyTypeInfo>();

                foreach (VRTicketType vrTicketType in lvrTicketType)
                {
                    keyTypeInfo.Add(new KeyTypeInfo()
                    {
                        KeyTypeID   = vrTicketType.ID,
                        KeyTypeName = vrTicketType.Type
                    });
                }

                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_KEY_TYPE, keyTypeInfo);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 11
0
        private void GetTileConfigList(ConnectionInfo connectionInfo, int tileConfigSetID)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                List <VRTileconfig> lvrtc = m.VRTileconfigs.Where(x => x.TileConfigSetID == tileConfigSetID && !x.IsDeleted).ToList();

                List <VRGameSelectorServerDTO.TileConfig> ltc = new List <VRGameSelectorServerDTO.TileConfig>();

                foreach (VRTileconfig item in lvrtc)
                {
                    ltc.Add(new VRGameSelectorServerDTO.TileConfig()
                    {
                        ID              = item.ID,
                        TileGUID        = item.TileGUID,
                        TileTitle       = item.TileTitle,
                        TileHeight      = item.TileHeight,
                        TileWidth       = item.TileWidth,
                        TileDesc        = item.TileDesc,
                        Command         = item.Command,
                        Arguments       = item.Arguments,
                        WorkingPath     = item.WorkingPath,
                        Order           = item.Order,
                        TileRowNumber   = item.TileRowNumber,
                        TileConfigSetID = item.TileConfigSetID,
                        TileconfigID    = item.VRTileconfigID,
                        AgeRequire      = item.AgeRequire,
                        VideoURL        = item.VideoURL,
                        TileImage       = new VRGameSelectorServerDTO.ImageInfo(item.ImageData)
                    });
                }


                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_TILE_CONFIG, ltc);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 12
0
        private void GetKey(ConnectionInfo connectionInfo)
        {
            using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel())
            {
                List <VRTicket> lvrTicket = m.VRTickets.Where(x => x.VRTicketType.Type.StartsWith("KEY-") && !x.IsDeleted).ToList();
                List <KeyInfo>  keyInfo   = new List <KeyInfo>();

                foreach (VRTicket vrTicket in lvrTicket)
                {
                    keyInfo.Add(new KeyInfo()
                    {
                        Key         = vrTicket.GUID,
                        KeyTypeID   = vrTicket.VRTicketTypeID ?? 0,
                        KeyTypeName = vrTicket.VRTicketType.Type,
                        Minutes     = vrTicket.Minutes,
                        CreateDate  = vrTicket.TimeStampCreate
                    });
                }

                VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GET_KEY, keyInfo);

                SendCommandToPeer(connectionInfo, vcs);
            }
        }
Ejemplo n.º 13
0
        public static void TurnOffCleaningFlag(List <ClientParm> clientParm)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.CLEANING_PROVIDED, clientParm);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 14
0
        public static void SendTurnOnKMU(List <ClientParm> clientParm)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.TURN_ON_KMU, clientParm);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 15
0
        public static void SendReboot(List <ClientParm> clientParm)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.REBOOT, clientParm);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 16
0
        public static void SendEndNow(List <ClientParm> clientParm)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.END_NOW, clientParm);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 17
0
        public static void MarkWaiverReceived(List <WaiverInfo> listWaverInfo)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.MARK_WAIVER_RECEIVED, listWaverInfo);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 18
0
        public static void DeleteKey(List <KeyInfo> keyInfo)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.DELETE_KEY, keyInfo);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 19
0
        public static void GetKey()
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GET_KEY);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 20
0
        public static void GenerateBarcode(BarcodeInfo barcodeInfo)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GENERATE_BARCODE, barcodeInfo);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 21
0
        public static void ReOrderDownTileConfig(TileConfig tileConfig)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.REORDER_DOWN_TILE_CONFIG, tileConfig);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 22
0
        public static void GetBookingReferenceSetting(BookingReference bookingReference)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GET_BOOKING_REF_SETTING, bookingReference);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 23
0
        public static void AddKey(List <KeyInfo> keyInfo)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.ADD_KEY, keyInfo);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 24
0
        public static void SyncTileConfig()
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.SYNC_TILE_CONFIG);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 25
0
        public static void GetPendingWaiver()
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GET_PENDING_WAIVER);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 26
0
        public static void ReInitClientSetting()
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.REINIT_CLIENT_SETTING);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 27
0
        public static void DeletePendingWaiver(List <WaiverInfo> listWaverInfo)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.DELETE_PENDING_WAIVER, listWaverInfo);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 28
0
        public static void GetLiveSystemInfo()
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.GET_LIVE_SYSTEM_INFO);

            SendCommandToServer(cmd);
        }
Ejemplo n.º 29
0
        private static void HandleGlobalIncomingCommand(PacketHeader packetHeader, Connection connection, VRCommandServer vrCommandServer)
        {
            switch (vrCommandServer.ControlMessage)
            {
            case Enums.ControlMessage.NONE:
                break;

            case Enums.ControlMessage.GET_SYSCONFIG:

                SystemConfigEvent sce = new SystemConfigEvent()
                {
                    SystemConfig = vrCommandServer.SystemConfig.Clone()
                };

                OnIncommingSystemConfig(null, sce);

                break;

            case Enums.ControlMessage.GET_CONFIGED_CLIENT_LIST:

                ClientEvent ce = new ClientEvent()
                {
                    ListClients = vrCommandServer.ListClients.Clone()
                };

                OnIncommingConfigerClientList(null, ce);

                break;

            case Enums.ControlMessage.GET_CONFIG_SET_LIST:

                ConfigSetEvent cse = new ConfigSetEvent()
                {
                    ListConfigSets = vrCommandServer.ListConfigSet.Clone()
                };

                OnIncommingConfigSetList(null, cse);

                break;

            case Enums.ControlMessage.GET_TILE_CONFIG:

                TileConfigEvent tce = new TileConfigEvent()
                {
                    ListTileConfigs = vrCommandServer.ListTileConfig.Clone()
                };

                OnIncommingTileConfigList(null, tce);

                break;

            case Enums.ControlMessage.GET_LIVE_SYSTEM_INFO:

                LiveSystemInfoEvent lsie = new LiveSystemInfoEvent()
                {
                    LiveSystemInfo = vrCommandServer.LiveSystemInfo.Clone()
                };

                OnIncommingLiveSystemInfo(null, lsie);

                if (_lastRefreshTime != DateTime.MinValue)
                {
                    _secondSinceRefresh = DateTime.Now.Subtract(_lastRefreshTime).TotalSeconds;
                }
                _lastRefreshTime = DateTime.Now;

                break;

            case Enums.ControlMessage.GET_GAME_PLAY_HISTORY:

                GamePlayHistoryEvent gphe = new GamePlayHistoryEvent()
                {
                    ListGamePlayHistory = vrCommandServer.GamePlayHistory.Clone()
                };

                OnIncommingGamePlayHistory(null, gphe);

                break;

            case Enums.ControlMessage.GENERATE_BARCODE:

                BarcodeInfoEvent bie = new BarcodeInfoEvent()
                {
                    BarcodeInfo = vrCommandServer.BarcodeInfo
                };

                OnIncommingBarcodeInfo(null, bie);

                break;

            case Enums.ControlMessage.GET_KEY:

                KeyInfoEvent kie = new KeyInfoEvent()
                {
                    ListKeyInfo = vrCommandServer.ListKeyInfo
                };

                OnIncommingKeyInfoList(null, kie);

                break;

            case Enums.ControlMessage.GET_KEY_TYPE:

                KeyTypeInfoEvent ktie = new KeyTypeInfoEvent()
                {
                    ListKeyTypeInfo = vrCommandServer.ListKeyTypeInfo
                };

                OnIncommingKeyTypeInfoList(null, ktie);

                break;

            case Enums.ControlMessage.GET_PENDING_WAIVER:

                WaiverInfoEvent wie = new WaiverInfoEvent()
                {
                    ListWaiverInfo = vrCommandServer.ListWaiverInfo
                };

                OnIncommingWaiverInfoList(null, wie);

                break;

            case Enums.ControlMessage.GET_BOOKING_REF_SETTING:

                BookingReferenceEvent bre = new BookingReferenceEvent()
                {
                    BookingReference = vrCommandServer.BookingReference
                };

                OnIncommingBookingReference(null, bre);

                break;

            default:
                break;
            }
        }
Ejemplo n.º 30
0
        public static void SendStartTiming(List <ClientParm> clientParm)
        {
            VRCommandServer cmd = new VRCommandServer(Enums.ControlMessage.START_TIMING, clientParm);

            SendCommandToServer(cmd);
        }