/// <summary>
        /// 功用描述:将Table内容导出为指定格式文件
        /// 创建人:  陈国迎
        /// 创建日期:2006-06-06
        /// </summary>
        /// <param name="objTable">表名</param>
        /// <param name="strFileName">文件名</param>
        /// <param name="strFormat">格式名(调ExportFileType结构体)</param>
        public void ExportHtmlTableToFormatedFile(System.Web.UI.HtmlControls.HtmlTable objTable, string strFileName, string strFormat)
        {
            //清空即有内容
            Response.Clear();

            //定义输出格式
            string strStype = @"<style>.text { mso-number-format:\@; } </style>";

            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.UrlEncode("" + strFileName + "", System.Text.Encoding.UTF8) + "." + strFormat + "");
            Response.Charset         = "utf-8";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            Response.Cache.SetCacheability(HttpCacheability.Public);
            Response.ContentType = "application/vnd." + strFormat + "";

            //定义输出流
            System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);
            objTable.RenderControl(htmlWrite);


            Response.Write(strStype);
            Response.Write(stringWrite.ToString());

            //结束输出
            Response.End();
        }
        public void ASPXToPDF(HtmlTable objhtml1,  HtmlTable objhtml2)
        {
            string fileName = "AsignacionFolios.pdf";
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.Clear();

            StringWriter sw1 = new StringWriter();
            HtmlTextWriter hw1 = new HtmlTextWriter(sw1);
            objhtml1.RenderControl(hw1);

            StringWriter sw2 = new StringWriter();
            HtmlTextWriter hw2 = new HtmlTextWriter(sw2);
            objhtml2.RenderControl(hw2);

            StringReader sr1 = new StringReader(sw1.ToString());
            StringReader sr2 = new StringReader(sw2.ToString());

            Document pdfDoc = new Document(PageSize.A2, 5f, 5f, 5f, 5f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream);
            pdfDoc.Open();
            htmlparser.Parse(sr1);
            pdfDoc.NewPage();

            htmlparser.Parse(sr2);
            pdfDoc.Close();

            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
            HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            HttpContext.Current.Response.Write(pdfDoc);
            HttpContext.Current.Response.End();
        }
示例#3
0
        public override string GetDesignTimeHtml()
        {
            StringWriter sw = new StringWriter();

            HtmlTextWriter htw = new HtmlTextWriter(sw);
            HtmlTable t = new HtmlTable();
            t.Align = mp.Align.ToString();
            t.CellPadding = 2;
            t.CellSpacing = 0;
            t.BorderColor = ColorTranslator.ToHtml(mp.BorderColor);
            t.BgColor = ColorTranslator.ToHtml(mp.BackColor);
            t.Width = mp.Width.ToString();
            t.Height = mp.Height.ToString();

            HtmlTableRow tr = new HtmlTableRow();
            HtmlTableCell td = new HtmlTableCell();
            td.VAlign = "top";
            td.Align = "center";

            // inner table for iframe
            HtmlTable iframe = new HtmlTable();
            //iframe.BgColor = "#FFFFFF";
            iframe.Width="100%";
            iframe.Height="100%";
            iframe.CellPadding = 0;
            iframe.CellSpacing = 0;
            //iframe.Style.Add("border","1 solid ");
            //iframe.Style.Add("border","1 solid " + ColorTranslator.ToHtml(mytb.EditorBorderColorDark));
            HtmlTableRow tr2 = new HtmlTableRow();
            HtmlTableCell td2 = new HtmlTableCell();
            td2.VAlign = "middle";
            td2.Align = "center";
            td2.Controls.Add(new LiteralControl("<b><font face=arial size=2><font color=green>My</font>Pager:</b> " + mp.ID + "</font>&nbsp;&nbsp;<font size=2>1 2 3 4 <font color="+ColorTranslator.ToHtml(mp.CurrentNumberBgColor)+">5</font> 6 7 8 9</font>"));
            tr2.Cells.Add(td2);
            iframe.Rows.Add(tr2);

            td.Controls.Add(iframe);
            //td.Controls.Add(new LiteralControl("<br><br><br>"));
            tr.Cells.Add(td);
            t.Rows.Add(tr);
            t.RenderControl(htw);
            return sw.ToString();
        }
        public string TableContentDesigner()
        {            


            StringWriter sw = new StringWriter();

            HtmlTextWriter htw = new HtmlTextWriter(sw);
            HtmlTable t = new HtmlTable();
            t.CellPadding = 3;
            t.CellSpacing = 0;
            t.BorderColor = "#6699cc";
            t.BgColor = "#6699cc";
            t.Width = ptbc.Width.ToString();
            t.Height = ptbc.Height.ToString();
            HtmlTableRow tr = new HtmlTableRow();
            HtmlTableCell td = new HtmlTableCell();
            td.VAlign = "top";
            td.Align = "center";

            // inner table for iframe
            HtmlTable iframe = new HtmlTable();
            iframe.BgColor = "#FFFFFF";
            iframe.Width = "600px";
            iframe.Height = "500px";
            iframe.CellPadding = 0;
            iframe.CellSpacing = 0;
            iframe.Style.Add("border", "1 solid " + "#6699cc");
            HtmlTableRow tr2 = new HtmlTableRow();
            HtmlTableCell td2 = new HtmlTableCell();
            td2.VAlign = "middle";
            td2.Align = "center";
            td2.Controls.Add(new LiteralControl("<b><font face=arial size=2><font color=green>Power</font>TalkBox:</b> " + ptbc.ID+ "</font>"));
            tr2.Cells.Add(td2);
            iframe.Rows.Add(tr2);

            td.Controls.Add(iframe);
            td.Controls.Add(new LiteralControl("<br><br><br>"));
            tr.Cells.Add(td);
            t.Rows.Add(tr);
            t.RenderControl(htw);
            return sw.ToString();
        }
示例#5
0
        private static MvcHtmlString WriteToHtml(HtmlTable table)
        {
            var sw = new StringWriter(new StringBuilder());
            var htw = new HtmlTextWriter(sw);

            table.RenderControl(htw);
            return new MvcHtmlString(sw.ToString());
        }
        protected void renderGlobalOptions(HtmlTextWriter writer, Widget_Builder_Options renderingOptions)
        {
            HtmlTable globalOptionsTable = new HtmlTable();
            HtmlTableRow tr;
            HtmlTableCell td;
            TextBox textBox;

            tr = new HtmlTableRow();
            globalOptionsTable.Rows.Add(tr);

                //max widgets
                td = new HtmlTableCell();
                tr.Cells.Add(td);
                td.InnerText = "Max Widgets Per Property";

                td = new HtmlTableCell();
                tr.Cells.Add(td);
                textBox = new TextBox();
                textBox.CssClass = "maxWidgets";
                textBox.Text = renderingOptions.maxWidgets.ToString();
                td.Controls.Add(textBox);

            tr = new HtmlTableRow();
            globalOptionsTable.Rows.Add(tr);

                //js include
                td = new HtmlTableCell();
                tr.Cells.Add(td);
                td.InnerText = "JS Include Path";

                td = new HtmlTableCell();
                tr.Cells.Add(td);
                textBox = new TextBox();
                textBox.CssClass = "jsInclude";
                textBox.Text = renderingOptions.jsIncludePath;
                td.Controls.Add(textBox);

            tr = new HtmlTableRow();
            globalOptionsTable.Rows.Add(tr);

                //css include
                td = new HtmlTableCell();
                tr.Cells.Add(td);
                td.InnerText = "CSS Include Path";

                td = new HtmlTableCell();
                tr.Cells.Add(td);
                textBox = new TextBox();
                textBox.CssClass = "cssInclude";
                textBox.Text = renderingOptions.cssIncludePath;
                td.Controls.Add(textBox);

            globalOptionsTable.RenderControl(writer);
        }
        public override void GenerateReport()
        {
            TeamSiteFile tf = new TeamSiteFile();
            string fileName = System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteLastModifiedReportLocation"];
            string lastModified;

            StreamWriter fwriter = File.CreateText( fileName );
            Console.WriteLine("Creating file "+System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteLastModifiedReportLocation"]);

            HtmlTextWriter txtWriter=new HtmlTextWriter(fwriter);

            HtmlTable reportHtmlTable = new HtmlTable();
            reportHtmlTable.BgColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.White);
            reportHtmlTable.Border = 1;
            reportHtmlTable.BorderColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.LightGray );
            reportHtmlTable.Style.Add("font-family", "Verdana");
            reportHtmlTable.Style.Add("font-size", "9pt");

            HtmlTableRow trMessage = new HtmlTableRow();
            HtmlTableCell tcMessage = new HtmlTableCell();
            tcMessage.ColSpan = 4;
            tcMessage.InnerText = @"Last run: " + System.DateTime.Now.ToString();
            tcMessage.Style.Add("font-style","italic");
            trMessage.Cells.Add(tcMessage);
            reportHtmlTable.Rows.Add(trMessage);

            reportHtmlTable.BgColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.White);
            reportHtmlTable.Border = 1;
            reportHtmlTable.BorderColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.LightGray );
            reportHtmlTable.Style.Add("font-family", "Verdana");
            reportHtmlTable.Style.Add("font-size", "9pt");

            HtmlTableRow trHeader = new HtmlTableRow();
            trHeader.Style.Add("font-weight","bold");

            //teamsite name
            HtmlTableCell tcHeader1 = new HtmlTableCell();
            tcHeader1.InnerText = "teamsite name";
            trHeader.Cells.Add(tcHeader1);

            //teamsite url
            HtmlTableCell tcHeader2 = new HtmlTableCell();
            tcHeader2.InnerText = "teamsite url";
            trHeader.Cells.Add(tcHeader2);

            //teamsite brand
            HtmlTableCell tcHeader3 = new HtmlTableCell();
            tcHeader3.InnerText = "brand";
            trHeader.Cells.Add(tcHeader3);

            //teamsite lastModified
            HtmlTableCell tcHeader4 = new HtmlTableCell();
            tcHeader4.InnerText = "last modified";
            trHeader.Cells.Add(tcHeader4);
            reportHtmlTable.Rows.Add(trHeader);

            Console.WriteLine("Connecting to site...");
            SPSite siteCollection = new SPSite(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteUrl"]);
            SPWebCollection sites = siteCollection.AllWebs;
            try
            {
                foreach (SPWeb site in sites)
                {
                    lastModified = "01/01/1900 01:01:01";

                    //go through the lists in the site for the later lastmodified date
                    foreach (SPList list in site.Lists)
                    {
                        if (System.DateTime.Parse(lastModified) < list.LastItemModifiedDate)
                            lastModified = list.LastItemModifiedDate.ToString();
                    }

                    Console.WriteLine("Site:"+site.Name+" last modified:"+lastModified);
                    HtmlTableRow trData = new HtmlTableRow();

                    //teamsite name
                    HtmlTableCell tcData1 = new HtmlTableCell();
                    tcData1.InnerText = site.Name;
                    trData.Cells.Add(tcData1);

                    //teamsite url
                    HtmlTableCell tcData2 = new HtmlTableCell();
                    HtmlAnchor ha1 = new HtmlAnchor();
                    ha1.InnerText=site.Url;
                    ha1.HRef=site.Url;
                    tcData2.Controls.Add(ha1);
                    trData.Cells.Add(tcData2);

                    //teamsite brand
                    HtmlTableCell tcData3 = new HtmlTableCell();
                    string brand = site.Url.ToString();
                    try
                    {
                        string[] ary = brand.Split('/');
                        tcData3.InnerText = ary[3].ToString(); // e.g. http:///blahblah fourth index will contain the brand
                    }
                    catch  //the url may not contain the brand for instance the top level site
                    {
                        tcData3 .InnerText = "na";
                    }
                    trData.Cells.Add(tcData3);

                    //teamsite last modified date
                    HtmlTableCell tcData4 = new HtmlTableCell();
                    tcData4.InnerText = lastModified;
                    trData.Cells.Add(tcData4);

                    reportHtmlTable.Rows.Add(trData);

                    site.Dispose();
                }
            }
            catch (Exception ex)
            {
                FileErrorLogger _logger = new FileErrorLogger();
                _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                    ErrorType.TypeApplication, "TeamSiteReports.UploadFile()");
                _logger = null;
            }
            finally
            {
                siteCollection.Dispose();
            }

            reportHtmlTable.RenderControl(txtWriter);

            txtWriter.Close();
            tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteLastModifiedReportLocation"],
                System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteLastModifiedReportDestination"]);
        }
示例#8
0
        private void RenderCheckBoxList(HtmlTextWriter writer)
        {
            List<CCheckItem> listItem = new List<CCheckItem>();
            foreach (CCheckItem obj in CheckItems)
            {
                if (obj.ItemType == ItemType.项目)
                {
                    listItem.Add(obj);
                }
            }
            if (listItem.Count == 0)
            {
                writer.Write("");
                return;
            }

            string strItemIDs = "";
            for (int i = 0; i < listItem.Count; i++)
            {
                if (strItemIDs != "")
                {
                    strItemIDs += ",";
                }
                strItemIDs += (i + ItemIndex).ToString();
            }

            int rows = 0;
            rows = (int)Math.Ceiling((decimal)listItem.Count / (decimal)RepeatColumns);

            HtmlTable tableCheckBox = new HtmlTable();
            tableCheckBox.Style.Value = "border: 0px solid white; padding: 0px; width: 100%;";

            for (int i = 0; i < rows; i++)
            {
                HtmlTableRow row = new HtmlTableRow();
                tableCheckBox.Rows.Add(row);

                for (int j = 0; j < RepeatColumns; j++)
                {
                    HtmlTableCell cell = new HtmlTableCell();
                    cell.Style.Value = "width: " + 100 / RepeatColumns + "%;";
                    row.Cells.Add(cell);

                    if ((i * RepeatColumns + j) < listItem.Count)
                    {
                        if (listItem[i * RepeatColumns + j].BackColor != "")
                        {
                            cell.Style.Value += " background-color: " + listItem[i * RepeatColumns + j].BackColor;
                        }
                        if (listItem[i * RepeatColumns + j].Color != "")
                        {
                            cell.Style.Value += " color: " + listItem[i * RepeatColumns + j].Color;
                        }

                        string strSingleMode = "";

                        if (SingleMode == SingledType.Group)
                        {
                            strSingleMode = " onclick=\"CheckBoxSingleSelect('" + this.ClientID + "', '" + strItemIDs + "', '" + ItemIndex.ToString() + "')\"";
                        }
                        else if (SingleMode == SingledType.All)
                        {
                            strSingleMode = " onclick=\"CheckBoxSingleSelect('" + this.ClientID + "', '', '" + ItemIndex.ToString() + "')\"";
                        }

                        cell.InnerHtml = "<input type=\"checkbox\" id=\"" +
                             this.ClientID + "_CheckBox_" + ItemIndex.ToString() + "\" selectedtext=\"" +
                             listItem[i * RepeatColumns + j].Text + "\" value=\"" + listItem[i * RepeatColumns + j].Value + "\"" +
                             strSingleMode +
                             " name=\"" + this.ClientID + "_CheckBoxItem" + "\"";
                        cell.InnerHtml += " />";

                        cell.InnerHtml += "<label for=\"" + this.ClientID + "_CheckBox_" + ItemIndex.ToString() + "\">" + listItem[i * RepeatColumns + j].Text + "</label>";
                        ItemIndex += 1;
                    }
                }
            }

            tableCheckBox.RenderControl(writer);
        }
        /// <summary>
        /// Prints the overall stats.
        /// </summary>
        /// <returns></returns>
        public StringBuilder PrintOverallStats()
        {
            HtmlTable table = new HtmlTable();
            table.BorderColor = "#FFFFFF";
            table.EnableTheming = true;
            table.Border = 0;
            table.BorderColor = "#000000";
            table.Width = "100%";
            table.CellSpacing = 0;

            HtmlTableRow appheaderRow = new HtmlTableRow();
            HtmlTableCell header = new HtmlTableCell("th");
            header.ColSpan = 1;
            appheaderRow.BgColor = "#FFFFFF";
            appheaderRow.BorderColor = "#FFFFFF";
            header.BgColor = "#FFFFFF";
            header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:8pt;color:#FFFFFF; word-spacing:normal";
            header.Align = "Left";
            header.InnerHtml = "<br>";
            appheaderRow.Cells.Add(header);
            table.Rows.Add(appheaderRow);

            appheaderRow = new HtmlTableRow();
            header = new HtmlTableCell("th");
            header.ColSpan = 1;
            appheaderRow.BgColor = "#FFFFFF";
            appheaderRow.BorderColor = "#FFFFFF";
            header.BgColor = "#FFFFFF";
            header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:13pt;color:#666; word-spacing:normal";
            header.Align = "Left";
            header.InnerText = this.reportHeader;
            appheaderRow.Cells.Add(header);
            table.Rows.Add(appheaderRow);

            HtmlTableRow tableHeadings = new HtmlTableRow();
            HtmlTableCell headingCell;
            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();
            tableHeadings.BgColor = "#FFFFFF";
            headingCell.InnerHtml = "<br>";
            headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:5pt;font-weight:bold;padding:5px 5px 5px 5px;color:#FFFFFF;";
            tableHeadings.Cells.Add(headingCell);
            table.Rows.Add(tableHeadings);

            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();

            headingCell.InnerHtml = @"<span style=""color:#666""><b> Browser: </b></span>" + BaseClass.GetBrowserNameAndVersion();
            tableHeadings.BgColor = "#FFFFFF";
            headingCell.ColSpan = 1;
            headingCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px;";
            tableHeadings.Cells.Add(headingCell);
            table.Rows.Add(tableHeadings);

            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();
            headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Test(s): </b></span>" + this.NoTests();
            tableHeadings.BgColor = "#FFFFFF";
            headingCell.ColSpan = 1;
            headingCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px;";
            tableHeadings.Cells.Add(headingCell);
            table.Rows.Add(tableHeadings);

            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();
            if (this.NoTestsCompleted() == 0)
            {
                headingCell.BgColor = "#FFFFFF";
                headingCell.InnerHtml = @"<b><span style=""color:#666""> No. of Passed Test(s)</span></b>: None";
                headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
            }
            else
            {
                headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Passed Test(s): </b></span>" + this.NoTestsCompleted().ToString() + " of " + this.NoTests().ToString() + "&nbsp;&nbsp;" + @"<div style=""background:#397439; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
            }

            tableHeadings.Cells.Add(headingCell);
            table.Rows.Add(tableHeadings);

            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();
            if (this.NoTestsFailed() == 0)
            {
                headingCell.BgColor = "#FFFFFF";
                headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Failed Test(s):</b></span> None";
                headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
            }
            else
            {
                headingCell.InnerHtml = @"<span style=""color:#666""><b>No. of Failed Test(s): </b></span>" + this.NoTestsFailed().ToString() + " of " + this.NoTests().ToString() + " &nbsp;&nbsp;" + @"<div style=""background:#ac2925; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;position:relative;";
            }

            tableHeadings.Cells.Add(headingCell);

            table.Rows.Add(tableHeadings);

            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();
            tableHeadings.BgColor = "#FFFFFF";
            headingCell.InnerHtml = @"<span style=""color:#666""><b>Total Time: </b></span>" + this.GetTotalTime(timeStop, timeStart);
            headingCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;";
            tableHeadings.Cells.Add(headingCell);
            table.Rows.Add(tableHeadings);

            if (CustomConfiguration.RecordVideo)
            {
                tableHeadings = new HtmlTableRow();
                headingCell = new HtmlTableCell();
                tableHeadings.BgColor = "#FFFFFF";
                headingCell.InnerHtml = @"<span style=""color:#666""><b>Full Test Run: </b></span><a href =""TestReportVideo.mp4"">Video</a> (To View Video Right-Click Save As)";
                headingCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:10pt;padding:5px 5px 5px 5px;";
                tableHeadings.Cells.Add(headingCell);
                table.Rows.Add(tableHeadings);
            }

            tableHeadings = new HtmlTableRow();
            headingCell = new HtmlTableCell();
            tableHeadings.BgColor = "#FFFFFF";
            headingCell.InnerHtml = "<br>";
            headingCell.Attributes.CssStyle.Value = "border-bottom: None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:3pt;padding:5px 5px 5px 5px;color:#FFFFFF;";
            tableHeadings.Cells.Add(headingCell);
            table.Rows.Add(tableHeadings);

            StringBuilder stringBuilder = new StringBuilder();
            table.RenderControl(new HtmlTextWriter(new StringWriter(stringBuilder)));

            StringBuilder stats = new StringBuilder();

            stats = stringBuilder;

            return stats;
        }
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            ContentPicker_Options renderingOptions;

            //test for postback, decide to use db or saveBox for rendering
            if (Page.IsPostBack)
            {
                //test for saveBox having a value, default if not
                if (saveBox.Text != "")
                {
                    renderingOptions = jsonSerializer.Deserialize<ContentPicker_Options>(saveBox.Text);
                }
                else
                {
                    renderingOptions = new ContentPicker_Options();
                }
            }
            else
            {
                renderingOptions = savedOptions;
            }

            //Log.Add(LogTypes.Debug, 0, "snid=>"+renderingOptions.startNodeID.ToString());
            //Log.Add(LogTypes.Debug, 0, "dtid=>" + renderingOptions.allowedDocTypeIDs);

            HtmlTable table = new HtmlTable();

            HtmlTableRow tr;
            HtmlTableCell td;

            //start node
            tr = new HtmlTableRow();
            table.Controls.Add(tr);

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            td.InnerText = "Start Node ID";

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            TextBox startNode = new TextBox();
            startNode.CssClass = "startNodeID";
            td.Controls.Add(startNode);
            startNode.Text = renderingOptions.startNodeID.ToString();

            //allow multiple
            tr = new HtmlTableRow();
            table.Controls.Add(tr);

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            td.InnerText = "Allow Multiple?";

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            CheckBox allowMultiple = new CheckBox();
            allowMultiple.CssClass = "allowMultiple";
            td.Controls.Add(allowMultiple);
            allowMultiple.Checked = renderingOptions.allowMultiple;

            //allowed doctypeids
            tr = new HtmlTableRow();
            table.Controls.Add(tr);

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            td.InnerText = "Allowed Doc Type ID's (CSV)";

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            TextBox allowedDocTypes = new TextBox();
            allowedDocTypes.CssClass = "allowedDocTypes";
            td.Controls.Add(allowedDocTypes);
            allowedDocTypes.Text = renderingOptions.allowedDocTypeIDs;

            //show all docTypes?
            tr = new HtmlTableRow();
            table.Controls.Add(tr);

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            td.InnerText = "Show All Doc Types?";

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            CheckBox showAllDocTypes = new CheckBox();
            showAllDocTypes.CssClass = "showAllDocTypes";
            td.Controls.Add(showAllDocTypes);
            showAllDocTypes.Checked = renderingOptions.showAllDocTypes;

            //js path
            tr = new HtmlTableRow();
            table.Controls.Add(tr);

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            td.InnerText = "JS Path";

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            TextBox jsPath = new TextBox();
            jsPath.CssClass = "jsPath";
            td.Controls.Add(jsPath);
            jsPath.Text = renderingOptions.jsPath;

            //css path
            tr = new HtmlTableRow();
            table.Controls.Add(tr);

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            td.InnerText = "CSS Path";

            td = new HtmlTableCell();
            tr.Controls.Add(td);
            TextBox cssPath = new TextBox();
            cssPath.CssClass = "cssPath";
            td.Controls.Add(cssPath);
            cssPath.Text = renderingOptions.cssPath;

            table.RenderControl(writer);
        }
示例#11
0
        /// <summary>
        /// Gets the items wrapped in a table
        /// </summary>
        /// <param name="nb">The Navbar in which rendering is taking place</param>
        /// <param name="items">The items to render into the group</param>
        /// <returns></returns>
        private string GetChildrenAsTable(NavBar nb, NavBarItems items)
        {
            System.Web.UI.HtmlControls.HtmlTable tbl = new System.Web.UI.HtmlControls.HtmlTable();
            tbl.Border      = 0;
            tbl.CellPadding = 2;
            tbl.CellSpacing = 0;
            tbl.Width       = "100%";

            foreach (NavBarItem itm in items)
            {
                HtmlTableRow tr = new HtmlTableRow();

                string style = string.Empty;
                if (itm.ItemStyle == null || itm.ItemStyle.Base == null)
                {
                    if (nb.DefaultItemStyle == null || nb.DefaultItemStyle.Base == null)
                    {
                        style = string.Empty;
                    }
                    else
                    {
                        style = nb.DefaultItemStyle.Base;
                    }
                }
                else
                {
                    style = itm.ItemStyle.Base;
                }

                string hoverstyle = string.Empty;
                if (itm.ItemStyle == null || itm.ItemStyle.Hover == null)
                {
                    if (nb.DefaultItemStyle == null || nb.DefaultItemStyle.Hover == null)
                    {
                        hoverstyle = string.Empty;
                    }
                    else
                    {
                        hoverstyle = nb.DefaultItemStyle.Hover;
                    }
                }
                else
                {
                    hoverstyle = itm.ItemStyle.Hover;
                }

                tr.Attributes.Add("class", style);
                tr.Style.Add("width", "100%");

                HtmlTableCell td = new HtmlTableCell();
                td.Style.Add("width", "100%");
                td.Attributes.Add("class", style);
                td.Attributes.Add("onmouseover", string.Format("nbItemHighlight(this,'{0}')", hoverstyle));
                td.Attributes.Add("onmouseout", string.Format("nbItemLowlight(this,'{0}')", style));

                HtmlAnchor a = new HtmlAnchor();

                a.HRef = itm.NavigateUrl;
                StringBuilder inner = new StringBuilder();

                if (itm.Image != null && itm.Image.Length > 0)
                {
                    inner.AppendFormat("<img src='{0}'/><br>", itm.Image);
                }

                inner.Append(itm.Text);
                a.InnerHtml = inner.ToString();

                td.Controls.Add(a);

                tr.Cells.Add(td);
                tbl.Rows.Add(tr);
            }

            StringBuilder  sb  = new StringBuilder();
            TextWriter     tw  = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(tw);

            tbl.RenderControl(htw);

            return(sb.ToString());
        }
示例#12
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            StringBuilder sb = new StringBuilder();

            System.Reflection.Assembly thisExe;
            thisExe = System.Reflection.Assembly.GetExecutingAssembly();
            string [] resources = thisExe.GetManifestResourceNames();

            for (int i = 0; i < resources.Length; i++)
            {
                if (resources[i].EndsWith("navbar.js"))
                {
                    TextReader sr = new StreamReader(thisExe.GetManifestResourceStream(resources[i]), System.Text.Encoding.UTF8);
                    output.Write(sr.ReadToEnd());
                }
            }

            if (_classnavbar != null && _classnavbar != string.Empty)
            {
                base.Attributes.Add("class", _classnavbar);
            }

            base.AddAttributesToRender(output);

            base.RenderBeginTag(output);

            bool expando = false;

            foreach (NavBarBlock bl in this.Blocks)
            {
                if (bl.Expanded)
                {
                    expando = true;
                    break;
                }
            }

            if (!expando && this.Blocks.Count > 0)
            {
                this.Blocks[0].Expanded = true;
            }

            expando = false;
            int blockid = 0;

            foreach (NavBarBlock bl in this.Blocks)
            {
                bool allowed = !_useroles;

                foreach (NavBarItem itm in bl.Items)
                {
                    if (!this.DesignMode)
                    {
                        if (itm.Roles == null || itm.Roles.Equals(string.Empty))
                        {
                            allowed = !_useroles;
                        }
                        else if (itm.Roles != null)
                        {
                            switch (itm.Roles)
                            {
                            case "*":
                                allowed = true;
                                break;

                            case "?":
                                allowed = this.Page.User.Identity.IsAuthenticated;
                                break;

                            default:
                                string[] roles = Convert.ToString(itm.Roles).Split(',');

                                for (int i = 0; i < roles.Length; i++)
                                {
                                    if (this.Page.User.IsInRole(roles[i]))
                                    {
                                        allowed = true;
                                        break;
                                    }
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        allowed = true;
                    }
                }

                if (bl.Items.Count > 0 && allowed)
                {
                    HttpCookie cookie       = this.Parent.Page.Request.Cookies["Expanded"];
                    string     prevexpanded = string.Empty;
                    string     blockname    = string.Format("nbBlock_{0}", (++blockid).ToString());

                    if (cookie != null)
                    {
                        prevexpanded = cookie.Value;
                    }

                    cookie = this.Parent.Page.Request.Cookies["Selected"];
                    string selected = string.Empty;

                    if (cookie != null)
                    {
                        selected = cookie.Value;
                    }

                    output.WriteBeginTag("div");
                    output.Write(" class='block'");
                    output.Write(string.Format(" id='{0}' ", blockname));
                    output.Write(">");

                    string expanded  = string.Empty;
                    string collapsed = string.Empty;

                    if (prevexpanded != string.Empty)
                    {
                        if (prevexpanded == blockname)
                        {
                            bl.Expanded = true;
                        }
                        else
                        {
                            bl.Expanded = false;
                        }
                    }

                    if (bl.BlockStyle == null || bl.BlockStyle.Closed == null)
                    {
                        if (!(this.DefaultBlockStyle == null || this.DefaultBlockStyle.Closed == null))
                        {
                            collapsed = this.DefaultBlockStyle.Closed;
                        }
                    }
                    else
                    {
                        collapsed = this.DefaultBlockStyle.Closed;
                    }

                    if (bl.BlockStyle == null || bl.BlockStyle.Expanded == null)
                    {
                        if (!(this.DefaultBlockStyle == null || this.DefaultBlockStyle.Expanded == null))
                        {
                            expanded = this.DefaultBlockStyle.Expanded;
                        }
                    }
                    else
                    {
                        expanded = this.DefaultBlockStyle.Expanded;
                    }

                    //output.WriteAttribute("expanded", "false");

                    //Block Header
                    if (!bl.Expanded)
                    {
                        output.WriteBeginTag("div");
                        output.WriteAttribute("class", collapsed);
                        output.WriteAttribute("expanded", "false");
                    }
                    else
                    {
                        output.WriteBeginTag("div");
                        output.WriteAttribute("class", expanded);
                        output.WriteAttribute("expanded", "true");
                    }

                    output.WriteAttribute("onclick", string.Format("nbToggleBlock(this, '{0}', '{1}')", collapsed, expanded));
                    output.Write(">");
                    if (bl.Image != null && bl.Image.ToString() != "")
                    {
                        output.Write("<img src='" + bl.Image + "'/>&nbsp;");
                    }

                    output.Write(bl.Text);
                    output.WriteEndTag("div");
                    //End Block Header

                    //Item Area
                    output.WriteBeginTag("div");
                    if (bl.BlockStyle == null || bl.BlockStyle.ItemArea == null)
                    {
                        if (this.DefaultBlockStyle == null || this.DefaultBlockStyle.ItemArea == null)
                        {
                            output.Write(" class=''");
                        }
                        else
                        {
                            output.WriteAttribute("class", this.DefaultBlockStyle.ItemArea);
                        }
                    }
                    else
                    {
                        output.WriteAttribute("class", bl.BlockStyle.ItemArea);
                    }

                    if (!bl.Expanded)
                    {
                        output.WriteAttribute("style", "display:none;overflow-x:hidden; overflow-y: auto");
                    }
                    else
                    {
                        output.WriteAttribute("style", "display:block;overflow-x:hidden; overflow-y: auto");
                    }

                    output.Write(">");

                    System.Web.UI.HtmlControls.HtmlTable tbl = GetChildrenAsTable(bl.Items, blockname, selected);

                    tbl.RenderControl(output);

                    output.WriteEndTag("div");
                    //End Item Area
                    output.WriteEndTag("div");
                }
            }

            base.RenderEndTag(output);
        }
        public override void GenerateReport()
        {
            TeamSiteFile tf = new TeamSiteFile();
            string fileName = System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSubsiteReportLocation"];
            StreamWriter fwriter = File.CreateText( fileName );
            Console.WriteLine("Creating file "+System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSubsiteReportLocation"]);
            HtmlTextWriter txtWriter=new HtmlTextWriter(fwriter);

            HtmlTable reportHtmlTable = new HtmlTable();
            reportHtmlTable.BgColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.White);
            reportHtmlTable.Border = 1;
            reportHtmlTable.BorderColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.LightGray );
            reportHtmlTable.Style.Add("font-family", "Verdana");

            reportHtmlTable.Style.Add("font-size", "9pt");

            HtmlTableRow trMessage = new HtmlTableRow();

            HtmlTableCell tcMessage = new HtmlTableCell();
            tcMessage.ColSpan = 10;
            tcMessage.InnerText = @"Last run: " + System.DateTime.Now.ToString();
            tcMessage.Style.Add("font-style","italic");
            trMessage.Cells.Add(tcMessage);
            reportHtmlTable.Rows.Add(trMessage);

            HtmlTableRow trHeader = new HtmlTableRow();
            trHeader.Style.Add("font-weight","bold");

            //teamsite name
            HtmlTableCell tcHeader1 = new HtmlTableCell();
            tcHeader1.InnerText = "teamsite name";
            trHeader.Cells.Add(tcHeader1);

            //teamsite url
            HtmlTableCell tcHeader2 = new HtmlTableCell();
            tcHeader2.InnerText = "teamsite url";
            trHeader.Cells.Add(tcHeader2);

            //teamsite brand
            HtmlTableCell tcHeader3 = new HtmlTableCell();
            tcHeader3.InnerText = "brand";
            trHeader.Cells.Add(tcHeader3);

            //teamsite subsite name
            HtmlTableCell tcHeader4 = new HtmlTableCell();
            tcHeader4.InnerText = "subsite name";
            trHeader.Cells.Add(tcHeader4);

            //teamsite subsite url
            HtmlTableCell tcHeader5 = new HtmlTableCell();
            tcHeader5.InnerText = "subsite url";
            trHeader.Cells.Add(tcHeader5);

            reportHtmlTable.Rows.Add(trHeader);

            SPSite siteCollection = new SPSite(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteUrl"]);
            SPWebCollection sites = siteCollection.AllWebs;

            try
            {
                foreach (SPWeb site in sites)
                {
                    try
                    {
                        //ignore top level brand sites
                        switch (site.Name)
                        {
                            case "":
                                break;
                            case "doh":
                                break;
                            case "Re":
                                break;
                            case "Mi":
                                break;
                            default:
                                SPWebCollection subsites = site.Webs;
                                //if there are subsites log them
                                if(subsites.Count > 0)
                                {
                                    foreach (SPWeb subsite in subsites)
                                    {
                                        try
                                        {
                                            Console.WriteLine("Site:"+site.Name);
                                            Console.WriteLine("\tSubsite:"+subsite.Name);
                                            HtmlTableRow trData = new HtmlTableRow();

                                            //teamsite name
                                            HtmlTableCell tcData1 = new HtmlTableCell();
                                            tcData1.InnerText = site.Name;
                                            trData.Cells.Add(tcData1);

                                            //teamsite url
                                            HtmlTableCell tcData2 = new HtmlTableCell();
                                            HtmlAnchor ha1 = new HtmlAnchor();
                                            ha1.InnerText=site.Url;
                                            ha1.HRef=site.Url;
                                            tcData2.Controls.Add(ha1);
                                            trData.Cells.Add(tcData2);

                                            //teamsite brand
                                            HtmlTableCell tcData3 = new HtmlTableCell();
                                            string brand = site.Url.ToString();
                                            try
                                            {
                                                string[] ary = brand.Split('/');
                                                tcData3.InnerText = ary[3].ToString(); // e.g. http:///blahblah fourth index will contain the brand
                                            }
                                            catch  //the url may not contain the brand for instance the top level site
                                            {
                                                tcData3 .InnerText = "na";
                                            }
                                            trData.Cells.Add(tcData3);

                                            //subsite name
                                            HtmlTableCell tcData4 = new HtmlTableCell();
                                            tcData4.InnerText = subsite.Name;
                                            trData.Cells.Add(tcData4);

                                            //subsite url
                                            HtmlTableCell tcData5 = new HtmlTableCell();
                                            HtmlAnchor ha2 = new HtmlAnchor();
                                            ha2.InnerText=subsite.Url;
                                            ha2.HRef=subsite.Url;
                                            tcData5.Controls.Add(ha2);
                                            trData.Cells.Add(tcData5);

                                            reportHtmlTable.Rows.Add(trData);

                                        }
                                        catch(Exception ex)
                                        {
                                            FileErrorLogger _logger = new FileErrorLogger();
                                            _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                                                ErrorType.TypeApplication, "TeamSiteReports.UploadFile()");
                                            _logger = null;
                                        }
                                        finally
                                        {
                                            subsite.Dispose();
                                        }
                                    }

                                }
                                break;
                        }//switch
                    }//try
                    catch(Exception ex)
                    {
                        FileErrorLogger _logger = new FileErrorLogger();
                        _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                            ErrorType.TypeApplication, "TeamSiteReports.UploadFile()");
                        _logger = null;
                    }
                    finally
                    {
                        site.Dispose();
                    }
                }//foreach
            }//try
            catch(Exception ex)
            {
                FileErrorLogger _logger = new FileErrorLogger();
                _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                    ErrorType.TypeApplication, "TeamSiteReports.UploadFile()");
                _logger = null;
            }
            finally
            {

                siteCollection.Dispose();
            }

            reportHtmlTable.RenderControl(txtWriter);

            txtWriter.Close();
            tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSubsiteReportLocation"],
                System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSubsiteReportDestination"]);
        }
        public override void GenerateReport()
        {
            TeamSiteFile tf = new TeamSiteFile();
            string fileName = System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersReportLocation"];
            string roleStyle;

            StreamWriter fwriter = File.CreateText( fileName );
            Console.WriteLine("Creating file "+System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersReportLocation"]);

            HtmlTextWriter txtWriter=new HtmlTextWriter(fwriter);

            HtmlTable reportHtmlTable = new HtmlTable();
            reportHtmlTable.BgColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.White);
            reportHtmlTable.Border = 1;
            reportHtmlTable.BorderColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.LightGray );
            reportHtmlTable.Style.Add("font-family", "Verdana");
            reportHtmlTable.Style.Add("font-size", "9pt");

            HtmlTableRow trMessage = new HtmlTableRow();

            HtmlTableCell tcMessage = new HtmlTableCell();
            tcMessage.ColSpan = 10;
            tcMessage.InnerText = @"Last run: " + System.DateTime.Now.ToString();
            tcMessage.Style.Add("font-style","italic");

            HtmlTableRow trHeader = new HtmlTableRow();
            trHeader.Style.Add("font-weight","bold");

            //teamsite name
            HtmlTableCell tcHeader1 = new HtmlTableCell();
            tcHeader1.InnerText = "teamsite name";
            trHeader.Cells.Add(tcHeader1);

            //teamsite url
            HtmlTableCell tcHeader2 = new HtmlTableCell();
            tcHeader2.InnerText = "teamsite url";
            trHeader.Cells.Add(tcHeader2);

            //teamsite brand
            HtmlTableCell tcHeader3 = new HtmlTableCell();
            tcHeader3.InnerText = "brand";
            trHeader.Cells.Add(tcHeader3);

            //teamsite users fullname
            HtmlTableCell tcHeader4 = new HtmlTableCell();
            tcHeader4.InnerText = "teamsite owners";
            trHeader.Cells.Add(tcHeader4);

            //lanId
            HtmlTableCell tcHeader5 = new HtmlTableCell();
            tcHeader5.InnerText = "lanId" ;
            trHeader.Cells.Add(tcHeader5);

            //email address
            HtmlTableCell tcHeader6 = new HtmlTableCell();
            tcHeader6.InnerText = "email" ;
            trHeader.Cells.Add(tcHeader6);

            //teamsite request for access email address
            HtmlTableCell tcHeader8 = new HtmlTableCell();
            tcHeader8.InnerText = "request for access email";
            trHeader.Cells.Add(tcHeader8);

            //teamsite memebership count
            HtmlTableCell tcHeader9 = new HtmlTableCell();
            tcHeader9.InnerText = "TeamSite Membership";
            trHeader.Cells.Add(tcHeader9);

            //subsites
            HtmlTableCell tcHeader10 = new HtmlTableCell();
            tcHeader10.InnerText = "Subsites";
            trHeader.Cells.Add(tcHeader10);

            reportHtmlTable.Rows.Add(trHeader);

            Console.WriteLine("Connecting to site...");
            SPSite siteCollection = new SPSite(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteUrl"]);
            SPWebCollection sites = siteCollection.AllWebs;

            try
            {
                foreach (SPWeb site in sites)
                {
                    try
                    {
                        SPWebCollection subSites = site.Webs;
                        int subsitesCount = subSites.Count;
                        int roleCount = 0;
                        SPUserCollection users = site.Users;

                        Console.WriteLine("Site: "+site.Name);
                        foreach(SPUser user in users)
                        {
                            SPRoleCollection roles = user.Roles;

                            //we need to count the roles here we count the number of teamsite owners..
                            foreach(SPRole role in roles)
                            {
                                if (role.Name == System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.roleExclusiveInclude"].ToString())
                                {
                                    roleCount ++;
                                }
                            }

                        } //user
                        if (roleCount > Convert.ToInt16(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersCount"]) )
                        {
                            //set the style to flag this on the cell
                            roleStyle = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.Orange);
                        }
                        else
                        {
                            roleStyle = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.White);
                        }

                        foreach(SPUser user in users)
                        {
                            SPRoleCollection roles = user.Roles;
                            Console.WriteLine("\tUser: "******"TeamSiteReports.roleExclusiveInclude"].ToString())
                                {
                                    string sRole = role.Name.ToString();

                                    SPListCollection lists =  site.Lists;
                                    HtmlTableRow trData = new HtmlTableRow();

                                    //teamsite name
                                    HtmlTableCell tcData1 = new HtmlTableCell();
                                    tcData1.InnerText = site.Name;
                                    trData.Cells.Add(tcData1);

                                    //teamsite url
                                    HtmlTableCell tcData2 = new HtmlTableCell();
                                    HtmlAnchor ha1 = new HtmlAnchor();
                                    ha1.InnerText=site.Url;
                                    ha1.HRef=site.Url;
                                    tcData2.Controls.Add(ha1);
                                    trData.Cells.Add(tcData2);

                                    //teamsite brand
                                    HtmlTableCell tcData3 = new HtmlTableCell();
                                    string brand = site.Url.ToString();
                                    try
                                    {
                                        string[] ary = brand.Split('/');
                                        tcData3.InnerText = ary[3].ToString(); // e.g. http://ts/one fourth index will contain the brand
                                    }
                                    catch  //the url may not contain the brand for instance the top level site
                                    {
                                        tcData3 .InnerText = "na";
                                    }
                                    trData.Cells.Add(tcData3);

                                    //teamsite users fullname
                                    HtmlTableCell tcData4 = new HtmlTableCell();
                                    tcData4.InnerText = user.Name;
                                    tcData4.BgColor = roleStyle;
                                    trData.Cells.Add(tcData4);

                                    //teamsite user lanId
                                    HtmlTableCell tcData5 = new HtmlTableCell();
                                    tcData5.InnerText = user.LoginName;
                                    tcData5.BgColor = roleStyle;
                                    trData.Cells.Add(tcData5);

                                    //teamsite user email address
                                    HtmlTableCell tcData6 = new HtmlTableCell();
                                    HtmlAnchor haEmail = new HtmlAnchor();
                                    haEmail.InnerText="mailto:"+user.Email;
                                    haEmail.HRef=user.Email;
                                    tcData6.Controls.Add(haEmail);
                                    tcData6.InnerText = user.Email ;  //email
                                    trData.Cells.Add(tcData6);

                                    //teamsite request for access email address
                                    HtmlTableCell tcData8 = new HtmlTableCell();
                                    try
                                    {

                                        SPPermissionCollection permsSite = site.Permissions;

                                        if (permsSite.RequestAccess)
                                        {
                                            tcData8.InnerText = permsSite.RequestAccessEmail.ToString();
                                        }
                                        else
                                        {
                                            tcData8.InnerText = "";
                                        }
                                    }
                                    catch //
                                    {
                                        tcData8.BgColor = "#FF0000";
                                        tcData8.InnerText = "permissions error";
                                    }

                                    trData.Cells.Add(tcData8);

                                    //teamsite memebrship count
                                    HtmlTableCell tcData9 = new HtmlTableCell();
                                    tcData9.InnerText = site.Users.Count.ToString();
                                    trData.Cells.Add(tcData9);

                                    //subsites

                                    HtmlTableCell tcData10 = new HtmlTableCell();
                                    tcData10.InnerText = subsitesCount.ToString();
                                    if (subsitesCount>0)
                                        tcData10.BgColor = System.Drawing.ColorTranslator.ToHtml (System.Drawing.Color.Red);
                                    trData.Cells.Add(tcData10);

                                    reportHtmlTable.Rows.Add(trData);

                                }
                            }
                            site.Dispose();
                        }
                    }
                    catch(Exception ex)
                    {
                        FileErrorLogger _logger = new FileErrorLogger();
                        _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                            ErrorType.TypeApplication, "Centrica.Intranet.TeamSiteReports.UploadFile()");
                        _logger = null;					}
                    finally
                    {
                        site.Dispose();
                    }

                }
            }
            catch (Exception ex)
            {
                FileErrorLogger _logger = new FileErrorLogger();
                _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                    ErrorType.TypeApplication, "Centrica.Intranet.TeamSiteReports.UploadFile()");
                _logger = null;
            }
            finally
            {
                siteCollection.Dispose();
            }

            reportHtmlTable.RenderControl(txtWriter);

            txtWriter.Close();
            tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersReportLocation"],
                System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteOwnersReportDestination"]);
            Console.WriteLine("Completed");
        }
示例#15
0
        public ActionResult SendEmails()
        {
            Context ctx = new Context();
            var users = (from u in ctx.UserProfiles
                         where u.UserName != "admin"
                         select u).ToList();

            MailMessage mailMsg = new MailMessage();
            StringBuilder builder = new StringBuilder();
            List<string> adresses = new List<string>();
            foreach (var user in users)
            {
                mailMsg.To.Add(new MailAddress(user.emailAddress, user.userCompleteName));
            }

            foreach (var user in users)
            {
                builder.Append("<h2>"+ user.userCompleteName + "</h2><br>");
                HtmlTable table = new HtmlTable();
                var predictions = (from p in ctx.Predictions
                                   from m in ctx.Matches
                           where p.UserId == user.UserId &&
                           p.matchPredictionModify != null &&
                           p.matchId == m.matchId &&
                           m.matchDate.Year == Util.LocalDate.Now.Year &&
                           m.matchDate.Month == Util.LocalDate.Now.Month &&
                           m.matchDate.Day == Util.LocalDate.Now.Day
                           select p).ToList();
                HtmlTableRow row = new HtmlTableRow();
                GenerateColumns(row);
                table.Rows.Add(row);

                foreach (var prediction in predictions)
                {
                    row = new HtmlTableRow();
                    HtmlTableCell cell = new HtmlTableCell();
                    cell.InnerText = prediction.predictionId.ToString();
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = prediction.matchId.ToString();
                    row.Cells.Add(cell);

                    var matchInfo = (from m in ctx.Matches
                                     where m.matchId == prediction.matchId
                                     select m).SingleOrDefault();

                    cell = new HtmlTableCell();
                    cell.InnerText = matchInfo.stadiumName;
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = matchInfo.matchDate.ToString("dd/MM/yyyy");
                    row.Cells.Add(cell);

                    var local = (from mt in ctx.MatchesTeam
                                 from t in ctx.Teams
                                 where mt.matchId == matchInfo.matchId
                                 && mt.teamId == t.teamId
                                 && mt.teamIsLocal == true
                                 select t).SingleOrDefault();

                    cell = new HtmlTableCell();
                    cell.InnerText = local.teamName;
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = prediction.homeResult.ToString();
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = prediction.homePenaltyResult.ToString();
                    row.Cells.Add(cell);

                    var visitor = (from mt in ctx.MatchesTeam
                                 from t in ctx.Teams
                                 where mt.matchId == matchInfo.matchId
                                 && mt.teamId == t.teamId
                                 && mt.teamIsLocal == false
                                 select t).SingleOrDefault();

                    cell = new HtmlTableCell();
                    cell.InnerText = visitor.teamName;
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = prediction.awayResult.ToString();
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = prediction.awayPenaltyResult.ToString();
                    row.Cells.Add(cell);

                    cell = new HtmlTableCell();
                    cell.InnerText = prediction.matchPredictionModify.ToString();
                    row.Cells.Add(cell);

                    table.Rows.Add(row);
                }
                StringBuilder sb = new StringBuilder();
                StringWriter tw = new StringWriter(sb);
                HtmlTextWriter hw = new HtmlTextWriter(tw);
                table.RenderControl(hw);

                builder.Append(sb.ToString());
                builder.Append("<br>");
            }

            mailMsg.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(builder.ToString(), null, MediaTypeNames.Text.Html));
            mailMsg.IsBodyHtml = true;
            mailMsg.From = new MailAddress("*****@*****.**");
            //mailMsg.To.Add(new MailAddress(user.emailAddress));
            mailMsg.Subject = "Predicciones hechas por los usuarios para el Mundial 2014";

            SmtpClient smtpClient = null;
            smtpClient = new SmtpClient();
            //smtpClient.Send(new MailMessage("*****@*****.**", user.emailAddress, "Predicciones hechas por los usuarios para el Mundial 2014", string.Empty));
            smtpClient.Send(mailMsg);

            return RedirectToAction("Index", "Home");
        }
示例#16
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            HtmlTable table = new HtmlTable();
            table.Border = 0;
            table.CellPadding = 0;
            table.CellSpacing = 1;
            table.Width = "100%";
            table.ID = ClientID;

            for (int nQuarter = 0; nQuarter < 4; nQuarter++)
            {
                HtmlTableRow tr = new HtmlTableRow();
                table.Rows.Add(tr);
                for (int nQMonth = 1; nQMonth <= 3; nQMonth++)
                {
                    HtmlTableCell td = new HtmlTableCell();
                    tr.Cells.Add(td);
                    td.VAlign = "top";
                    td.Align = "center";
                    td.Attributes.Add("class", "control-calendar-body-month");

                    DateTime dtCurrentMonth = new DateTime(WatchYear, 3 * nQuarter + nQMonth, 1);

                    Label lblMonth = new Label();
                    td.Controls.Add(lblMonth);
                    lblMonth.CssClass = "control-calendar-label";
                    lblMonth.Text = dtCurrentMonth.ToString("MMMM");

                    Calendar cal = new Calendar();
                    cal.ID = ClientID;
                    td.Controls.Add(cal);
                    cal.ToolTip = lblMonth.Text;
                    cal.FirstDayOfWeek = FirstDayOfWeek.Monday;
                    cal.VisibleDate = new DateTime(WatchYear, 3 * nQuarter + nQMonth, 1);
                    cal.Width = new Unit(100, UnitType.Percentage);
                    cal.CssClass = "control-calendar-month-box";
                    cal.ShowGridLines = true;
                    cal.ShowTitle = false;
                    cal.ShowNextPrevMonth = false;
                    cal.SelectionMode = CalendarSelectionMode.None;
                    cal.DayHeaderStyle.CssClass = "control-calendar-month-body-day-header";
                    cal.DayStyle.CssClass = "control-calendar-month-body-weekday";
                    cal.WeekendDayStyle.CssClass = "control-calendar-month-body-weekend";
                    cal.OtherMonthDayStyle.CssClass = "control-calendar-month-body-weekday";
                    cal.OtherMonthDayStyle.ForeColor = System.Drawing.Color.FromArgb(0xfa, 0xfa, 0xfa);//"#fafafa";
                    cal.DayRender += new DayRenderEventHandler(YearCalendar_RenderDay);
                }
            }

            table.RenderControl(writer);
        }
        public override void GenerateReport()
        {
            TeamSiteFile tf = new TeamSiteFile();
            string fileName = System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSizeReportLocation"];

            StreamWriter fwriter = File.CreateText( fileName );
            Console.WriteLine("Creating file "+System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSizeReportLocation"]);

            HtmlTextWriter txtWriter=new HtmlTextWriter(fwriter);

            HtmlTable reportHtmlTable = new HtmlTable();
            reportHtmlTable.BgColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.White);
            reportHtmlTable.Border = 1;
            reportHtmlTable.BorderColor = System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color.LightGray );
            reportHtmlTable.Style.Add("font-family", "Verdana");
            reportHtmlTable.Style.Add("font-size", "9pt");

            HtmlTableRow trMessage = new HtmlTableRow();
            HtmlTableCell tcMessage = new HtmlTableCell();
            tcMessage.ColSpan = 10;
            tcMessage.InnerText = @"Last run: " + System.DateTime.Now.ToString();
            tcMessage.Style.Add("font-style","italic");
            trMessage.Cells.Add(tcMessage);
            reportHtmlTable.Rows.Add(trMessage);

            HtmlTableRow trHeader = new HtmlTableRow();
            trHeader.Style.Add("font-weight","bold");

            //teamsite name
            HtmlTableCell tcHeader1 = new HtmlTableCell();
            tcHeader1.InnerText = "teamsite name";
            trHeader.Cells.Add(tcHeader1);

            //teamsite url
            HtmlTableCell tcHeader2 = new HtmlTableCell();
            tcHeader2.InnerText = "teamsite url";
            trHeader.Cells.Add(tcHeader2);

            //teamsite # docs
            HtmlTableCell tcHeader3 = new HtmlTableCell();
            tcHeader3.InnerText = "#docs";
            trHeader.Cells.Add(tcHeader3);

            //teamsite size Mbytes
            HtmlTableCell tcHeader4 = new HtmlTableCell();
            tcHeader4.InnerText = "filesize (MB)";
            trHeader.Cells.Add(tcHeader4);
            reportHtmlTable.Rows.Add(trHeader);

            Console.WriteLine("Connecting to site...");
            SPSite siteCollection = new SPSite(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteUrl"]);
            SPWebCollection sites = siteCollection.AllWebs;

            try
            {
                foreach (SPWeb site in sites)
                {
                    try
                    {

                        totalFileSize = 0;
                        fileCount = 0;

                        SPFolderCollection folders = site.Folders;
                        traverseFolders(folders);

                        Console.WriteLine( "Summary: " + SPEncode.HtmlEncode(site.Name) + " Number: " + fileCount +
                            " Size: " + totalFileSize);

                        HtmlTableRow trData = new HtmlTableRow();

                        //teamsite name
                        HtmlTableCell tcData1 = new HtmlTableCell();
                        tcData1.InnerText = site.Name;
                        trData.Cells.Add(tcData1);

                        //teamsite url
                        HtmlTableCell tcData2 = new HtmlTableCell();
                        HtmlAnchor ha1 = new HtmlAnchor();
                        ha1.InnerText=site.Url;
                        ha1.HRef=site.Url;
                        tcData2.Controls.Add(ha1);
                        trData.Cells.Add(tcData2);

                        //teamsite # docs
                        HtmlTableCell tcData3 = new HtmlTableCell();
                        tcData3 .InnerText = fileCount.ToString();
                        trData.Cells.Add(tcData3);

                        //teamsite size Mbytes
                        HtmlTableCell tcData4 = new HtmlTableCell();
                        totalFileSize = totalFileSize / 1000000;
                        tcData4.InnerText = totalFileSize.ToString();
                        //tcData4.BgColor = roleStyle;
                        trData.Cells.Add(tcData4);

                        reportHtmlTable.Rows.Add(trData);

                    }
                    catch(Exception ex)
                    {
                        FileErrorLogger _logger = new FileErrorLogger();
                        _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                            ErrorType.TypeApplication, "Intranet.TeamSiteReports.UploadFile()");
                        _logger = null;
                    }
                    finally
                    {
                        site.Dispose();
                    }
                }

            }
            catch (Exception ex)
            {
                FileErrorLogger _logger = new FileErrorLogger();
                _logger.LogError(ex.Message, ErrorLogSeverity.SeverityError,
                    ErrorType.TypeApplication, "Intranet.TeamSiteReports.UploadFile()");
                _logger = null;
            }
            finally
            {
                siteCollection.Dispose();
            }

            reportHtmlTable.RenderControl(txtWriter);

            txtWriter.Close();
            tf.UploadFile(System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSizeReportLocation"],
                System.Configuration.ConfigurationSettings.AppSettings["TeamSiteReports.TeamSiteSizeReportDestination"]);
        }
        /// <summary>
        /// Prints the results.
        /// </summary>
        /// <returns></returns>
        private string PrintResults()
        {
            HtmlTable table = new HtmlTable();
            table.EnableTheming = true;
            table.Border = 1;
            table.BorderColor = "#000000";
            table.Width = "100%";
            table.CellSpacing = 0;

            foreach (var featureName in ListResults.GroupBy(item => item.FeatureName))
            {
                HtmlTableRow tableName = new HtmlTableRow();
                HtmlTableCell tableNameCell = new HtmlTableCell("th");
                tableNameCell.ColSpan = 4;
                tableName.BorderColor = "#FFFFFF";
                tableNameCell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:13pt;color:#FFFFFF;";
                tableNameCell.BgColor = "#808080";
                tableNameCell.Align = "left";
                tableNameCell.InnerText = "Feature Name: " + featureName.Key;
                tableName.BgColor = "#808080";

                tableName.Cells.Add(tableNameCell);
                table.Rows.Add(tableName);

                foreach (var testScenario in featureName.GroupBy(item => item.ScenarioName))
                {
                    HtmlTableRow appheaderRow = new HtmlTableRow();
                    HtmlTableCell header = new HtmlTableCell("th");
                    header.ColSpan = 2;
                    appheaderRow.BgColor = "#808080";
                    appheaderRow.BorderColor = "#FFFFFF";
                    header.BgColor = "#808080";
                    header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:1px solid;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
                    header.Align = "Left";
                    header.InnerText = "Test Scenario: " + testScenario.Key;
                    appheaderRow.Cells.Add(header);

                    header = new HtmlTableCell("th");
                    header.ColSpan = 1;
                    appheaderRow.BgColor = "#808080";
                    appheaderRow.BorderColor = "#FFFFFF";
                    header.BgColor = "#808080";
                    header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:1px solid;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
                    header.Align = "Left";
                    header.InnerText = "Test Duration";
                    appheaderRow.Cells.Add(header);

                    header = new HtmlTableCell("th");
                    header.ColSpan = 2;
                    appheaderRow.BgColor = "#808080";
                    appheaderRow.BorderColor = "#FFFFFF";
                    header.BgColor = "#808080";
                    header.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:1px solid;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
                    header.Align = "Left";
                    header.InnerText = "Status";
                    appheaderRow.Cells.Add(header);
                    table.Rows.Add(appheaderRow);
                    HtmlTableRow tableHeadings = new HtmlTableRow();

                    appheaderRow.Cells.Add(header);
                    table.Rows.Add(appheaderRow);
                    int x = 1;
                    foreach (var testParameters in testScenario.GroupBy(item => item.TestParameters))
                    {
                        HtmlTableRow testparamets = new HtmlTableRow();
                        testparamets.ID = this.testParameterRowCount.ToString();
                        testparamets.Attributes.Add("onclick", "rowsHideShow(this);");
                        HtmlTableCell testparametersName = new HtmlTableCell();
                        testparametersName.ColSpan = 2;

                        testparametersName.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px; cursor: pointer;";
                        if (x % 2 == 0)
                        {
                            testparamets.BgColor = "#FFFFFF";
                        }
                        else
                        {
                            testparamets.BgColor = "#F0F0F0";
                        }

                        testparametersName.Align = "Left";
                        testparametersName.InnerText = "Test Run:" + x++;
                        testparamets.Cells.Add(testparametersName);

                        foreach (TestResult result in testParameters)
                        {
                            HtmlTableCell cell;
                            cell = new HtmlTableCell();
                            cell.ColSpan = 1;
                            cell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:10pt;padding:5px 5px 5px 5px;";
                            cell.Align = "Left";
                            cell.InnerText = this.GetTotalTimeResult(result.StartTime, result.EndTime);
                            testparamets.Cells.Add(cell);

                            if (x % 2 == 0)
                            {
                                testparamets.BgColor = "#FFFFFF";
                            }
                            else
                            {
                                testparamets.BgColor = "#F0F0F0";
                            }

                            cell = new HtmlTableCell();
                            cell.ColSpan = 1;
                            if (result.TestStatus == Enums.TestStatus.Failed)
                            {
                                if (result.ErrorMessage.Equals("Failed to execute tests due to insufficient GACS access."))
                                {
                                    cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;";
                                    cell.InnerText = result.ErrorMessage;
                                }
                                else
                                {
                                    cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana;font-size:9pt;font-weight:bold;color:#FFFFFF;vertical-align:middle;position:relative;";
                                    cell.InnerHtml = "<a href =" + result.ImagePath + "> " + result.ErrorMessage + "</a> &nbsp;" + @"<div style=""background:#ac2925; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                                }
                            }
                            else if (result.TestStatus == Enums.TestStatus.Completed)
                            {
                                cell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-weight:bold;color:#FFFFFF;font-family:Verdana;font-size:9pt; vertical-align:middle;position:relative;";
                                cell.InnerHtml = "<a href =" + testParameters.First().ImagePath.ToString() + "> " + result.TestStatus.ToString() + "</a> &nbsp;" + @"<div style=""background:#397439; width: 20px; height:20px; border-radius:50%;display:inline-block;position:absolute;bottom:10%""></div>";
                            }

                            testparamets.Cells.Add(cell);

                            table.Rows.Add(testparamets);
                            this.testParameterRowCount++;
                            if (result.CurrentData != null)
                            {
                                HtmlTableRow testDataRow = new HtmlTableRow();
                                testDataRow.ID = this.testParameterRowCount.ToString();
                                testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");

                                HtmlTableCell testDataCell = new HtmlTableCell();
                                testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
                                testDataCell.ColSpan = 4;
                                testDataCell.Width = "100%";

                                HtmlTable testDataTable = new HtmlTable();
                                testDataTable.Width = "100%";
                                testDataTable.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";

                                foreach (TestAutomationTemplate.Core.TestResult.TestData td in result.CurrentData)
                                {
                                    HtmlTableRow testDataTableRow = new HtmlTableRow();
                                    testDataTableRow.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;";
                                    if (x % 2 == 0)
                                    {
                                        testDataTable.BgColor = "#FFFFFF";
                                    }
                                    else
                                    {
                                        testDataTable.BgColor = "#F0F0F0";
                                    }

                                    HtmlTableCell testDataTableCell = new HtmlTableCell();
                                    testDataTableCell.InnerHtml = "<li><b>" + td.Name + "</b>: " + td.Value + "</li>";
                                    testDataTableCell.ColSpan = 4;
                                    testDataTableCell.Width = "100%";
                                    testDataTableCell.Attributes.CssStyle.Value = "border-bottom:None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:8pt;padding:5px 5px 5px 5px;text-indent:50px;";
                                    testDataTableRow.Cells.Add(testDataTableCell);
                                    testDataTable.Rows.Add(testDataTableRow);
                                }

                                StringBuilder innerTable = new StringBuilder();
                                testDataTable.RenderControl(new HtmlTextWriter(new StringWriter(innerTable)));
                                testDataCell.InnerHtml = innerTable.ToString();
                                testDataRow.Cells.Add(testDataCell);
                                table.Rows.Add(testDataRow);
                                this.testParameterRowCount++;
                            }
                            else
                            {
                                HtmlTableRow testDataRow = new HtmlTableRow();
                                testDataRow.ID = this.testParameterRowCount.ToString();
                                testDataRow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                testDataRow.Style.Add(HtmlTextWriterStyle.Width, "100%");

                                HtmlTableCell testDataCell = new HtmlTableCell();
                                testDataCell.Attributes.CssStyle.Value = "border-bottom:None; border-right:None; border-top:None; border-left:None;font-family:Verdana; font-size:8pt;";
                                testDataCell.ColSpan = 4;
                                testDataCell.Width = "100%";
                                testDataCell.InnerHtml = "<b>Test Parameters not available</b>";
                                testDataRow.Cells.Add(testDataCell);
                                table.Rows.Add(testDataRow);
                                this.testParameterRowCount++;
                            }
                        }
                    }
                }
            }

            StringBuilder stringBuilder = new StringBuilder();
            table.RenderControl(new HtmlTextWriter(new StringWriter(stringBuilder)));
            this.emailBody = this._reportJavaScript.WriteHTMLHeaderInformation().ToString() + this.PrintOverallStats().ToString() + stringBuilder.ToString() + this._reportJavaScript.GenerateJavaScriptCode(this.testDataRowCount).ToString();
            string reportDirectory = CustomConfiguration.TempDirectory;
            File.WriteAllText(reportDirectory + "Results.html", this.emailBody);
            this.CopyImagestoReportFolder(reportDirectory);
            stringBuilder.Clear();
            table.Dispose();

            return this.emailBody.ToString();
        }
        /// <summary>
        /// Noes the results.
        /// </summary>
        /// <returns></returns>
        private string NoResults()
        {
            HtmlTable NoResultsTable = new HtmlTable();
            NoResultsTable.EnableTheming = true;
            NoResultsTable.Border = 1;
            NoResultsTable.BorderColor = "#000000";
            NoResultsTable.Width = "100%";
            NoResultsTable.CellSpacing = 0;

            HtmlTableRow NoResultsTableName = new HtmlTableRow();
            HtmlTableCell NoResultsTableNameCell = new HtmlTableCell("th");
            NoResultsTableNameCell.ColSpan = 4;
            NoResultsTableName.BorderColor = "#FFFFFF";
            NoResultsTableNameCell.Attributes.CssStyle.Value = "border-bottom: None;border-right:None;border-top:None;border-left:None; font-family:Verdana; font-size:9pt;color:#FFFFFF;";
            NoResultsTableNameCell.BgColor = "#808080";
            NoResultsTableNameCell.Align = "left";
            NoResultsTableNameCell.InnerText = "No test results available";
            NoResultsTableName.BgColor = "#808080";

            NoResultsTableName.Cells.Add(NoResultsTableNameCell);
            NoResultsTable.Rows.Add(NoResultsTableName);

            StringBuilder NoResultsStringBuilder = new StringBuilder();
            NoResultsTable.RenderControl(new HtmlTextWriter(new StringWriter(NoResultsStringBuilder)));
            this.emailBody = NoResultsStringBuilder.ToString();
            NoResultsStringBuilder.Clear();
            NoResultsTable.Dispose();

            return this.emailBody.ToString();
        }