public bool Execute(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Execute")) { bool result = default(bool); string key = (target != null ? target.TypeFaultSourceTypeKey : string.Empty); try { if (!key.IsEmpty()) { method.Info("!&! HANDLER STARTED FOR : " + key); } // force meters add this.OnForceMeterRead(context, target); // execute the target result = this.OnExecuteInternal(context, target); } catch (Exception ex) { method.Exception(ex); } finally { if (!key.IsEmpty()) { method.Info("!&! HANDLER COMPLETED FOR : " + key); } } return(result); } }
protected override bool ProcessG2HMessageInternal(MonMsg_G2H request) { using (ILogMethod method = Log.LogMethod("MonitorHandler_EPI_23_3", "ProcessG2HMessageInternal")) { try { MonTgt_G2H_EFT_DepositRequest monDepositRequest = request.Targets[0] as MonTgt_G2H_EFT_DepositRequest; if (monDepositRequest == null) { return(false); } //DeleteEPIMessage(request.InstallationNo); if (DoDepositRequest(request, monDepositRequest)) { method.Info("Deposit Request Transfer done"); } else { method.Info("Deposit Request Could not complete your transaction"); } return(true); } catch (Exception ex) { //EPIMsgProcessor.Current.SendEPIMessage(monBalanceResponse); //EPIMsgProcessor.Current.DisplayBallyWelcomeMsg(request.InstallationNo, ); method.Exception(ex); } return(false); } }
protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_G2H message) { if (message == null) { method.Info("Freeform message (G2H) was null."); return false; } this.OnModifyMessage(method, message); // convert the monitor message from freeform message MonMsg_G2H monMsg = MonitorEntityFactory.CreateEntity(message); if (monMsg == null) { method.Info("Unable to convert the monitor message from freeform message."); return false; } // post the monitor message into monitor processor if (!this.MonitorProcessor.ProcessG2HMessage(monMsg)) { method.Info("Unable to post the message to monitor processor."); return false; } return true; }
bool IExMonServer4CommsServerCallback.ProcessH2GMessage(MonMsg_H2G request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessH2GMessage")) { bool result = default(bool); try { if (request == null) { method.Info("Invalid method received from monitor server"); return(false); } FFMsg_H2G h2gMessage = MonitorEntityFactory.CreateEntity(request); if (h2gMessage == null) { method.Info("Unable to convert the freeform message from monitor message"); return(false); } method.Info("Processing H2G Message for : " + h2gMessage.IpAddress); ExCommsExecutorFactory.ProcessMessage(h2gMessage); result = true; } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_G2H message) { if (message == null) { method.Info("Freeform message (G2H) was null."); return(false); } this.OnModifyMessage(method, message); // convert the monitor message from freeform message MonMsg_G2H monMsg = MonitorEntityFactory.CreateEntity(message); if (monMsg == null) { method.Info("Unable to convert the monitor message from freeform message."); return(false); } // post the monitor message into monitor processor if (!this.MonitorProcessor.ProcessG2HMessage(monMsg)) { method.Info("Unable to post the message to monitor processor."); return(false); } return(true); }
protected override bool ProcessG2HMessageInternal(MonMsg_G2H request) { if (request == null) { return(false); } using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessG2HMessageInternal")) { bool result = false; string key = request.FaultSourceTypeKey; try { method.Info("!&! HANDLER STARTED FOR : " + key); result = _handlerMappings.ContainsKey(key) ? _handlerMappings[key].ProcessG2HMessage(request) : _faultHandler.ProcessG2HMessage(request); } catch (Exception ex) { method.Exception(ex); } finally { method.Info("!&! HANDLER COMPLETED FOR : " + key); } return(result); } }
public bool Send(UdpFreeformEntity udpEntity) { using (ILogMethod method = Log.LogMethod(LOGGER, this.DYN_MODULE_NAME, "Send")) { bool result = default(bool); try { if (udpEntity == null) { method.Info("Unable to send message (request is empty)."); return(false); } byte[] rawData = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, udpEntity); if (rawData == null || rawData.Length == 0) { method.Info("Unable to send message (rawData was null or zero length)."); return(false); } if (_configStore.LogRawFreeformMessages) { udpEntity.ProcessDate = DateTime.Now; string udpEntityString = udpEntity.ToStringRaw(FF_FlowDirection.H2G); Log.Info(udpEntityString); LOGGER.WriteLogInfo(udpEntityString + Environment.NewLine); LOGGER_UDP_SEND.WriteLogInfo(udpEntity.ProcessDate.ToStringSafe()); LOGGER_UDP_SEND.WriteLogInfo(udpEntityString + Environment.NewLine); } using (UdpSocketSendData sendData = new UdpSocketSendData() { IPAddress = udpEntity.Address, PortNo = _configStore.TransmitPortNo, Buffer = rawData, }) { result = _sockTransmitter.Transmit(sendData); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public bool Send(UdpFreeformEntity request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Send")) { bool result = default(bool); try { if (request == null) { method.Info("Unable to send message (request is empty)."); return(false); } byte[] rawData = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, request); if (rawData == null || rawData.Length == 0) { method.Info("Unable to send message (rawData was null or zero length)."); return(false); } using (UdpSocketSendData sendData = new UdpSocketSendData() { IPAddress = Extensions.GetIpAddress(-1), PortNo = _configStore.ReceivePortNo, Buffer = rawData, }) { result = _sockTransmitter.Transmit(sendData); if (this.AfterSendUdpEntityData != null) { byte[] rawDataWithoutIp = new byte[rawData.Length - 4]; Buffer.BlockCopy(rawData, 4, rawDataWithoutIp, 0, rawDataWithoutIp.Length); request.RawData = rawDataWithoutIp; request.ProcessDate = DateTime.Now; this.AfterSendUdpEntityData(request); } } } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected virtual E GetFreeThreadExecutor(T item) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "GetFreeThreadExecutor")) { E executor = default(E); try { // executor key free thread approach if (item is IExecutorKeyFreeThread) { // find the thread with minimum number of items executor = this.GetKeyFreeThreadExecutor(); if (executor != null) { method.Info("Thread " + executor.ContainerIndex.ToString() + " was taken by IExecutorKeyFreeThread approach."); } } // executor key thread approach if (executor == null && item is IExecutorKeyThread) { int index = ((IExecutorKeyThread)item).GetThreadIndex(this.Capacity); if (index >= 0 && index < _workerThreads.Count) { executor = _workerThreads[index]; method.Info("Thread " + executor.ContainerIndex.ToString() + " was taken by ExecutorKeyTheread approach."); } } } catch (Exception ex) { method.Exception(ex); } finally { // no more free threads if (executor == null) { executor = _workerThreads[_rnd.Next(0, _workerThreads.Count - 1)]; method.Info("Thread " + executor.ContainerIndex.ToString() + " was taken as random."); } } return(executor); } }
protected virtual void WaitForItemsToFlush() { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "WaitForItemsToFlush")) { try { int iteration = 0; while (!this.ThreadExecutorService.WaitForShutdown(100)) { int count = this.GetActiveItems(); if (count > 0) { if (iteration > 50) { method.InfoV("$$$ ({0:D}) thread executors have items to finish. So waiting for them to finish.", count); iteration = 0; } else { iteration++; } } else { method.Info("$$$ All the thread executors have finished their work. So can safely shutdown them now."); break; } } } catch (Exception ex) { method.Exception(ex); } } }
private void Initialize() { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Initialize")) { try { // transceiver socket for sending and receiving freeform messages IUdpSocketTransceiver socket = UdpSocketTransceiverFactory.Create(this.ExecutorService, new UdpSocketTransceiverParameter() { IPAddress = !_arg.LocalIpAddress.IsEmpty() ? _arg.LocalIpAddress : IPAddress.Any.ToString(), ListenWaitTime = 100, InterfaceIP = _arg.InterfaceIpAddress, MulticastIP = _arg.MulticastIpAddress, PortNo = _arg.ReceivePortNo, UseInternalQueue = false, }); _sockReceiver = socket; _sockTransmitter = socket; _sockReceiver.DataReceived += new UdpSocketReceivedDataHandler(OnReceiveUdpEntityFromSocket); _sockReceiver.Start(); method.Info("Initialize (Success)"); } catch (Exception ex) { method.Exception(ex); } } }
public bool Send(IFreeformEntity_Msg request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Send")) { bool result = default(bool); try { if (request == null) { method.Info("Unable to send message. request is empty"); return(false); } using (UdpFreeformEntity entity = new UdpFreeformEntity()) { entity.Address = request.IpAddress2; entity.EntityData = request; result = this.Send(entity); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
private void OnReceiveUdpEntityFromSocket(UdpSocketReceiveData message) { using (ILogMethod method = Log.LogMethod("", "OnReceiveUdpEntityFromSocket")) { try { // create the raw entity message string ipAddress = ((System.Net.IPEndPoint)message.RemoteEndpoint).Address.ToStringSafe(); method.InfoV("RECV_SOCK : Received from {0} / {1:D}", ipAddress, message.BufferLength); UdpFreeformEntity udpEntity = FreeformEntityFactory.CreateUdpEntity(FF_FlowDirection.H2G, message.Buffer, ipAddress); if (udpEntity == null || udpEntity.RawData == null || udpEntity.RawData.Length == 0) { method.Info("RECV_SOCK : Unable to parse the data from socket (Invalida message format)."); return; } // convert the freeform entity message IFreeformEntity ffEntity = FreeformEntityFactory.CreateEntity(FF_FlowDirection.H2G, udpEntity); if (ffEntity == null) { method.Info("RECV_SOCK : Unable to create the freeform entity from udp entity message."); return; } // process the message udpEntity.EntityData = ffEntity; method.InfoV("RECV_SOCK (Success) : {0} [{1}] was received for processing.", udpEntity, udpEntity.ProcessDate.ToStringSafe()); if (this.ReceiveUdpEntityData != null) { this.ReceiveUdpEntityData(udpEntity); } } catch (Exception ex) { method.Exception(ex); } } }
protected virtual bool PostMessageToMonitorServer(ILogMethod method, FFMsg_G2H message) { // convert the monitor message from freeform message MonMsg_G2H monMsg = MonitorEntityFactory.CreateEntity(message); if (monMsg == null) { method.Info("Unable to convert the monitor message from freeform message."); return(false); } // post the monitor message into monitor processor if (!this.MonitorProcessor.ProcessG2HMessage(monMsg)) { method.Info("Unable to post the message to monitor processor."); return(false); } return(true); }
protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_H2G message) { if (message == null) { method.Info("Freeform message (H2G) was null."); return(false); } this.OnModifyMessage(method, message); return(_serverInstance.PostMessageToTransceiver(message)); }
protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_H2G message) { if (message == null) { method.Info("Freeform message (H2G) was null."); return false; } this.OnModifyMessage(method, message); return _serverInstance.PostMessageToTransceiver(message); }
public void CheckEPITimeouts(int installationNo) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "CheckEPITimeouts")) { try { EPITimeout timeout = this.GetTimeout(installationNo, EPIProcessType.IntervalRating); if (timeout == null) { return; } if ((timeout.LastUpdatedTime.AddMinutes(_configStore.EPICardInMeterUpdate) - DateTime.Now).Seconds >= 0) { method.Info("Running EPI Interval Rating"); // This happens due to two threads are executing this method at the same time. if ((Interlocked.Read(ref timeout.IsInProcess) == 1)) { method.Info("Some other thread is already generating the Interval Rating, So i am skipping now."); return; } // I am executing now if ((Interlocked.CompareExchange(ref timeout.IsInProcess, 1, 0) == 1)) { method.Info("Some other thread has already taken control, So i am skipping now."); return; } EPICardDetail cardDetail = this.GetCardInDetail(installationNo); SDTMessages.Instance.ProcessPlayerCardSessionRatings(installationNo); timeout.LastUpdatedTime = DateTime.Now; Interlocked.Exchange(ref timeout.IsInProcess, 0); } } catch (Exception ex) { method.Exception(ex); } } }
protected virtual bool OnProcessMessageInternal(FFMsg_G2H message, IList <MonitorEntity_MsgTgt> monitorTargets) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnProcessMessageInternal(G2H)")) { bool result = default(bool); try { if (monitorTargets == null || monitorTargets.Count == 0) { return(true); } // convert the monitor message from freeform message MonMsg_G2H monMsg = MonitorEntityFactory.CreateEntity(message, monitorTargets); if (monMsg == null) { method.Info("Unable to convert the monitor message from freeform message."); return(false); } // post the monitor message into monitor processor if (!this.MonitorProcessor.ProcessG2HMessage(monMsg)) { method.Info("Unable to post the message to monitor processor."); return(false); } result = true; } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected virtual bool OnProcessMessageG2H(ILogMethod method, FFMsg_G2H message) { if (message == null) { method.Info("Freeform message (G2H) was null."); return(false); } // further modifiy the message if (this.OnModifyMessageG2H(method, message)) { return(this.PostMessageToMonitorServer(method, message)); } return(false); }
protected virtual bool OnProcessMessageH2G(ILogMethod method, FFMsg_H2G message) { if (message == null) { method.Info("Freeform message (H2G) was null."); return(false); } // further modifiy the message if (this.OnModifyMessageH2G(method, message)) { // post the monitor message into transceiver return(_serverInstance.PostMessageToTransceiver(message)); } return(false); }
protected virtual bool OnProcessMessageInternal(FFMsg_H2G message) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnProcessMessageInternal(H2G)")) { bool result = default(bool); try { if (message == null) { method.Info("Freeform message (H2G) was null."); return(false); } result = _serverInstance.PostMessageToTransceiver(message); } catch (Exception ex) { method.Exception(ex); } return(result); } }
/// <summary> /// Creates the raw freeform message from the given buffer. /// </summary> /// <param name="direction">The flow direction.</param> /// <param name="buffer">The given buffer.</param> /// <param name="givenAddress">The given address.</param> /// <returns> /// Raw freeform entity. /// </returns> public static UdpFreeformEntity CreateUdpEntity(FF_FlowDirection direction, byte[] buffer, string givenAddress) { using (ILogMethod method = Log.LogMethod("FreeformEntityFactory", "CreateUdpEntity")) { UdpFreeformEntity result = default(UdpFreeformEntity); try { int minLength = _headerLengths[(int)direction]; int hasIPAddress = _headerLengths[(int)direction]; int ipOffset = 0; int ipLength = 0; // invalid message if (buffer == null || buffer.Length < minLength) { Log.Info("Parsing buffer (Failure) : Buffer was not in expected length."); return(result); } method.Info("Parsing buffer (Success)"); // ip address string ipAddress2 = givenAddress; IPAddress ipAddress = null; if (givenAddress.IsEmpty()) { ipLength = FreeformConstants.LEN_GMU_IPADDRESS; ipAddress2 = string.Format("{0:D}.{1:D}.{2:D}.{3:D}", buffer[0], buffer[1], buffer[2], buffer[3]); ipOffset += ipLength; } // parse the ip address if (!IPAddress.TryParse(ipAddress2, out ipAddress)) { method.Info("Parsing ip address (Failure) : Invalid ipaddress from the buffer."); return(result); } method.Info("Parsing ip address (Success)"); // get the factory int dataLength = (buffer.Length - ipLength); _GMU_Factory gmuFactory = GetGMUFactory(ipAddress2); // raw data byte[] dataWithoutIP = new byte[dataLength]; Buffer.BlockCopy(buffer, ipOffset, dataWithoutIP, 0, dataWithoutIP.Length); result = new UdpFreeformEntity() { Address = ipAddress, RawData = dataWithoutIP, ProcessDate = DateTime.Now, }; method.Info("Received ip address : " + ipAddress + ", Data Length : " + dataWithoutIP.Length); } catch (Exception ex) { Log.Exception(method.PROC, ex); } return(result); } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { MonMsg_G2H msgSrc = context.G2HMessage; MonTgt_G2H_Ticket_Redemption_Close tgtSrc = target as MonTgt_G2H_Ticket_Redemption_Close; ICallWebService ticketService = CallWebServiceFactory.Current; try { long ticketAmount = 0; long ticketType = 0; string barcode = tgtSrc.Barcode; string stockNo = msgSrc.Asset; string playerCardNo = msgSrc.CardNumber; string siteCode = msgSrc.SiteCode; string ticketSiteCode = barcode.Substring(0, 4); int installationNo = msgSrc.InstallationNo; int? voucherID = 0; long retCode = 0; bool isLocalTicket = false; bool sendAck = false; method.InfoV("TICKET_REDEEM_CLOSE: Local Site Code : {0}, Ticket Site Code : {1}", siteCode, ticketSiteCode); if (tgtSrc.Amount > 0 && tgtSrc.Status == FF_AppId_TicketRedemption_Close_Status.Success) { // is TIS printed ticket if (ticketService.IsTISPrintedTicketPrefix(barcode)) { method.InfoV("TICKET_REDEEM_CLOSE (TIS): TIS Printed Ticket ({0})", barcode); if (ExCommsDataContext.Current.RedeemTicketComplete(barcode, stockNo, ref voucherID, siteCode, playerCardNo)) { method.Info("TICKET_REDEEM_CLOSE (TIS): Send ticket: " + barcode + " redeem information to TIS"); ticketService.TisTicketRedeemComplete(barcode); method.Info("TICKET_REDEEM_CLOSE (TIS): Redeem information send to TIS for ticket: " + barcode); } else { method.Info("TICKET_REDEEM_CLOSE: Problem while sending the Tkt Redeem complete msg to DB!"); tgtSrc.Status = FF_AppId_TicketRedemption_Close_Status.CouponRejectedbySystem; } } // cross ticketing enabled and ticket site code not matched else if (_configStore.IsCrossTicketingEnabled)//CrossTickeing From Setting { method.InfoV("TICKET_REDEEM_CLOSE (CROSS SITE): Ticket Printed in Site {1} ({0})", barcode, ticketSiteCode); // local site if (!siteCode.IgnoreCaseCompare(ticketSiteCode)) { isLocalTicket = true; } else { //foreign site if (installationNo == 0 || string.IsNullOrEmpty(stockNo)) { method.Info("TICKET_REDEEM_CLOSE (CROSS SITE): Installation detail for ticket " + barcode + " in " + installationNo.ToString() + " for DeviceID " + stockNo); if (ticketService.TicketRedeemComplete(barcode, stockNo, out retCode) != 0) { method.Info("TICKET_REDEEM_CLOSE (CROSS SITE): Problem while sending the Tkt Redeem complete msg to WS!"); tgtSrc.Status = FF_AppId_TicketRedemption_Close_Status.CouponRejectedbySystem; } } else { method.Info("TICKET_REDEEM_CLOSE (CROSS SITE): Stored Installation detail for ticket " + barcode + " in " + installationNo.ToString() + " for DeviceID" + stockNo); if (ticketService.TicketRedeemComplete(barcode, stockNo, out retCode) != 0) { method.Info("TICKET_REDEEM_CLOSE (CROSS SITE): Stored Problem while sending the Tkt Redeem complete msg to WS!"); tgtSrc.Status = FF_AppId_TicketRedemption_Close_Status.CouponRejectedbySystem; } } } } // local site ticket else { isLocalTicket = true; } sendAck = true; } // local site ticket if (isLocalTicket) { method.Info("TICKET_REDEEM_CLOSE (LOCAL): Ticket: " + barcode + " Sitecode : " + siteCode + " Inst : " + installationNo.ToString()); if (!ExCommsDataContext.Current.RedeemTicketComplete(barcode, stockNo, ref voucherID, siteCode, playerCardNo)) { method.Info("TICKET_REDEEM_CLOSE (LOCAL):Problem while sending the Tkt Redeem complete msg to DB!"); } else { method.InfoV("TICKET_REDEEM_CLOSE (LOCAL): Success while redeeming amount for Barcode : {0}", barcode); } } else { //else nota a valid amount or redeem status method.Info("TICKET_REDEEM_CLOSE: No proper Ticket Redeemption!"); this.TicketReedeemFail(tgtSrc, msgSrc, ticketService, ref voucherID); sendAck = true; } // send the acknowledgement if (sendAck) { method.Info("TICKET_REDEEM_CLOSE: Sending redeem complete acknowledement"); MonTgt_H2G_Ticket_Redemption_Close response = new MonTgt_H2G_Ticket_Redemption_Close() { Status = (tgtSrc.Status == FF_AppId_TicketRedemption_Close_Status.Success) ? FF_AppId_ResponseStatus_Types.Success : FF_AppId_ResponseStatus_Types.Fail }; context.H2GTargets.Add(response); method.Info("TICKET_REDEEM_CLOSE: Successfully sent redeem complete acknowledement"); } } catch (Exception ex) { method.Exception(ex); } return(true); } }
protected override bool ProcessG2HMessageInternal(MonMsg_G2H request) { bool retVal = true; const string msg_type = "Card In"; InstallationDetailsForMSMQ installationDetails = null; // add the card detail var cardDetail = EPIManager.Current.AddOrUpdateCardInDetail(request.InstallationNo, request.CardNumber); using (ILogMethod method = Log.LogMethod("MonitorHandler_EPI_22_37", "ProcessG2HMessageInternal")) { try { method.Info("Started Employee Card In for " + request.CardNumber); EPIManager.Current.CreateProcess(request.InstallationNo); if (HandlerHelper.Current.IsEmployeeCardTrackingEnabled) { method.Info("Insert Employee card Session Details"); ExCommsDataContext.Current.UpdateEmployeeCardSessions(request.CardNumber, request.FaultDate, request.InstallationNo, msg_type); installationDetails = request.Extra as InstallationDetailsForMSMQ; ExCommsDataContext.Current.SendEmployeeSTMALert(installationDetails.Bar_Pos_No.ToString(), request.FaultDate, msg_type, request.CardNumber); try { Audit.Transport.Audit_History m_AuditInfo = new Audit.Transport.Audit_History(); m_AuditInfo.AuditModuleName = ModuleName.MSMQ; m_AuditInfo.Audit_Date = DateTime.Now.Date; m_AuditInfo.Audit_User_ID = 0; m_AuditInfo.Audit_User_Name = "System"; m_AuditInfo.Audit_Screen_Name = "Employee card"; m_AuditInfo.Audit_Desc = "Employee Card In"; m_AuditInfo.AuditOperationType = OperationType.ADD; m_AuditInfo.Audit_Field = "EmployeecardNumber"; m_AuditInfo.Audit_New_Vl = request.CardNumber; m_AuditInfo.Audit_Slot = request.Asset; Log.Info(method.PROC, "Insert Auditing info for Employee card In Event"); AuditViewerBusiness.InsertAuditData(m_AuditInfo); } catch (Exception ex) { Log.Exception(ex); } string empflags = ExCommsDataContext.Current.GetEmployeeFlags(request.CardNumber); if (!String.IsNullOrEmpty(empflags)) { method.Info("Flags " + empflags); empflags = empflags.Substring(2); List <byte> enumver = Enumerable.Range(0, empflags.Length) .Where((x) => x % 2 == 0) .Select((x) => Convert.ToByte(empflags.Substring(x, 2), 16)) .ToList(); List <byte> cardno = Enumerable.Range(0, request.CardNumber.PadLeft(10, '0').Length) .Where((x) => x % 2 == 0) .Select((x) => Convert.ToByte(request.CardNumber.PadLeft(10, '0').Substring(x, 2), 16)) .ToList(); enumver.Insert(0, Convert.ToByte(empflags[0])); enumver.Insert(1, Convert.ToByte(empflags[1])); enumver.InsertRange(0, cardno); // TODO: EPIMsgProcessor.SendCommand } } ExCommsDataContext.Current.UpdateFloorStatus(request.InstallationNo, DateTime.Now, null, null, null, null, null, null, null, null, request.CardNumber, request.FaultDate.ToString(), null); ExCommsDataContext.Current.UpdateGameCappingDetails(request.CardNumber, 1, false); try { if (SDTMessages.Instance.ProcessEmployeeCardIn(request)) { EPIManager.Current.CreateInactivityTimeout(request.InstallationNo); EPIManager.Current.CreateIntervalRatingTimer(request.InstallationNo); } } finally { } } catch (Exception ex) { retVal = false; // TODO: EPIMsgProcessor.SendCommand if (installationDetails != null) { CurrentEPIMsgProcessor.DisplayBallyWelcomeMsg(request.InstallationNo, installationDetails.Bar_Pos_Name, DateTime.Now); } if (cardDetail != null) { cardDetail.Clear(); } Log.Exception(ex); } finally { method.Info("Employee Card In completed for : " + request.CardNumber); } } return(retVal); }
protected override bool ProcessG2HMessageInternal(MonMsg_G2H request) { bool retVal = true; const string msg_type = "Card Out"; InstallationDetailsForMSMQ installationDetails = null; // add the card detail var cardDetail = EPIManager.Current.AddOrUpdateCardInDetail(request.InstallationNo, request.CardNumber); using (ILogMethod method = Log.LogMethod("MonitorHandler_EPI_22_38", "ProcessG2HMessageInternal")) { try { method.Info("Started Employee Card Out for " + request.CardNumber); if (HandlerHelper.Current.IsEmployeeCardTrackingEnabled) { ExCommsDataContext.Current.UpdateFloorStatus(request.InstallationNo, DateTime.Now, null, null, null, null, null, null, null, null, "", request.FaultDate.ToString(), null); EPIManager.Current.CreateProcess(request.InstallationNo); method.Info("Insert Employee card Session Details"); ExCommsDataContext.Current.UpdateEmployeeCardSessions(request.CardNumber, request.FaultDate, request.InstallationNo, msg_type); installationDetails = request.Extra as InstallationDetailsForMSMQ; ExCommsDataContext.Current.SendEmployeeSTMALert(installationDetails.Bar_Pos_No.ToString(), request.FaultDate, msg_type, request.CardNumber); try { Audit.Transport.Audit_History m_AuditInfo = new Audit.Transport.Audit_History(); m_AuditInfo.AuditModuleName = ModuleName.MSMQ; m_AuditInfo.Audit_Date = DateTime.Now.Date; m_AuditInfo.Audit_User_ID = 0; m_AuditInfo.Audit_User_Name = "System"; m_AuditInfo.Audit_Screen_Name = "Employee card"; m_AuditInfo.Audit_Desc = "Employee Card Out"; m_AuditInfo.AuditOperationType = OperationType.ADD; m_AuditInfo.Audit_Field = "EmployeecardNumber"; m_AuditInfo.Audit_New_Vl = request.CardNumber; m_AuditInfo.Audit_Slot = request.Asset; Log.Info(method.PROC, "Insert Auditing info for Employee card out Event"); AuditViewerBusiness.InsertAuditData(m_AuditInfo); } catch (Exception ex) { Log.Exception(ex); } try { if (SDTMessages.Instance.ProcessEmployeeCardOut(request)) { EPIManager.Current.CreateInactivityTimeout(request.InstallationNo); EPIManager.Current.CreateIntervalRatingTimer(request.InstallationNo); } } finally { } } } catch (Exception ex) { retVal = false; // TODO: EPIMsgProcessor.SendCommand if (installationDetails != null) { CurrentEPIMsgProcessor.DisplayBallyWelcomeMsg(request.InstallationNo, installationDetails.Bar_Pos_Name, DateTime.Now); } if (cardDetail != null) { cardDetail.Clear(); } Log.Exception(ex); } finally { method.Info("Employee Card Out completed for : " + request.CardNumber); } } return(retVal); }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod("MonitorHandler_Meter", "ProcessG2HMessageInternal")) { try { MonTgt_G2H_Meters monMeters = context.G2HMessage.Meters; if (monMeters == null) { method.Info("Meters are null. No need to update the meters."); return(true); } if (ExCommsDataContext.Current.UpdateFloorFinancialsFromMeter( context.G2HMessage.InstallationNo, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Cancelled_Credits].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_100000].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Coins_In].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Coins_Out].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Coins_Drop].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Jackpot].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Games_Bet].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Games_Won].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Door_Open].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Power_Reset].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_1].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_5].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_10].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_20].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_50].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_100].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_250].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_10000].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_20000].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_25000].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_50000].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Games_Lost].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Current_Credits].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.External_Coin_Amount].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.True_Coin_In].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.True_Coin_Out].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Handpay_Cancelled_Credits].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Cashable_In_Value].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Cashable_Out_Value].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Noncashable_In_Value].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Noncashable_Out_Value].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Cashable_In_Qty].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Cashable_Out_Qty].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Noncashable_In_Qty].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Tickets_Noncashable_Out_Qty].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Progressive_Win_Value].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Progressive_Win_Handpay_Value].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Mystery_Machine_Paid].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Mystery_Attendant_Paid].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Promo_Cashable_EFT_In].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Promo_Cashable_EFT_Out].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Noncashable_EFT_In].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Noncashable_EFT_Out].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Cashable_EFT_In].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Cashable_EFT_Out].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_200].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_500].CoalesceIntValue, null, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Bill_2].CoalesceIntValue, monMeters.Meters[MonTgt_G2H_Meter_MeterType.Games_Since_Power_Up_Meter].CoalesceIntValue, null, monMeters.Source)) { return(true); } } catch (Exception ex) { method.Exception(ex); } return(false); } }
private void OnReceiveUdpEntityFromSocket(UdpSocketReceiveData message) { using (ILogMethod method = Log.LogMethod(LOGGER, this.DYN_MODULE_NAME, "OnReceiveUdpEntityFromSocket")) { try { // create the raw entity message method.InfoV("RECV_SOCK : Received from {0} / {1:D}", message.RemoteEndpoint.ToString(), message.BufferLength); UdpFreeformEntity udpEntity = FreeformEntityFactory.CreateUdpEntity(FF_FlowDirection.G2H, message.Buffer); if (udpEntity == null || udpEntity.RawData == null || udpEntity.RawData.Length == 0) { method.Info("RECV_SOCK : Unable to parse the data from socket (Invalida message format)."); if (udpEntity != null && udpEntity.Address != null) { // send the nack this.Send(FreeformEntityFactory.CreateH2GMessageAckNack(udpEntity.AddressString, true)); } return; } // convert the freeform entity message FFMsg_G2H g2hMessage = FreeformEntityFactory.CreateEntity(FF_FlowDirection.G2H, udpEntity) as FFMsg_G2H; if (g2hMessage == null) { method.Info("RECV_SOCK : Unable to create the freeform entity from udp entity message."); // send the nack this.Send(FreeformEntityFactory.CreateH2GMessageAckNack(udpEntity.AddressString, true)); return; } // send the ack message (if necessary) FFMsg_H2G msgAck = FreeformEntityFactory.CreateH2GMessageAckNack(udpEntity.AddressString, g2hMessage.Command); if (msgAck != null) { this.Send(msgAck); } // process the message udpEntity.EntityData = g2hMessage; method.InfoV("RECV_SOCK (Success) : {0} [{1}] was received for processing.", udpEntity, udpEntity.ProcessDate.ToStringSafe()); if (_configStore.LogRawFreeformMessages) { string udpEntityString = udpEntity.ToStringRaw(FF_FlowDirection.G2H); Log.Info(udpEntityString); LOGGER.WriteLogInfo(udpEntityString + Environment.NewLine); LOGGER_UDP_RECV.WriteLogInfo(udpEntity.ProcessDate.ToStringSafe()); LOGGER_UDP_RECV.WriteLogInfo(udpEntityString + Environment.NewLine); } this.OnReceiveFromSocket(udpEntity); } catch (Exception ex) { method.Exception(ex); } } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod("MonitorHandler_GIM", "OnExecuteInternal")) { try { MonMsg_G2H msgSrc = context.G2HMessage; MonTgt_G2H_GIM_GameIDInfo tgtSrc = target as MonTgt_G2H_GIM_GameIDInfo; method.Info("GIM (CALL): IP Address : " + msgSrc.IpAddress + ", Asset No : " + tgtSrc.AssetNumber.ToStringSafe() + ", GMU No : " + tgtSrc.GMUNumber.ToStringSafe() + ", Serial No : " + tgtSrc.SerialNumber.ToStringSafe()); int? installationNo = 0; int? assetNo = 0; string pokerGamePrefix = string.Empty; if (ExCommsDataContext.Current.InsertGMULogin(tgtSrc, msgSrc.IpAddress, ref installationNo, ref assetNo, ref pokerGamePrefix)) { int assetNoInt = assetNo.SafeValue(); IPAddress hostIPAddress = null; // get the ip address if (_configExchange.Honeyframe_Cashmaster_Exchange_EnableDhcp == 1) { hostIPAddress = _configExchange.Honeyframe_Cashmaster_BMCDHCP_ServerIP.ToIPAddress(); } else { hostIPAddress = _configExchange.Honeyframe_Cashmaster_Exchange_interface.ToIPAddress(); } method.InfoV("GIM (Success): Installation no ({1:D}), Asset No : {2:D}, Game Prefix : {3} for IP : {0}, from Host : {4}", msgSrc.IpAddress, installationNo, assetNoInt, pokerGamePrefix, hostIPAddress.ToString()); int installationNo2 = installationNo.SafeValue(); if (installationNo2 > 0) { MonMsg_H2G msgDest = new MonMsg_H2G() { InstallationNo = installationNo2, IpAddress = msgSrc.IpAddress, }; MonTgt_H2G_GIM_GameIDInfo tgtDest = new MonTgt_H2G_GIM_GameIDInfo(); tgtDest.SourceAddress = hostIPAddress; tgtDest.EnableNetworkMessaging = true; if (_configStore.Iview3AssetNum) { tgtDest.AssetNumberInt = assetNoInt; tgtDest.PokerGamePrefix = pokerGamePrefix.ToString(); } // update the installation no ExMonitorServerImpl.Current .UpdateCommsServerHostAddress(installationNo2, msgSrc.HostIpAddress) .UpdateInstallatioIpAddress(installationNo2, msgSrc.IpAddress); // add the target and process msgSrc.InstallationNo = installationNo2; msgDest.Targets.Add(tgtDest); context.H2GMessage = msgDest; return(true); } } else { method.InfoV("GIM (Failure): Unable to get the installation no for IP : {0}", msgSrc.IpAddress); } } catch (Exception ex) { method.Exception(ex); } return(false); } }