private bool CheckAbleToSendAllTileConfig(ConnectionInfo connectionInfo) { string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); if (iClientStatus != null) { if (iClientStatus.LastTileConfigDownloadTimestamp == DateTime.MinValue) { iClientStatus.LastTileConfigDownloadTimestamp = DateTime.Now.Subtract(TimeSpan.FromSeconds(1f)); } double secDiff = DateTime.Now.Subtract(iClientStatus.LastTileConfigDownloadTimestamp).TotalSeconds; secDiff = (secDiff > 60) ? 60 : secDiff; double chance = secDiff / 60; double numGen = _rand.NextDouble(); if (numGen <= chance) { iClientStatus.LastTileConfigDownloadTimestamp = DateTime.Now; return(true); } } return(false); }
private void SendStartNow(List <ClientParm> clientParm, OperationInfo opInfo) { foreach (ClientParm cp in clientParm) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientID == cp.ClientID).FirstOrDefault(); if (iClientStatus != null) { ConnectionInfo connInfo = _targetClientDaemonConnection.Where(x => ((IPEndPoint)x.RemoteEndPoint).Address.MapToIPv4().ToString() == iClientStatus.ClientIP).FirstOrDefault(); if (connInfo != null) { UpdateInternalClientSetup(cp.ClientID, DateTime.Now, VRGameSelectorDTO.Enums.ClientRunningMode.NO_TIMING_ON, GetCustomerAge(opInfo.TicketGUID)); VRCommand vrc = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.START_NOW); SendCommandToPeer(connInfo, vrc); CreateManageLog(opInfo.SourceType, VRGameSelectorServerDTO.Enums.OperationType.START_NON_TIMING, ((IPEndPoint)opInfo.ConnectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(), (opInfo.ClientID != null) ? opInfo.ClientID : cp.ClientID, null, opInfo.TicketGUID, ""); } } } }
private void ProcessPlayLog(ConnectionInfo connectionInfo, PlayLog playLog) { string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); if (iClientStatus != null) { int tileID = 0; int.TryParse(playLog.TileID, out tileID); using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfig vtc = m.VRTileconfigs.Where(x => x.ID == tileID && !x.IsDeleted).FirstOrDefault(); VRClienthistory vrh = new VRClienthistory(); vrh.VRClientID = iClientStatus.ClientID; if (tileID == -1) { vrh.TileConfigID = -1; } else { vrh.TileConfigID = (vtc != null) ? vtc.ID : 0; } if (playLog.SignalType == VRGameSelectorDTO.Enums.PlayLogSignalType.Start) { // start game if (tileID > 0) { string imagePath = (vtc.ImageData.Length > 0) ? vtc.ID.ToString() + ".bmp" : ""; // full path will be decided on client end VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vtc.ImageData); VRGameSelectorDTO.Tile tileConfig = new Tile(vtc.TileHeight, vtc.TileWidth, vtc.TileRowNumber, vtc.ID.ToString(), vtc.TileTitle, imagePath, vtc.TileDesc, vtc.Command, vtc.Arguments, vtc.WorkingPath, ii, vtc.AgeRequire, vtc.VideoURL); iClientStatus.ClientRunningModeSetup.TileConfig = tileConfig; } iClientStatus.ClientRunningModeSetup.CurrentRunningTileID = tileID; vrh.StartTime = DateTime.Now; } else { // end game iClientStatus.ClientRunningModeSetup.CurrentRunningTileID = 0; iClientStatus.ClientRunningModeSetup.TileConfig = null; vrh.EndTime = DateTime.Now; } m.Add(vrh); m.SaveChanges(); //m.Cache.Release(m.VRClienthistories); } } }
private void BuildInternalClientStatus() { if (_internalClientStatus == null) { _internalClientStatus = new List <InternalClientStatus>(); } else { _internalClientStatus.Clear(); } using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { foreach (VRClient vc in m.VRClients.Where(x => !x.IsDeleted).ToList()) { ClientRunningMode cs = new ClientRunningMode(vc.ID, vc.IPAddress, DateTime.MinValue, 0, 0, VRGameSelectorDTO.Enums.ClientRunningMode.ENDED_TIMING, null, 0); InternalClientStatus ics = new InternalClientStatus() { ClientID = vc.ID, ClientIP = vc.IPAddress, DashboardModuleIP = vc.DashboardModuleIP, ClientName = vc.MachineName, AdditionalInfo = "", IsRequireAssistance = false, ClientStatus = VRGameSelectorServerDTO.Enums.LiveClientStatus.NONE, LastPingTimeStamp = DateTime.MinValue, LastTileConfigDownloadTimestamp = DateTime.MinValue, ClientRunningModeSetup = cs }; _internalClientStatus.Add(ics); } } isManageSystemPushRequired = true; foreach (ConnectionInfo cInfo in _targetClientDaemonConnection) { string ipAdd = ((IPEndPoint)cInfo.RemoteEndPoint).Address.MapToIPv4().ToString(); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); if (iClientStatus != null) { UpdateInternalClientSetup(iClientStatus.ClientID, DateTime.Now, VRGameSelectorDTO.Enums.ClientRunningMode.ENDED_MANUAL); VRCommand vrc = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.END_NOW); SendCommandToPeer(cInfo, vrc); } } }
private void UpdateInternalClientStatus(string ipAddress) { if (_internalClientStatus != null) { InternalClientStatus existClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAddress).FirstOrDefault(); if (existClientStatus != null) { existClientStatus.LastPingTimeStamp = DateTime.Now; } } }
private void UpdateInternalClientStatus(string ipAddress, VRGameSelectorDTO.Enums.LiveClientStatus liveClientStatus) { if (_internalClientStatus != null) { InternalClientStatus existClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAddress).FirstOrDefault(); if (existClientStatus != null) { existClientStatus.ClientStatus = (VRGameSelectorServerDTO.Enums.LiveClientStatus)liveClientStatus; } } }
private void ClientSetRunningMode(ConnectionInfo connectionInfo) { string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); if (iClientStatus != null) { VRCommand vrc = new VRCommand(iClientStatus.ClientRunningModeSetup); SendCommandToPeer(connectionInfo, vrc); } }
private void SendEndNow(List <ClientParm> clientParm, OperationInfo opInfo) { foreach (ClientParm cp in clientParm) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientID == cp.ClientID).FirstOrDefault(); if (iClientStatus != null) { ConnectionInfo connInfo = _targetClientDaemonConnection.Where(x => ((IPEndPoint)x.RemoteEndPoint).Address.MapToIPv4().ToString() == iClientStatus.ClientIP).FirstOrDefault(); switch (cp.Parameters["EndMode"]) { case "Manual": UpdateInternalClientSetup(cp.ClientID, DateTime.Now, VRGameSelectorDTO.Enums.ClientRunningMode.ENDED_MANUAL); break; case "Timing": UpdateInternalClientSetup(cp.ClientID, DateTime.Now, VRGameSelectorDTO.Enums.ClientRunningMode.ENDED_TIMING); break; case "Emergency": UpdateInternalClientSetup(cp.ClientID, DateTime.Now, VRGameSelectorDTO.Enums.ClientRunningMode.ENDED_EMERGENCY); break; default: break; } if (connInfo != null) { VRCommand vrc = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.END_NOW); SendCommandToPeer(connInfo, vrc); if (cp.Parameters["EndMode"] != "Timing") { CreateManageLog(opInfo.SourceType, VRGameSelectorServerDTO.Enums.OperationType.MANUAL_END, ((IPEndPoint)opInfo.ConnectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(), (opInfo.ClientID != null) ? opInfo.ClientID : cp.ClientID, null, opInfo.TicketGUID, cp.Parameters["EndMode"]); } } } } }
private void RefreshConfigSetForClient(int clientID, int tileConfigSetID) { if (_internalClientStatus != null) { InternalClientStatus ics = _internalClientStatus.Where(x => x.ClientID == clientID).FirstOrDefault(); if (ics != null) { ConnectionInfo connInfo = _targetClientDaemonConnection.Where(x => ((IPEndPoint)x.RemoteEndPoint).Address.MapToIPv4().ToString() == ics.ClientIP).FirstOrDefault(); ClientSetAllTileConfig(connInfo); } } }
public void ResetHelpRequestStatusDashboard(string ipAdd) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.DashboardModuleIP == ipAdd).FirstOrDefault(); if (iClientStatus != null) { UpdateInternalClientStatus(iClientStatus.ClientID, new InternalClientStatus() { IsRequireAssistance = false }); isManageSystemPushRequired = true; } }
private void SetHelpRequestStatus(ConnectionInfo connectionInfo, OperationInfo opInfo) { string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(); InternalClientStatus ics = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); if (ics != null) { ics.IsRequireAssistance = true; } isManageSystemPushRequired = true; CreateManageLog(opInfo.SourceType, VRGameSelectorServerDTO.Enums.OperationType.HELP_REQUESTED, ((IPEndPoint)opInfo.ConnectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(), (opInfo.ClientID != null) ? opInfo.ClientID : ics.ClientID, null, opInfo.TicketGUID, ""); }
private void UpdateInternalClientStatus(int clientID, InternalClientStatus internalClientStatus) { if (_internalClientStatus != null) { InternalClientStatus existClientStatus = _internalClientStatus.Where(x => x.ClientID == clientID).FirstOrDefault(); if (existClientStatus != null) { existClientStatus.ClientIP = (internalClientStatus.ClientIP != null) ? internalClientStatus.ClientIP : existClientStatus.ClientIP; existClientStatus.DashboardModuleIP = (internalClientStatus.DashboardModuleIP != null) ? internalClientStatus.DashboardModuleIP : existClientStatus.DashboardModuleIP; existClientStatus.ClientName = (internalClientStatus.ClientName != null) ? internalClientStatus.ClientName : existClientStatus.ClientName; existClientStatus.ClientStatus = (internalClientStatus.ClientStatus != null) ? internalClientStatus.ClientStatus : existClientStatus.ClientStatus; existClientStatus.IsRequireAssistance = (internalClientStatus.IsRequireAssistance != null) ? internalClientStatus.IsRequireAssistance : existClientStatus.IsRequireAssistance; existClientStatus.AdditionalInfo = (internalClientStatus.AdditionalInfo != null) ? internalClientStatus.AdditionalInfo : existClientStatus.AdditionalInfo; existClientStatus.LastPingTimeStamp = (internalClientStatus.LastPingTimeStamp != null) ? internalClientStatus.LastPingTimeStamp : existClientStatus.LastPingTimeStamp; } } }
public void ResetCleaningStatusDashboard(string ipAdd) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.DashboardModuleIP == ipAdd).FirstOrDefault(); logger.Debug("CLEANING STATUS RESET from dashboard " + ipAdd); if (iClientStatus != null) { ConnectionInfo connInfo = _targetClientDaemonConnection.Where(x => ((IPEndPoint)x.RemoteEndPoint).Address.MapToIPv4().ToString() == iClientStatus.ClientIP).FirstOrDefault(); if (connInfo != null) { VRCommand vrc = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.CLEANING_PROVIDED); SendCommandToPeer(connInfo, vrc); } } }
private void UpdateInternalClientSetup(int clientID, DateTime startTime, VRGameSelectorDTO.Enums.ClientRunningMode runningMode, int customerAge = 0, int duration = 0) { if (_internalClientStatus != null) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientID == clientID).FirstOrDefault(); if (iClientStatus != null) { lock (_lockUpdateInternalClientStatus) { iClientStatus.ClientRunningModeSetup.RunningMode = runningMode; iClientStatus.ClientRunningModeSetup.StartTime = startTime; iClientStatus.ClientRunningModeSetup.Duration = duration; iClientStatus.ClientRunningModeSetup.CustomerAge = customerAge; } } } }
public DashboardModuleInfo PopulateDashboardModuleInfo(string ipAdd) { //logger.Debug("PopulateDashboardModuleInfo: " + ipAdd); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.DashboardModuleIP == ipAdd).FirstOrDefault(); DashboardModuleInfo dmInfo = new DashboardModuleInfo(); if (iClientStatus != null) { dmInfo.CurrentRunningMode = (VRGameSelectorServerDTO.Enums.ClientRunningMode)Enum.Parse(typeof(VRGameSelectorServerDTO.Enums.ClientRunningMode), iClientStatus.ClientRunningModeSetup.RunningMode.ToString()); dmInfo.IsRequireAssistant = iClientStatus.IsRequireAssistance ?? false; dmInfo.CurrentRunningTitle = (iClientStatus.ClientRunningModeSetup.TileConfig != null) ? iClientStatus.ClientRunningModeSetup.TileConfig.TileTitle : ""; dmInfo.LiveClientStatus = iClientStatus.ClientStatus ?? VRGameSelectorServerDTO.Enums.LiveClientStatus.NONE; } return(dmInfo); }
private void SendTurnOnKMU(List <ClientParm> clientParm, OperationInfo opInfo) { foreach (ClientParm cp in clientParm) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientID == cp.ClientID).FirstOrDefault(); if (iClientStatus != null) { ConnectionInfo connInfo = _targetClientDaemonConnection.Where(x => ((IPEndPoint)x.RemoteEndPoint).Address.MapToIPv4().ToString() == iClientStatus.ClientIP).FirstOrDefault(); if (connInfo != null) { VRCommand vrc = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.TURN_ON_KMU); SendCommandToPeer(connInfo, vrc); CreateManageLog(opInfo.SourceType, VRGameSelectorServerDTO.Enums.OperationType.TURN_ON_KMU, ((IPEndPoint)opInfo.ConnectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(), (opInfo.ClientID != null) ? opInfo.ClientID : cp.ClientID, null, opInfo.TicketGUID, ""); } } } }
private void UpdateInternalClientStatus(string ipAddress, string machineName, VRGameSelectorDTO.Enums.LiveClientStatus liveClientStatus, string addInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAddress).FirstOrDefault(); if (iClientStatus != null) { VRClient vrc = m.VRClients.Where(x => x.IPAddress == ipAddress && !x.IsDeleted).FirstOrDefault(); if (vrc != null && !vrc.MachineName.ToString().Equals(machineName)) { vrc.MachineName = machineName; m.SaveChanges(); //m.Cache.Release(m.VRClients); } iClientStatus.ClientName = machineName; iClientStatus.ClientStatus = (VRGameSelectorServerDTO.Enums.LiveClientStatus)liveClientStatus; iClientStatus.AdditionalInfo = addInfo; } } }
private void HandleIncomingCommandClientDaemon(PacketHeader packetHeader, Connection connection, VRCommand vrCommand) { switch (vrCommand.ControlMessage) { case VRGameSelectorDTO.Enums.ControlMessage.NONE: HandleClientDaemonPing(connection.ConnectionInfo); break; case VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_SYSCONFIG: ClientSetAllSysConfig(connection.ConnectionInfo); break; case VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_TILE_CONFIG: if (CheckAbleToSendAllTileConfig(connection.ConnectionInfo)) { ClientSetAllTileConfig(connection.ConnectionInfo); } break; case Enums.ControlMessage.GET_ALL_TILE_CONFIG_WITH_IMAGE: if (CheckAbleToSendAllTileConfig(connection.ConnectionInfo)) { ClientSetAllTileConfigWithImage(connection.ConnectionInfo); } break; case VRGameSelectorDTO.Enums.ControlMessage.START_TIMING: break; case VRGameSelectorDTO.Enums.ControlMessage.START_NOW: break; case VRGameSelectorDTO.Enums.ControlMessage.END_NOW: break; case VRGameSelectorDTO.Enums.ControlMessage.TURN_OFF: break; case VRGameSelectorDTO.Enums.ControlMessage.STATUS: ClientSetRunningMode(connection.ConnectionInfo); break; case VRGameSelectorDTO.Enums.ControlMessage.LOAD_CONFIG: break; case VRGameSelectorDTO.Enums.ControlMessage.PLAY_LOG: ProcessPlayLog(connection.ConnectionInfo, vrCommand.PlayLog); break; case VRGameSelectorDTO.Enums.ControlMessage.CLIENT_UI_READY: break; case VRGameSelectorDTO.Enums.ControlMessage.REQUEST_HELP: OperationInfo opInfo = new OperationInfo() { SourceType = VRGameSelectorServerDTO.Enums.SourceType.CLIENT, ConnectionInfo = connection.ConnectionInfo }; SetHelpRequestStatus(connection.ConnectionInfo, opInfo); break; default: break; } IPEndPoint ep = (IPEndPoint)connection.ConnectionInfo.RemoteEndPoint; string ipAdd = ep.Address.MapToIPv4().ToString(); string machineName = (vrCommand.MachineName != null) ? vrCommand.MachineName : ""; InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); if (iClientStatus != null && (iClientStatus.ClientName != machineName || iClientStatus.ClientStatus != (VRGameSelectorServerDTO.Enums.LiveClientStatus)vrCommand.LiveClientStatus)) { UpdateInternalClientStatus(ipAdd, machineName, vrCommand.LiveClientStatus, vrCommand.AdditionalInfo); isManageSystemPushRequired = true; } }
private void ClientSetAllTileConfig(ConnectionInfo connectionInfo, bool withImage = false) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { string ipAdd = ((IPEndPoint)connectionInfo.RemoteEndPoint).Address.MapToIPv4().ToString(); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.ClientIP == ipAdd).FirstOrDefault(); VRClient vrc = m.VRClients.Where(x => x.IPAddress == ipAdd && !x.IsDeleted).FirstOrDefault(); if (vrc != null) { List <VRTileconfig> lvrt0 = m.VRTileconfigs.Where(x => x.TileConfigSetID == vrc.TileConfigSetID && x.VRTileconfigID == 0 && !x.IsDeleted).ToList(); // root level if (lvrt0 != null) { VRGameSelectorDTO.TileConfig tc = new VRGameSelectorDTO.TileConfig(); foreach (VRTileconfig vrt in lvrt0) // first process root level { string imagePath = (vrt.ImageData.Length > 0) ? vrt.ID.ToString() + ".bmp" : ""; // full path will be decided on client end if (withImage) { GetType(); } VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vrt.ImageData, !withImage); Tile t = new Tile(vrt.TileHeight, vrt.TileWidth, vrt.TileRowNumber, vrt.ID.ToString(), vrt.TileTitle, imagePath, vrt.TileDesc, vrt.Command, vrt.Arguments, vrt.WorkingPath, ii, vrt.AgeRequire, vrt.VideoURL); tc.MainScreenTiles.Add(t); } List <VRTileconfig> lvrt1 = m.VRTileconfigs.Where(x => x.TileConfigSetID == vrc.TileConfigSetID && x.VRTileconfigID != 0 && !x.IsDeleted).ToList(); // sub level if (lvrt1 != null) { foreach (VRTileconfig vrt in lvrt1) { Tile targetVrt = tc.MainScreenTiles.Where(x => x.TileID == vrt.VRTileconfigID.ToString()).FirstOrDefault(); if (targetVrt != null) { string imagePath = (vrt.ImageData.Length > 0) ? vrt.ID.ToString() + ".bmp" : ""; // full path will be decided on client end VRGameSelectorDTO.ImageInfo ii = new VRGameSelectorDTO.ImageInfo(vrt.ImageData, !withImage); Tile t = new Tile(vrt.TileHeight, vrt.TileWidth, vrt.TileRowNumber, vrt.ID.ToString(), vrt.TileTitle, imagePath, vrt.TileDesc, vrt.Command, vrt.Arguments, vrt.WorkingPath, ii, vrt.AgeRequire, vrt.VideoURL); targetVrt.ChildTiles.Add(t); } } } VRCommand vcs = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_TILE_CONFIG, tc); SendCommandToPeer(connectionInfo, vcs); if (iClientStatus != null) { iClientStatus.LastTileConfigDownloadTimestamp = DateTime.Now; } } } } }
public void ProcessBarcode(string ipAdd, string barcode) { try { logger.Debug("BARCODE IN " + barcode); logger.Debug("From dashboard: " + ipAdd); InternalClientStatus iClientStatus = _internalClientStatus.Where(x => x.DashboardModuleIP == ipAdd).FirstOrDefault(); Ascii85 a85 = new Ascii85(); //Guid guid = new Guid(Convert.FromBase64String(barcode.BarcodeReadout + "==")); Guid guid = new Guid(a85.Decode(barcode)); logger.Debug(guid.ToString()); if (iClientStatus != null && guid != null && guid != Guid.Empty) { logger.Debug("P1"); using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTicket vrt = m.VRTickets.Where(x => x.GUID == guid.ToString() && !x.IsDeleted).FirstOrDefault(); if (vrt != null && vrt.VRTicketType != null) { logger.Debug("P2"); List <ClientParm> clientParm = new List <ClientParm>(); IPAddress ipa = null; if (!IPAddress.TryParse(ipAdd, out ipa)) { ipa = IPAddress.Parse("0.0.0.0"); } OperationInfo opInfo = new OperationInfo() { ConnectionInfo = new ConnectionInfo(new IPEndPoint(ipa, 0)), TicketGUID = vrt.GUID, SourceType = VRGameSelectorServerDTO.Enums.SourceType.LCD_BARCODE_MODULE, ClientID = iClientStatus.ClientID }; if (vrt.VRTicketType.Type == "TICKET" && iClientStatus.ClientStatus == VRGameSelectorServerDTO.Enums.LiveClientStatus.CLEANING_DONE) { if (Math.Abs(DateTime.Now.Subtract(vrt.TimeStampCreate).TotalMinutes) <= 60) { logger.Debug("P3"); VRClient vrc = m.VRClients.Where(x => x.ID == iClientStatus.ClientID).FirstOrDefault(); if (vrt.Minutes == 0) { // non-timing clientParm.Add(new ClientParm(iClientStatus.ClientID)); SendStartNow(clientParm, opInfo); logger.Debug("NON-TIMING"); } else { // timing Dictionary <string, string> dict = new Dictionary <string, string>() { { "Duration", vrt.Minutes.ToString() } }; clientParm.Add(new ClientParm(iClientStatus.ClientID, dict)); SendStartTiming(clientParm, opInfo); logger.Debug("TIMING:" + vrt.Minutes.ToString()); } vrt.IsDeleted = true; vrt.TimeStampDelete = DateTime.Now; vrt.VRClientID = (vrc != null) ? (int?)vrc.ID : null; m.SaveChanges(); } else { logger.Debug("P4"); } } else if (vrt.VRTicketType.Type == "KEY-START-NON-TIMING") { clientParm.Add(new ClientParm(iClientStatus.ClientID)); SendStartNow(clientParm, opInfo); } else if (vrt.VRTicketType.Type == "KEY-START-TIMING") { Dictionary <string, string> dict = new Dictionary <string, string>() { { "Duration", vrt.Minutes.ToString() } }; clientParm.Add(new ClientParm(iClientStatus.ClientID, dict)); SendStartTiming(clientParm, opInfo); } else if (vrt.VRTicketType.Type == "KEY-END-GAME") { Dictionary <string, string> dict = new Dictionary <string, string>() { { "EndMode", "Manual" } }; clientParm.Add(new ClientParm(iClientStatus.ClientID, dict)); SendEndNow(clientParm, opInfo); } else if (vrt.VRTicketType.Type == "KEY-REBOOT") { clientParm.Add(new ClientParm(iClientStatus.ClientID)); SendReboot(clientParm, opInfo); } else if (vrt.VRTicketType.Type == "KEY-TURNOFF") { clientParm.Add(new ClientParm(iClientStatus.ClientID)); SendTurnOff(clientParm, opInfo); } else if (vrt.VRTicketType.Type == "KEY-KMU-ON") { clientParm.Add(new ClientParm(iClientStatus.ClientID)); SendTurnOnKMU(clientParm, opInfo); } else if (vrt.VRTicketType.Type == "KEY-KMU-OFF") { clientParm.Add(new ClientParm(iClientStatus.ClientID)); SendTurnOffKMU(clientParm, opInfo); } } } } } catch (Exception ex) { logger.Debug("Barcode Decoding Error: " + ex.Message); } }