private MessageTraceDetail CreateMessageTraceDetail(GetMessageTraceDetail.DalPlaceholder dalObject)
        {
            MessageTraceDetail messageTraceDetail = new MessageTraceDetail();

            messageTraceDetail.Organization   = dalObject.Organization;
            messageTraceDetail.MessageTraceId = dalObject.InternalMessageId;
            messageTraceDetail.MessageId      = dalObject.MessageId;
            messageTraceDetail.Date           = dalObject.EventDate;
            messageTraceDetail.Data           = dalObject.Data;
            messageTraceDetail.Index          = dalObject.Index;
            if (string.Equals(dalObject.EventDescription, "agentinfo", StringComparison.InvariantCultureIgnoreCase))
            {
                string @event;
                if (!string.IsNullOrEmpty(dalObject.AgentName) && this.eventNameMap.TryGetValue(dalObject.AgentName.ToLower(), out @event))
                {
                    messageTraceDetail.Event = @event;
                }
                string action;
                if (!string.IsNullOrEmpty(dalObject.Action) && this.actionNameMap.TryGetValue(dalObject.Action.ToLower(), out action))
                {
                    messageTraceDetail.Action = action;
                }
            }
            else
            {
                messageTraceDetail.Event = dalObject.EventDescription;
            }
            return(messageTraceDetail);
        }
        internal MessageTraceDetail GetSpamMessageTrace(GetMessageTraceDetail.DalPlaceholder dalObject)
        {
            string detailMessage = string.Empty;
            string text          = null;
            string action;

            switch (action = dalObject.Action)
            {
            case "sn":
                detailMessage = "MtrtMessageSpamNonProvisionedDomain";
                text          = "SCL";
                break;

            case "st":
                detailMessage = "MtrtMessageSpamAdditional";
                break;

            case "sd":
            case "so":
            case "sq":
            case "sr":
            case "ss":
            case "sx":
                detailMessage = "MtrtMessageSpam";
                text          = "SCL";
                break;
            }
            return(this.GetMessageTraceMail(dalObject, detailMessage, Strings.MtrtNoDetailInformation, new string[]
            {
                text
            }));
        }
        internal MessageTraceDetail GetAgentInfoMessageTrace(GetMessageTraceDetail.DalPlaceholder dalObject)
        {
            GetMessageTraceDetail.ParseDataDelegate parseDataDelegate;
            if (dalObject.AgentName != null && this.functionMap.TryGetValue(dalObject.AgentName.ToLower(), out parseDataDelegate))
            {
                return(parseDataDelegate(dalObject));
            }
            string arg = (dalObject.AgentName == null) ? "Null" : dalObject.AgentName;

            base.Diagnostics.TraceWarning(string.Format("Unknown AgentName[{0}]", arg));
            return(null);
        }
        internal MessageTraceDetail GetMalwareMessageTrace(GetMessageTraceDetail.DalPlaceholder dalObject)
        {
            string action;

            if ((action = dalObject.Action) != null && (action == "b" || action == "r"))
            {
                return(this.GetMessageTraceMail(dalObject, "MtrtMessageMalware", Strings.MtrtNoDetailInformation, new string[]
                {
                    "name",
                    "file"
                }));
            }
            string arg = (dalObject.Action == null) ? "Null" : dalObject.Action;

            base.Diagnostics.TraceWarning(string.Format("Unknown Malware Action[{0}]", arg));
            return(null);
        }
        internal MessageTraceDetail GetTransportRuleTrace(GetMessageTraceDetail.DalPlaceholder dalObject)
        {
            MessageTraceDetail messageTraceDetail = this.CreateMessageTraceDetail(dalObject);
            string             ruleName           = dalObject.RuleName ?? string.Empty;
            string             id = dalObject.RuleId ?? string.Empty;

            if (string.IsNullOrWhiteSpace(dalObject.PolicyId))
            {
                messageTraceDetail.Detail = Strings.MtrtMessageTransportRule(ruleName, id);
            }
            else
            {
                string policyName = dalObject.PolicyName ?? string.Empty;
                string dlpid      = dalObject.PolicyId ?? string.Empty;
                messageTraceDetail.Detail = Strings.MtrtMessageDLPRule(ruleName, id, policyName, dlpid);
            }
            return(messageTraceDetail);
        }
        internal MessageTraceDetail GetMessageTraceMail(GetMessageTraceDetail.DalPlaceholder dalObject, string detailMessage, string defaultDetailMessage, params string[] propertyNames)
        {
            MessageTraceDetail messageTraceDetail = this.CreateMessageTraceDetail(dalObject);

            if (string.IsNullOrEmpty(detailMessage))
            {
                base.Diagnostics.TraceWarning("Unknown detail message");
                messageTraceDetail.Detail = Strings.MtrtNoDetailInformation;
            }
            else if (propertyNames == null || propertyNames.Length == 0)
            {
                PropertyInfo property = typeof(Strings).GetProperty(detailMessage, BindingFlags.Static | BindingFlags.Public);
                messageTraceDetail.Detail = (LocalizedString)property.GetValue(null, null);
            }
            else
            {
                List <string> list = this.ParseXml(dalObject.Data, propertyNames);
                if (list.Count > 0)
                {
                    MethodInfo method = typeof(Strings).GetMethod(detailMessage, BindingFlags.Static | BindingFlags.Public);
                    messageTraceDetail.Detail = (LocalizedString)Schema.Utilities.Invoke(method, null, list.ToArray());
                }
                else
                {
                    base.Diagnostics.TraceWarning("No detail xml");
                    if (string.IsNullOrWhiteSpace(defaultDetailMessage))
                    {
                        base.Diagnostics.TraceWarning("Unknown default detail message");
                        messageTraceDetail.Detail = Strings.MtrtNoDetailInformation;
                    }
                    else
                    {
                        messageTraceDetail.Detail = defaultDetailMessage;
                    }
                }
            }
            return(messageTraceDetail);
        }