private static string GetEtlDumpFileName(EtlDump dump)
 {
     var format = "EtlDump_{0:yyyyMMdd_HHmm}.xml";
     if (dump.Sessions.Count > 0)
     {
         return string.Format(format, dump.Sessions[0].StartDateTime);
     }
     else
     {
         return string.Format(format, dump.DumpDateTime);
     }
 }
 public EtlDumpWriter(EtlDumpSettings settings)
 {
     _dump = new EtlDump();
 }
Ejemplo n.º 3
0
 public EtlDumpWriter(EtlDumpSettings settings)
 {
     _dump = new EtlDump();
 }
        private static string GetMailBody(string subject, string templatePath, EtlDump dump)
        {
            var sb = new StringBuilder();
            using (var writer = new StringWriter(sb))
            {
                var serializer = new XmlSerializer(typeof(EtlDump));
                serializer.Serialize(writer, dump);
            }

            var trans = new XslCompiledTransform();
            using (var xsltStream = new FileStream(templatePath, FileMode.Open, FileAccess.Read))
            {
                var xmlReader = XmlReader.Create(xsltStream);
                trans.Load(xmlReader);
            }

            using (var sr = new StringReader(sb.ToString()))
            {
                var xmlReader = XmlReader.Create(sr);
                var writer = new StringWriter();
                var xmlWriter = XmlWriter.Create(writer, trans.OutputSettings);
                var xsltArgumentList = new XsltArgumentList();
                xsltArgumentList.AddParam("subject", "", subject);
                trans.Transform(xmlReader, xsltArgumentList, xmlWriter);

                return writer.ToString();
            }
        }