Exemple #1
0
        private TableCell BenchmarkRatio(double comparisonTime, double currentTime, bool isBaseline)
        {
            TableColor color = TableColor.Default;

            if (currentTime != 0.0)
            {
                double calibratedComparison = (isBaseline ? comparisonTime * _baselineAdjustment : comparisonTime);
                double ratio = calibratedComparison / currentTime;

                if (ratio > (1 / _failThreshold))
                {
                    color = TableColor.Green;
                }
                else if (ratio < _failThreshold)
                {
                    color = TableColor.Red;
                }
            }

            return(TableCell.Ratio(comparisonTime, currentTime, color));
        }
Exemple #2
0
 public static TableCell Ratio(double current, double baseline, TableColor color = TableColor.Default)
 {
     return(new TableCell(Format.Ratio(current, baseline), Align.Right, color));
 }
Exemple #3
0
        public static MvcHtmlString MakeTable(this HtmlHelper helper, string tableId, string tableName, string[] colNames, IEnumerable <object> model, TableColor color = TableColor.Black, TableBorder border = TableBorder.None, bool tableFadeInDown = true, bool tableRowsBounceIn = true)
        {
            if (!ShowChanged)
            {
                ShowHeader = true;
                ShowFooter = true;
                Searcher   = true;
                Button     = true;
                RowCount   = true;
            }

            if (!PrimaryDataChanged)
            {
                CurrentPage      = 1;
                CountItemsInPage = 10;
                MaxPageInline    = 5;
            }

            if (!IconsSet)
            {
                Excel      = "../Content/MyTable/Images/excel.ico";
                Reload     = "../Content/MyTable/Images/SoftwareUpdate.png";
                Pdf        = "../Content/MyTable/Images/pdf.ico";
                Printer    = "../Content/MyTable/Images/Imprimante2.png";
                Search     = "../Content/MyTable/Images/Search.png";
                HeaderIcon = "../Content/MyTable/Images/Information.png";
            }

            TableId = tableId;

            var str = string.Empty;

            str += MakeHiddenInputs(model.Count() + 2);

            var returnToDic = ReturnToDic(model, colNames);

            var firstItem = returnToDic.ElementAt(0);

            var tablefadeInDown = string.Empty;

            if (tableFadeInDown)
            {
                tablefadeInDown = "table-fadeInDown";
            }

            var tablerowsbounceIn = string.Empty;

            if (tableRowsBounceIn)
            {
                tablerowsbounceIn = "table-rows-bounceIn";
            }

            str += $"<table id='{tableId}' class='new-table {color.ToString().ToLower()}-table {border.ToString().ToLower()}-bordered {tablefadeInDown} {tablerowsbounceIn}'>";

            if (ShowHeader)
            {
                str += MakeHeader(firstItem.Count, tableName);
            }

            str += "<tbody><tr>";

            foreach (var item in firstItem)
            {
                str += $"<td>{item.Key}</td>";
            }

            foreach (var item in returnToDic)
            {
                str += "<tr>";
                foreach (var itemVal in item)
                {
                    str += $"<td>{itemVal.Value}</td>";
                }

                str += "</tr>";
            }


            str += "</tbody>";

            if (ShowFooter)
            {
                str += MakeFooter(firstItem.Count, colNames);
            }

            str += "</table>";

            return(MvcHtmlString.Create(str));
        }
Exemple #4
0
 public TableCell(string text, Align align = Align.Default, TableColor color = TableColor.Default)
 {
     Text  = text ?? "<null>";
     Align = align;
     Color = color;
 }