Example #1
0
        private void AddAggeregateRow(List <string> distinctPersons, List <JiraDataModel> jiraList, HtmlGenericControl tableElement)
        {
            var rowAggeregates = new List <decimal>();

            var headerControl1 = new HtmlGenericControl("tr");

            headerControl1.Attributes["class"] = "row text-right";

            ResolvedJiraHtmlTable.AppendLine("<tr class='row text-right'>");

            var cell = new HtmlGenericControl("td");

            cell.Attributes["class"] = "col-sm-2";
            cell.InnerText           = "Total";
            headerControl1.Controls.Add(cell);

            ResolvedJiraHtmlTable.AppendLine("<td class='col-sm-2'>Total</td>");

            foreach (var person in distinctPersons)
            {
                decimal aggValue = 0;
                try
                {
                    var list = (from row in jiraList
                                where row.Assignee == person
                                select row).ToList();
                    aggValue = list.Count;
                }
                catch { }

                cell = new HtmlGenericControl("td");
                cell.Attributes["class"] = "col-sm-1";
                cell.InnerText           = aggValue.ToString("0.00");
                headerControl1.Controls.Add(cell);

                ResolvedJiraHtmlTable.AppendLine("<td class='col-sm-1'>" + aggValue.ToString("0.00") + "</td>");

                rowAggeregates.Add(aggValue);
            }

            cell = new HtmlGenericControl("td");
            cell.Attributes["class"] = "col-sm-1";
            cell.InnerText           = rowAggeregates.Sum().ToString("0.00");
            headerControl1.Controls.Add(cell);

            ResolvedJiraHtmlTable.AppendLine("<td class='col-sm-1'>" + rowAggeregates.Sum().ToString("0.00") + "</td>");
            ResolvedJiraHtmlTable.AppendLine("</tr");

            tableElement.Controls.Add(headerControl1);
        }
Example #2
0
        private void AddHeaderRow(List <string> distinctPersons, HtmlGenericControl tableElement)
        {
            var headerControl = new HtmlGenericControl("tr");

            headerControl.Attributes["class"] = "row text-center";

            ResolvedJiraHtmlTable.AppendLine("<tr class='row text-center'>");

            var cell = new HtmlGenericControl("th");

            cell.Attributes["class"] = "col-sm-2";
            cell.InnerText           = "";
            headerControl.Controls.Add(cell);

            ResolvedJiraHtmlTable.AppendLine("<th class='col-sm-2'></th>");

            cell = new HtmlGenericControl("th");
            cell.Attributes["class"]   = "col-sm-11 text-center";
            cell.Attributes["colspan"] = (distinctPersons.Count + 1).ToString();
            cell.InnerText             = "Asignees";
            headerControl.Controls.Add(cell);

            ResolvedJiraHtmlTable.AppendLine("<th class='col-sm-11 text-center' colspan='" + (distinctPersons.Count + 1).ToString() + "'>Asignees</th>");
            ResolvedJiraHtmlTable.AppendLine("</tr>");

            tableElement.Controls.Add(headerControl);

            var headerControl1 = new HtmlGenericControl("tr");

            headerControl1.Attributes["class"] = "row text-center";

            ResolvedJiraHtmlTable.AppendLine("<tr class='row text-center'>");

            cell = new HtmlGenericControl("th");
            cell.Attributes["class"] = "col-sm-2";
            cell.InnerText           = "Projects";
            headerControl1.Controls.Add(cell);

            ResolvedJiraHtmlTable.AppendLine("<th class='col-sm-2'>Projects</th>");

            foreach (var str in distinctPersons)
            {
                var userFullName = GetUserFullName(str);
                cell = new HtmlGenericControl("th");
                cell.Attributes["class"] = "col-sm-1";
                cell.InnerText           = userFullName;
                headerControl1.Controls.Add(cell);

                ResolvedJiraHtmlTable.AppendLine("<th class='col-sm-1'>" + userFullName + "</th>");
            }

            cell = new HtmlGenericControl("th");
            cell.Attributes["class"] = "col-sm-1";
            cell.InnerText           = "Total";
            headerControl1.Controls.Add(cell);

            ResolvedJiraHtmlTable.AppendLine("<th class='col-sm-1'>Total</th>");
            ResolvedJiraHtmlTable.AppendLine("<tr/>");

            tableElement.Controls.Add(headerControl1);
        }