Ejemplo n.º 1
0
        protected override IFreeformEntity_MsgTgt CreateFreeformTarget(IMonitorEntity parent, IMonitorEntity_MsgTgt request)
        {
            using (ILogMethod method = Log.LogMethod("MonTgtParser_PC_LimitReachedNotificationMessage_H2G", "CreateMonitorTarget"))
            {
                try
                {
                    MonTgt_H2G_PC_LimitReachedNotificationMessage monTgt = request as MonTgt_H2G_PC_LimitReachedNotificationMessage;
                    if (monTgt == null)
                    {
                        return(null);
                    }

                    FFTgt_H2G_PC_LimitReachedNotificationMessage ffTgt = new FFTgt_H2G_PC_LimitReachedNotificationMessage()
                    {
                        LockType             = monTgt.LockType,
                        DisplayTime          = monTgt.DisplayTime,
                        DisplayInterval      = monTgt.DisplayInterval,
                        DisplayMessageLength = monTgt.DisplayMessageLength,
                        DisplayMessage       = monTgt.DisplayMessage
                    };
                    return(ffTgt);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                    return(null);
                }
            }
        }
        /// <summary>
        /// To create Limit Reached Monitor message from response string
        /// </summary>
        /// <param name="strResponse"></param>
        /// <returns></returns>
        public MonTgt_H2G_PC_LimitReachedNotificationMessage GetLimitReachedMessage(string strResponse)
        {
            try
            {
                MonTgt_H2G_PC_LimitReachedNotificationMessage monTgtLimitReached = new MonTgt_H2G_PC_LimitReachedNotificationMessage();

                if (HandlerHelper.Current.IsExtendedPlayer)
                {
                    monTgtLimitReached.LockType = (FF_AppId_PreCommitment_LockType)Convert.ToInt32(strResponse.Substring(50, 1));
                    monTgtLimitReached.DisplayTime = Convert.ToInt16(strResponse.Substring(51, 4));
                    monTgtLimitReached.DisplayInterval = Convert.ToInt16(strResponse.Substring(55, 4));
                }
                else
                {
                    monTgtLimitReached.LockType = (FF_AppId_PreCommitment_LockType)Convert.ToInt32(strResponse.Substring(48, 1));
                    monTgtLimitReached.DisplayTime = Convert.ToInt16(strResponse.Substring(49, 4));
                    monTgtLimitReached.DisplayInterval = Convert.ToInt16(strResponse.Substring(53, 4));
                }

                monTgtLimitReached.DisplayMessage = GetDisplayMessageForLimitReached(strResponse);
                monTgtLimitReached.DisplayMessageLength = monTgtLimitReached.DisplayMessage.Length;
                return monTgtLimitReached;
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
                return new MonTgt_H2G_PC_LimitReachedNotificationMessage();
            }
        }