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); } }
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); } }
public int GetCustomerAge(string guid) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { guid = (guid == null) ? "" : guid.Trim(); if (guid.Length > 0) { VRTicket vrTicket = m.VRTickets.Where(x => x.GUID == guid).FirstOrDefault(); if (vrTicket != null && vrTicket.WaiverLog != null) { if (vrTicket.WaiverLog.DOB != DateTime.MinValue) { double daySinceBirty = DateTime.Now.Subtract(vrTicket.WaiverLog.DOB).TotalDays; int age = (int)Math.Floor(daySinceBirty / 365D); return(age); } } } return(0); } }
public void MarkWaiverReceived(ConnectionInfo connectionInfo, List <WaiverInfo> listWaiverInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { foreach (WaiverInfo wi in listWaiverInfo) { VRWaiverLog vwl = m.VRWaiverLogs.Where(x => x.ID == wi.ID).FirstOrDefault(); if (vwl != null) { vwl.IsNewEntry = false; if (vwl.BookingReference != null) { vwl.BookingReference.NumberOfBookingLeft -= (vwl.BookingReference.NumberOfBookingLeft == 0 ? 0 : 1); } else { VRBookingReference vbr = m.VRBookingReferences.Where(x => x.Reference == wi.BookingReference.Reference).FirstOrDefault(); if (vbr != null) { vwl.BookingReference = vbr; } } } } m.SaveChanges(); //m.Cache.Release(m.VRWaiverLogs); //m.Cache.Release(m.VRBookingReferences); } }
private void ModifyTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfig vtc = m.VRTileconfigs.Where(x => x.ID == tileConfig.ID).FirstOrDefault(); if (vtc != null) { vtc.TileGUID = tileConfig.TileGUID; vtc.TileTitle = tileConfig.TileTitle; vtc.TileHeight = tileConfig.TileHeight; vtc.TileWidth = tileConfig.TileWidth; vtc.TileDesc = tileConfig.TileDesc; vtc.Command = tileConfig.Command; vtc.Arguments = tileConfig.Arguments; vtc.WorkingPath = tileConfig.WorkingPath; vtc.Order = tileConfig.Order; vtc.TileRowNumber = tileConfig.TileRowNumber; vtc.VRTileconfigID = tileConfig.TileconfigID; vtc.ImageData = tileConfig.TileImage.ImageData; vtc.AgeRequire = tileConfig.AgeRequire; vtc.VideoURL = tileConfig.VideoURL; m.SaveChanges(); //m.Cache.Release(m.VRTileconfigs); } } GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID); }
private void AddTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfig vtc = new VRTileconfig() { TileGUID = tileConfig.TileGUID, TileTitle = tileConfig.TileTitle, TileHeight = tileConfig.TileHeight, TileWidth = tileConfig.TileWidth, TileDesc = tileConfig.TileDesc, Command = tileConfig.Command, Arguments = tileConfig.Arguments, WorkingPath = tileConfig.WorkingPath, Order = tileConfig.Order, TileRowNumber = tileConfig.TileRowNumber, TileConfigSetID = tileConfig.TileConfigSetID, VRTileconfigID = tileConfig.TileconfigID, ImageData = tileConfig.TileImage.ImageData, AgeRequire = tileConfig.AgeRequire, VideoURL = tileConfig.VideoURL, IsDeleted = false }; m.Add(vtc); m.SaveChanges(); //m.Cache.Release(m.VRTileconfigs); } GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID); }
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); } }
private void AddKey(ConnectionInfo connectionInfo, List <KeyInfo> listKeyInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { BarcodeInfo bInfo = new BarcodeInfo(); if (listKeyInfo != null) { foreach (KeyInfo keyInfo in listKeyInfo) { VRTicketType vrTicketType = m.VRTicketTypes.Where(x => x.ID == keyInfo.KeyTypeID).FirstOrDefault(); if (vrTicketType != null) { BarcodeItem barcodeItem = new BarcodeItem() { IsPrintingKey = true, KeyName = vrTicketType.Type, Minutes = keyInfo.Minutes }; bInfo.BarcodeItems.Add(barcodeItem); } } GenerateBarcode(connectionInfo, bInfo); GetKey(connectionInfo); } } }
private void SetSysConfig(List <SystemConfig> systemConfig) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { 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) { // existing vc.Value = sc.Value; } else { // new VRConfiguration vrc = new VRConfiguration() { Type = Enum.GetName(typeof(VRGameSelectorServerDTO.Enums.SysConfigType), sc.Type), Value = sc.Value }; m.Add(vrc); } } m.SaveChanges(); //m.Cache.Release(m.VRConfigurations); } }
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 DeleteConfigSetList(ConnectionInfo connectionInfo, ConfigSet configSet) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfigset vcs = m.VRTileconfigsets.Where(x => x.ID == configSet.ID).FirstOrDefault(); if (vcs != null) { vcs.IsDeleted = true; m.SaveChanges(); //m.Cache.Release(m.VRTileconfigsets); } } GetConfigSetList(connectionInfo); }
private void DeleteTileConfig(ConnectionInfo connectionInfo, VRGameSelectorServerDTO.TileConfig tileConfig) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfig vtc = m.VRTileconfigs.Where(x => x.ID == tileConfig.ID).FirstOrDefault(); if (vtc != null) { vtc.IsDeleted = true; m.SaveChanges(); //m.Cache.Release(m.VRTileconfigs); } } GetTileConfigList(connectionInfo, tileConfig.TileConfigSetID); }
private void AddConfigSetList(ConnectionInfo connectionInfo, ConfigSet configSet) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRTileconfigset vcs = new VRTileconfigset() { Name = configSet.Name, IsDeleted = false }; m.Add(vcs); m.SaveChanges(); //m.Cache.Release(m.VRTileconfigsets); } GetConfigSetList(connectionInfo); }
private void DeleteKey(ConnectionInfo connectionInfo, List <KeyInfo> listKeyInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { foreach (KeyInfo keyInfo in listKeyInfo) { VRTicket vrTicket = m.VRTickets.Where(x => x.GUID == keyInfo.Key).FirstOrDefault(); vrTicket.IsDeleted = true; vrTicket.TimeStampDelete = DateTime.Now; } m.SaveChanges(); //m.Cache.Release(m.VRTickets); } GetKey(connectionInfo); }
private void DeleteClientConfig(ConnectionInfo connectionInfo, Client client) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRClient vrc = m.VRClients.Where(x => x.ID == client.ClientID).FirstOrDefault(); if (vrc != null) { vrc.IsDeleted = true; m.SaveChanges(); //m.Cache.Release(m.VRClients); } } //BuildInternalClientStatus(); GetConfiguredClientList(connectionInfo); }
private void ClientSetAllSysConfig(ConnectionInfo connectionInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { List <SysConfig> lsc = new List <SysConfig>(); List <VRConfiguration> sysConfig = m.VRConfigurations.ToList(); foreach (VRConfiguration vrc in sysConfig) { lsc.Add(new SysConfig((VRGameSelectorDTO.Enums.SysConfigType)Enum.Parse(typeof(VRGameSelectorDTO.Enums.SysConfigType), vrc.Type, true), vrc.Value)); } VRCommand vcs = new VRCommand(VRGameSelectorDTO.Enums.ControlMessage.GET_ALL_SYSCONFIG, lsc); SendCommandToPeer(connectionInfo, vcs); } }
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); } } }
private void CreateManageLog(VRGameSelectorServerDTO.Enums.SourceType sourceType, VRGameSelectorServerDTO.Enums.OperationType operationType, string sourceIdentity, int?clientID, int?tileID, string ticketGUID, string additionalInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRManageLog vrManLog = new VRManageLog() { Source = sourceType.ToString(), SourceIdentity = sourceIdentity, Operation = operationType.ToString(), AdditonalInfo = additionalInfo, VRClientID = clientID, VRTileconfigID = tileID, VRTicketGUID = ticketGUID, TimeStamp = DateTime.Now }; m.Add(vrManLog); m.SaveChanges(); } }
private void DeletePendingWaiver(ConnectionInfo connectionInfo, List <WaiverInfo> listWaiverInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { foreach (WaiverInfo wi in listWaiverInfo) { VRWaiverLog vwl = m.VRWaiverLogs.Where(x => x.ID == wi.ID).FirstOrDefault(); if (vwl != null) { vwl.IsDeleted = true; } } m.SaveChanges(); //m.Cache.Release(m.VRWaiverLogs); } GetPendingWaiverList(connectionInfo); }
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); } }
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); } }
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 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); } }
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); } }
private void AddClientConfig(ConnectionInfo connectionInfo, Client client) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRClient vrc = new VRClient() { IPAddress = client.IPAddress, DashboardModuleIP = client.DashboardModuleIP, TileConfigSetID = client.TileConfigSetID, Tileconfigset = null, MachineName = "", VRClienthistories = null, IsDeleted = false }; m.Add(vrc); m.SaveChanges(); //m.Cache.Release(m.VRClients); } //BuildInternalClientStatus(); GetConfiguredClientList(connectionInfo); }
private void ModifyClientConfig(ConnectionInfo connectionInfo, Client client) { bool isChangeConfigSetOnly = false; using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRClient vrc = m.VRClients.Where <VRClient>(x => x.ID == client.ClientID).FirstOrDefault(); if (vrc != null) { if (vrc.IPAddress == client.IPAddress && vrc.DashboardModuleIP == client.DashboardModuleIP) { isChangeConfigSetOnly = true; } else { vrc.IPAddress = client.IPAddress; vrc.DashboardModuleIP = client.DashboardModuleIP; } vrc.TileConfigSetID = client.TileConfigSetID; m.SaveChanges(); //m.Cache.Release(m.VRClients); } } if (isChangeConfigSetOnly) { RefreshConfigSetForClient(client.ClientID, client.TileConfigSetID); } //BuildInternalClientStatus(); GetConfiguredClientList(connectionInfo); }
public string WaiverBarcodeGen(int waiverID) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { VRWaiverLog vrWaiverLog = m.VRWaiverLogs.Where(x => x.ID == waiverID).FirstOrDefault(); if (vrWaiverLog != null) { int minutes = 0; string bookingRef = ""; if (vrWaiverLog.BookingReference != null && vrWaiverLog.BookingReference.IsTimedTiming) { minutes = vrWaiverLog.BookingReference.Duration; bookingRef = vrWaiverLog.BookingReference.Reference; } BarcodeItem bItem = new BarcodeItem() { IsPrintingTicket = true, Minutes = minutes, CustomerName = vrWaiverLog.FirstName + " " + vrWaiverLog.LastName, BookingReference = bookingRef, WaiverLogID = vrWaiverLog.ID }; BarcodeInfo bInfo = new BarcodeInfo(); bInfo.BarcodeItems.Add(bItem); GenerateBarcode(null, bInfo); } } return(""); }
private void GenerateBarcode(ConnectionInfo connectionInfo, BarcodeInfo barcodeInfo) { using (VRArcadeDataAccessModel m = new VRArcadeDataAccessModel()) { if (barcodeInfo.BarcodeItems.Count > 0) { foreach (BarcodeItem bi in barcodeInfo.BarcodeItems) { VRTicketType vrTT = null; string ticketType = ""; Guid guid = Utility.CreateGuid(); bi.DateStampCreate = DateTime.Now; if (bi.IsPrintingTicket) { ticketType = "TICKET"; } else if (bi.IsPrintingKey) { ticketType = bi.KeyName; } vrTT = m.VRTicketTypes.Where(x => x.Type == ticketType).FirstOrDefault(); VRTicket vrt = new VRTicket() { GUID = guid.ToString(), Minutes = bi.Minutes, TimeStampCreate = bi.DateStampCreate, VRTicketTypeID = (vrTT != null) ? (int?)vrTT.ID : null, WaiverLogID = bi.WaiverLogID }; //string t = Convert.ToBase64String(guid.ToByteArray()).Replace("=", ""); //byte[] b = Convert.FromBase64String(t + "=="); //var g = new Guid(b); m.Add(vrt); bi.GUID = guid; } m.SaveChanges(); //m.Cache.Release(m.VRTickets); VRCommandServer vcs = new VRCommandServer(VRGameSelectorServerDTO.Enums.ControlMessage.GENERATE_BARCODE, barcodeInfo); if (connectionInfo != null) { SendCommandToPeer(connectionInfo, vcs); } else { foreach (ConnectionInfo managingSysConn in _targetManagingSystemConnection) { SendCommandToPeer(managingSysConn, vcs); } } } } }
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; } } } } }