Пример #1
0
 /// <summary>
 /// TODO: move status into runtime.
 /// </summary>
 /// 
 /// <param name="status"></param>
 /// <param name="runtime"></param>
 /// 
 public static void Track(string context, string status, ExchangeRuntime runtime)
 {
     string xml = CreateSoapMessage(runtime);
     FileInfo file = new FileInfo(Utility.CreateFileName(DateTime.Now, context, status, runtime.GetLead().Guid));
     StreamWriter writer = file.CreateText();
     writer.Write(xml);
     writer.Close();
 }
Пример #2
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="context"></param>
 /// <param name="status"></param>
 /// <param name="runtime"></param>
 /// <param name="html"></param>
 /// 
 public static void TrackComplete(string context, string status, ExchangeRuntime runtime, string html)
 {
     Track(context, status, runtime);
     Report(context, status, runtime, html);
 }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="status"></param>
        /// <param name="runtime"></param>
        /// 
        public static string CreateSoapMessage(ExchangeRuntime runtime)
        {
            StringBuilder xml = new StringBuilder();
            xml.Append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
            xml.Append("<soap:Envelope xmlns:soap='" + SoapURN + "' soap:id='" + runtime.GetLead().Guid + "'><soap:Header/><soap:Body>");//<dataset id='" + ruleLabel + "'>" + EventNode.InnerXml + "</dataset></soap:Body></soap:Envelope>";
            xml.AppendFormat("<ExchangeMessage vertical=\"{0}\" type=\"{1}\" status=\"{2}\">", runtime.Vertical, runtime.VerticalType, runtime.Status);

            //xml.Append("<dataset id=\"\">");
            //xml.AppendFormat("<created>{0}</created>", runtime.GetLead().Created);
            //xml.AppendFormat("<status>{0}</status>", runtime.Status);
            //xml.AppendFormat("<source><aid>{0}</aid></source>", runtime.GetLead().Aid);
            //xml.AppendFormat("<lead><email>{0}</email></lead>", runtime.GetLead().Email);
            //xml.Append("</dataset>");

            foreach (GenericStrategyEvent @event in runtime.StrategyEvents)
            {
                xml.AppendFormat("<dataset id=\"{0}\" source=\"{1}\" >{2}</dataset>", @event.Actor, @event.Source, @event.ToXml());
            }

            if (runtime.Errors.Count > 0)
            {
                xml.Append("<errors>");
                foreach (Exception exception in runtime.Errors)
                {
                    xml.AppendFormat("<error>{0}</error>", exception.Message);
                }
                xml.Append("</errors>");
            }

            xml.Append("</ExchangeMessage>");
            xml.Append("</soap:Body></soap:Envelope>");

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml.ToString());
            foreach (GenericStrategyEvent @event in runtime.StrategyEvents)
            {
                CreateSoapHeader(doc, @event.Actor, @event.Description, @event.Source, @event.ElapsedTime);
            }

            return doc.OuterXml;
        }