bool IExMonServer4MonProcessorProxy.ProcessH2GMessage(MonMsg_H2G request)
        {
            using (ILogMethod method = Log.LogMethod("IExMonServer4MonProcessorProxy", "ProcessH2GMessage"))
            {
                bool result = default(bool);

                try
                {
                    if (_monProcessorProxy == null)
                    {
                        lock (_monProcessorProxyLock)
                        {
                            if (_monProcessorProxy == null)
                            {
                                _monProcessorProxy = ExMonServer4MonProcessorProxyFactory.Get(this);
                            }
                        }
                    }

                    result = _monProcessorProxy.ProcessH2GMessage(request);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }
        private MonMsg_H2G GetInstantPeriodicEntity(MonMsg_H2G response)
        {
            try
            {
                if (response.Targets.Count <= 0) return null;
                MonTgt_H2G_LP_InstantPeriodic monTgt = response.Targets[0] as MonTgt_H2G_LP_InstantPeriodic;
                if (monTgt == null) return null;

                int gmuTimeout = HandlerHelper.Current.GMUTimeOut / 1000;
                int instantPeriodicValue = (HandlerHelper.Current.InsPerDelay * (response.InstallationNo % HandlerHelper.Current.TotInstGrp));
                Log.Info(" Calculated TimeOut Value :" + instantPeriodicValue.ToString());

                int instantPeriodicInterval = instantPeriodicValue <= gmuTimeout ? gmuTimeout + 5 : instantPeriodicValue;

                monTgt.ConfiguredInterval = Convert.ToByte(instantPeriodicValue);
                monTgt.LowerOrderInterval = Convert.ToByte(instantPeriodicValue & 0xFF00 >> 8);
                monTgt.HigherOrderInterval = Convert.ToByte(instantPeriodicValue & 0xFF);

                response.Targets[0] = monTgt;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }
            return response;
        }
 protected override bool ProcessH2GMessageInternal(MonMsg_H2G request)
 {
     MonTgt_G2H_GameCapping_StartEnd tgt_G2H_GameCapping_Start = request.Targets[0] as MonTgt_G2H_GameCapping_StartEnd;
     IGameCapping gameCapping = GameCapping.GetInstance();
     gameCapping.Process_GameCapping(request.SiteCode, request.InstallationNo, tgt_G2H_GameCapping_Start, this.IsGameUnCapping);
     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;
            }
        }
 public void SetInstantPeriodicConfig(MonMsg_H2G response)
 {
     try
     {
         this.ProcessH2GMessage(GetInstantPeriodicEntity(response));
     }
     catch(Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
 public int EnableDisableAFT(int installatioNo, bool enable)
 {
     MonMsg_H2G message = new MonMsg_H2G()
     {
         InstallationNo = installatioNo,
     };
     MonitorEntity_MsgTgt target = null;
     if (enable) target = new MonTgt_H2G_EFT_SystemEnable();
     else target = new MonTgt_H2G_EFT_SystemDisable();
     message.Targets.Add(target);
     return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(message) ? 0 : -1;
 }
 public int EnableDisableMachine(int installatioNo, bool enable)
 {
     MonMsg_H2G message = new MonMsg_H2G()
     {
         InstallationNo = installatioNo,
     };
     message.Targets.Add(new MonTgt_H2G_Client_EnableDisableMachine
     {
         EnableDisable = enable,
     });
     return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(message) ? 0 : -1;
 }
 public int RemoveUDPFromListWithoutWait(int installatioNo)
 {
     MonMsg_H2G message = new MonMsg_H2G()
     {
         InstallationNo = installatioNo,
     };
     message.Targets.Add(new MonTgt_H2G_Client_RemoveUDPFromList
     {
         InstallationNo = installatioNo,
     });
     return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(message) ? 0 : -1;
 }
 public int AddUDPToListWithoutWait(int installatioNo, int barPositionPortNo)
 {
     MonMsg_H2G message = new MonMsg_H2G()
     {
         InstallationNo = installatioNo,
     };
     message.Targets.Add(new MonTgt_H2G_Client_AddUDPToList
     {
         ServerIP = GetServerName(),
         Port = barPositionPortNo,
         PollingID = 0,
         Type = 7
     });
     return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(message) ? 0 : -1;
 }
        bool IExMonServer4MonProcessorProxy.ProcessH2GMessage(MonMsg_H2G request)
        {
            using (ILogMethod method = Log.LogMethod("IExMonServer4MonProcessorProxy", "ProcessH2GMessage"))
            {
                bool result = default(bool);

                try
                {
                    result = this.MonitorProcessorProxy.ProcessH2GMessage(request);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }
Exemple #11
0
 private FFMsg_H2G InvokeAndReturnFreeFormEntity(MonMsg_H2G monEntity)
 {
     try
     {
         KeyValuePair <int, int> _value = new KeyValuePair <int, int>(monEntity.FaultSource, monEntity.FaultType);
         if (_monEntitymsg_G2H.ContainsKey(_value))
         {
             if (monEntity.Targets[0] == null)
             {
                 return(null);
             }
             return(_monEntitymsg_G2H[_value].DynamicInvoke(monEntity.Targets[0]) as FFMsg_H2G);
         }
         return(null);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
         return(null);
     }
 }
        internal int SendSectorCommand()
        {
            if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime))
            {
                return -1;
            }



            DataTable dt = DBBuilder.GetInstallationsForInstantPeriodicInterval();
            if (dt == null || dt.Rows.Count == 0) return -1;

            byte[] bData = { };

            m_SectorData.Command = Convert.ToByte(0x71);
            m_SectorData.PutCommandDataVB(bData);

            foreach (DataRow dr in dt.Rows)
            {
                int installationNo = 0;
                try
                {
                    if (mEvent.WaitOne(NetworkServiceSettings.RequestWaitTime))
                    {
                        break;
                    }

                    if (Int32.TryParse(dr["Installation_No"].ToString(), out installationNo))
                    {
                        #if !NEW_EXCOMMS
                        _exchangeClient.RequestExWriteSector(installationNo, 203, m_SectorData);
                        #else
                                                MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
                        {
                            InstallationNo = installationNo,
                        };
                        monMsg_H2G.Targets.Add(new MonTgt_H2G_InstantPeriodicNW { });
                        return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
                        #endif

                        LogManager.WriteLog("|##> Successfully sent the details for installation : " + installationNo.ToString(), LogManager.enumLogLevel.Info);
                    }
                    else
                    {
                        LogManager.WriteLog("|##> Unable to get the installation from database for installation : " + installationNo.ToString(), LogManager.enumLogLevel.Error);
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog("|##> Unable to send command for Installation : " + installationNo.ToString(), LogManager.enumLogLevel.Error);
                    ExceptionManager.Publish(ex);
                }
            }
            
            return 0;
        }
 protected virtual bool ProcessH2GMessageInternal(MonMsg_H2G request)
 {
     return _monitorServer._transceiver.ProcessH2GMessage(request);
 }
        public virtual bool ProcessH2GMessage(MonMsg_H2G response)
        {
            bool result = false;

            try
            {
                result = _monitorServer._transceiver.ProcessH2GMessage(response);
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }

            return result;
        }
 public bool ProcessH2GMessage(MonMsg_H2G request)
 {
     return false;
 }
 public int TotalGames(int installatioNo)
 {
     MonMsg_H2G message = new MonMsg_H2G()
     {
         InstallationNo = installatioNo,
     };
     message.Targets.Add(new MonTgt_H2G_LP_TotalGames());
     return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(message) ? 0 : -1;
 }
 void OnProcessH2GMessageFromWorker(MonMsg_H2G request)
 {
     if (!_isMonProcessorStandalone)
     {
         ((IExMonServer4MonProcessor) _monitorServer).ProcessH2GMessage(request);
     }
     else
     {
         _monitorServer.MonitorProcessorProxy.ProcessH2GMessage(request);
     }
 }
 bool IExMonitorServerImpl.ProcessH2GMessage(MonMsg_H2G request)
 {
     return ((IExMonServer4MonProcessor)this).ProcessH2GMessage(request);
 }
Exemple #19
0
        //
        private int DisableTITO(int installation_no)
        {
            try
            {
                /*Send Tito Enable/Disable*/
                m_SectorData.Command = 0x82;
                byte[] bData = { 0 }; /*0-disable , 1 - enable*/
                m_SectorData.PutCommandDataVB(bData);
                
                
                #if !NEW_EXCOMMS
                _exchangeClientTITOEnDis.RequestExWriteSector(installation_no, 203, m_SectorData);
                return _iExchangeAdminTITOEnDis.LastMessageID;

                #else
                MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
                {
                    InstallationNo = installation_no,
                };
                monMsg_H2G.Targets.Add(new MonTgt_H2G_EnableDisableTITONW { EnableDisable = false });
                return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
                #endif

            }
            catch (Exception ex)
            {
                LogManager.WriteLog(string.Format("Failed TITO Disable", ex.Message), LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return -1;
            }

        }
        /// <summary>
        /// Disable Machine- Call to Disable a Specific Installation
        /// </summary>
        /// <param name="datapak">Installation No/Datapak No</param>
        /// <returns>Unique Message ID</returns>
        /// 
        internal int DisableMachine(int InstallationNo)
        {
            byte[] bData = { 1 };

            sector203Data.Command = Convert.ToByte(0x80);
            sector203Data.PutCommandDataVB(bData);

            #if !NEW_EXCOMMS
            _exchangeClient.RequestExWriteSector(InstallationNo, 203, sector203Data);
            return _iExchangeAdmin.LastMessageID;
            #else
                        MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
            {
                InstallationNo = InstallationNo,
            };
            monMsg_H2G.Targets.Add(new MonTgt_H2G_EnableDisableMachineNW { });
            return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
            #endif

        }
        public int AFTDisable(int _installation_no)
        {

            m_SectorData.Command = 0x4D;
            byte[] bData = { };
            m_SectorData.PutCommandDataVB(bData);

            #if !NEW_EXCOMMS
            _exchangeClient.RequestExWriteSector(_installation_no, 203, m_SectorData);
            return _iExchangeAdmin.LastMessageID;
            #else
            MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
            {
                InstallationNo = _installation_no,
            };
            monMsg_H2G.Targets.Add(new MonTgt_H2G_SystemDisbale { });
            return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
            #endif
        } 
        /// <summary>
        /// TO process GameIdInfo message
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private bool ProcessGameIdInfoMessage(MonMsg_G2H request)
        {
            try
            {
                MonTgt_G2H_GIM_GameIDInfo monTgtMsg = request.Targets[0] as MonTgt_G2H_GIM_GameIDInfo;
                if (monTgtMsg == null) return false;

                int? installationNo = 0;
                string assetNo = string.Empty;
                char? gamePrefix = '\0';

                if (GIM_DataAccess.GetInstance().InsertGMULogin(monTgtMsg, request.IpAddress, ref installationNo, ref assetNo, ref gamePrefix))
                {
                    MonMsg_H2G monH2G_Msg = new MonMsg_H2G();
                    MonTgt_H2G_GIM_GameIDInfo monH2G_GameIdInfo_Msg = new MonTgt_H2G_GIM_GameIDInfo();

                    monH2G_Msg.FaultSource = Convert.ToInt32(FaultSource.GIM_Event);
                    monH2G_Msg.FaultType = Convert.ToInt32(FaultType_GIM.Game_Id_Info_H2G);
                    monH2G_Msg.IpAddress = request.IpAddress;
                    monH2G_Msg.InstallationNo = installationNo.GetValueOrDefault();

                    monH2G_GameIdInfo_Msg.SourceAddress = new System.Net.IPAddress(Convert.ToByte(request.IpAddress));
                    monH2G_GameIdInfo_Msg.AssetNumber = assetNo;
                    monH2G_GameIdInfo_Msg.PokerGamePrefix = gamePrefix.ToString();

                    monH2G_Msg.AddTarget(monH2G_GameIdInfo_Msg);
                    this.ProcessH2GMessage(monH2G_Msg);
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                return false;
            }
        }
Exemple #23
0
        /// <summary>
        /// Converts Monitor entity message to Freeform entity message
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>Freeform entity message.</returns>
        public FFMsg_H2G CreateEntity(MonMsg_H2G request)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "CreateEntity"))
            {
                FFMsg_H2G result = null;
                try
                {
                    if (request == null || request.Targets.Count == 0)
                    {
                        Log.Info("Unable to create the freeform message (Invalid targets found).");
                        return(null);
                    }

                    string key = request.FaultSourceTypeKey;

                    foreach (var monTgt in request.Targets)
                    {
                        IMonTgtParser parser = null;
                        MonTgtParserMappingH2GAttribute mappingAttribute = null;

                        //if (_tgtParserMappingsH2G.ContainsKey(key))
                        //{
                        //    parser = _tgtParserMappingsH2G[key];
                        //    mappingAttribute = parser.MappingAttributeH2G;
                        //}

                        //if (parser == null)
                        //{
                        key = monTgt.GetType().FullName;
                        if (_tgtParserMappingsByTypeH2G.ContainsKey(key))
                        {
                            parser           = _tgtParserMappingsByTypeH2G[key];
                            mappingAttribute = parser.MappingAttributeH2G;
                        }
                        //}

                        if (parser != null)
                        {
                            IFreeformEntity_MsgTgt ffTgt = parser.CreateEntity(request, monTgt) as IFreeformEntity_MsgTgt;
                            if (ffTgt != null)
                            {
                                if (result == null)
                                {
                                    result = FreeformEntityFactory.CreateEntity <FFMsg_H2G>(FF_FlowDirection.H2G,
                                                                                            new FFCreateEntityRequest_H2G()
                                    {
                                        PollCode  = mappingAttribute.PollCode,
                                        SessionID = mappingAttribute.SessionID,
                                        IPAddress = request.IpAddress,
                                    });
                                    result.InstallationNo = request.InstallationNo;
                                }
                                result.Targets.Add(ffTgt);
                            }
                        }
                    }

                    if (result == null)
                    {
                        Log.Info("Unable to create the freeform message");
                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return(result);
            }
        }
        public void Mon2FF_GIM_GameIDInfo_H2G()
        {
            MonMsg_H2G monMsg = new MonMsg_H2G()//(FaultSource.GIM_Event, (int)FaultType_GIM.Game_Id_Info_H2G)
            {
                InstallationNo = 4,
            };
            monMsg.Targets.Add(new MonTgt_H2G_GIM_GameIDInfo()
            {
                AssetNumberInt = 111,
                EnableNetworkMessaging = true,
                PokerGamePrefix = "A",
                SourceAddress = Extensions.GetIpAddress(-1),
            });
            IFreeformEntity ff = MonitorEntityFactory.CreateEntity(monMsg);
            Assert.IsNotNull(ff);

            byte[] buffer2 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, ff);
            string sBuffer2 = buffer2.GetConvertBytesToHexString(string.Empty);
        }
Exemple #25
0
 public static FFMsg_H2G CreateEntity(MonMsg_H2G monEntityMsg)
 {
     return(Factory.CreateEntity(monEntityMsg));
 }
        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;
            }
        }
Exemple #27
0
        private int SetSiteCode(int nInstallationNo)
        {
            try
            {
                /*Send OPtParam*/
                m_SectorData.Command = 0x81;
                byte[] bData = { };
                m_SectorData.PutCommandDataVB(bData);

                #if !NEW_EXCOMMS
                _exchangeClientSiteCode.RequestExWriteSector(nInstallationNo, 203, m_SectorData);
                return _iExchangeAdminSiteCode.LastMessageID;
                #else
                   MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
                {
                    InstallationNo = nInstallationNo,
                };
                monMsg_H2G.Targets.Add(new MonTgt_H2G_SetSiteCodeNW { });
                return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
                #endif

            }
            catch (Exception ex)
            {
                LogManager.WriteLog("SetSiteCode | Exception Occured." + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return -1;
            }
        }
        protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal"))
            {
                bool result = default(bool);
                int installationNo = 0;
                MonMsg_H2G h2gMessage = null;
                Lazy<IList<MonitorEntity_MsgTgt>> invalidTargets = new Lazy<IList<MonitorEntity_MsgTgt>>(
                    () => { return new List<MonitorEntity_MsgTgt>(); });

                try
                {
                    if (context.G2HMessage != null)
                    {
                        MonMsg_G2H request = context.G2HMessage;
                        installationNo = request.InstallationNo;
                        foreach (var target2 in request.Targets)
                        {
                            if (target2 is IMonTgt_Secondary) continue;

                            string key = target2.FaultSourceTypeKey;
                            if (_handlerMappings.ContainsKey(key))
                            {
                                request.FaultSource = target2.FaultSource;
                                request.FaultType = target2.FaultType;
                                result |= _handlerMappings[key].Execute(context, target2);
                            }
                            else
                            {
                                invalidTargets.Value.Add(target2);
                            }
                        }
                        if (installationNo <= 0)
                            installationNo = context.G2HMessage.InstallationNo;
                    }

                    // unmapped targets
                    if (invalidTargets.Value != null &&
                        invalidTargets.Value.Count > 0)
                    {
                        foreach (var target2 in invalidTargets.Value)
                        {
                            result |= _faultHandler.Execute(context, target2);
                        }
                    }

                    if (context.H2GMessage != null)
                    {
                        h2gMessage = context.H2GMessage;
                    }
                    else if (context.H2GTargets != null &&
                        context.H2GTargets.Count > 0)
                    {
                        h2gMessage = new MonMsg_H2G()
                        {
                            InstallationNo = installationNo,
                        };
                        h2gMessage.Targets.AddRange(context.H2GTargets);
                    }
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }
                finally
                {
                    if (h2gMessage != null)
                    {
                        if (h2gMessage.InstallationNo <= 0)
                            h2gMessage.InstallationNo = installationNo;
                        (ExMonitorServerImpl.Current as IExMonServer4CommsServer2).ProcessH2GMessage(h2gMessage);
                    }
                }

                return result;
            }
        }
Exemple #29
0
        public int SetTicketExpire(int installation_no, int TicketExpireDays)
        {
            try
            {
                m_SectorData.Command = 0x83;
                byte[] bData = { };
                m_SectorData.PutCommandDataVB(bData);
                
                #if !NEW_EXCOMMS
                _exchangeClientTITOEXP.RequestExWriteSector(installation_no, 203, m_SectorData);
                return _iExchangeAdminTITOEXP.LastMessageID;
                #else
                MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
                {
                    InstallationNo = installation_no,
                };
                monMsg_H2G.Targets.Add(new MonTgt_H2G_SetTicketExpireNW { NoOfDays = TicketExpireDays });
                return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
                #endif

            }
            catch (Exception ex)
            {
                LogManager.WriteLog("SetTicketExpire | Exception Occured." + ex.Message, LogManager.enumLogLevel.Info);
                ExceptionManager.Publish(ex);
                return -1;
            }

        }
        public int EmployeecardSend(string EmpCardNo, string EmployeeFlags, int InstallationNo)
        {
            try
            {
                m_SectorData.Command = 0x84;
                string EmpFlags = EmployeeFlags.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, EmpCardNo.PadLeft(10, '0').Length)
                         .Where(x => x % 2 == 0)
                         .Select(x => Convert.ToByte(EmpCardNo.PadLeft(10, '0').Substring(x, 2), 16)).ToList();

                enumver.Insert(0, Convert.ToByte(EmployeeFlags.Substring(0, 1)));
                enumver.Insert(1, Convert.ToByte(EmployeeFlags.Substring(1, 1)));
                enumver.InsertRange(0, cardno);

                byte[] bData = enumver.ToArray();

                m_SectorData.PutCommandDataVB(bData);

                
                #if !NEW_EXCOMMS
                _exchangeClient.RequestExWriteSector(InstallationNo, 203, m_SectorData); 
                return _iExchangeAdmin.LastMessageID;
                #else
                                MonMsg_H2G monMsg_H2G = new MonMsg_H2G()
                {
                    InstallationNo = InstallationNo,
                };
                monMsg_H2G.Targets.Add(new MonTgt_H2G_EmployeeCard { Message = "" });
                return ExMonServer4MonClientProxyFactory.Get().ProcessH2GMessage(monMsg_H2G) ? 0 : -1;
                #endif

            }
            catch(Exception ex)
            {
                ExceptionManager.Publish(ex);
                return 0;
            }
           
        }
 public void ForcePeriodicMeter(MonMsg_H2G response)
 {
     this.ProcessH2GMessage(response);
 }
        public bool ProcessH2GMessage(MonMsg_H2G request)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessH2GMessage"))
            {
                bool result = false;

                try
                {
                    // find the queue executor by fault source and type
                    IThreadPoolExecutor<MonMsg_H2G> executor = this.GetExecutorH2G(request);
                    executor.QueueWorkerItem(request);
                    result = true;
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }    
        }