Пример #1
0
        /// <summary>
        ///   Express the report in HTML.
        /// </summary>
        /// <param name="fileName">The output DOS file fame.  Include a directory.</param>
        /// <param name="persist">Whether to delete the file or not, sometimes we just want the string.</param>
        public string RenderAsHtml(string fileName, bool persist)
        {
            if (ReportHeader == null)
            {
                ReportHeader = _header;
            }
            ReportHeader = string.Format("{0} as of {1}",
                                         ReportHeader, DateTime.Now.ToString("ddd dd MMM yy HH:MM tt"));
            var h = new HtmlFile(fileName, ReportHeader)
            {
                AnnounceIt = AnnounceIt
            };

            AddStyles(h);
            var html = string.Format("<h3>{0}</h3>", ReportHeader) + Header(_header);

            if (SubHeader.Length > 0)
            {
                html += SubHeader;
            }
            html += BodyOut();
            h.AddToBody(html);
            _et.Stop(DateTime.Now);
            TimeTaken = _et.TimeOut();
            if (!string.IsNullOrEmpty(FootNote))
            {
                h.AddToBody(FootNote);
            }
            h.AddToBody(IsFooter ? ReportFooter : Footer());
            if (persist)
            {
                h.Render();
            }
            return(html);
        }
Пример #2
0
        public void Execute(T input)
        {
#if DEBUG
            var _et    = new ElapsedTimer();
            var stepNo = 0;
#endif

            foreach (var action in _actions)
            {
#if DEBUG
                _et.Start(DateTime.Now);
                stepNo++;
#endif

                action.Invoke(input);

#if DEBUG
                _et.Stop(DateTime.Now);
                Utility.Announce(string.Format("Step {1} took {0} ",
                                               _et.TimeOut(), stepNo));
#endif
            }
        }