Esempio n. 1
0
        protected void SummaryTab()
        {
            Worksheet sht = Workbook.Worksheets.AddNamed("Summary");

            sht.Cells.AddValueCell(1, 1, "Group No", _fmtHeaderCell);
            sht.Cells.AddValueCell(1, 2, "Group Name", _fmtHeaderCell);
            sht.Cells.AddValueCell(1, 3, "Category", _fmtHeaderCell);

            sht.Cells.AddValueCell(1, 4, "Total Points", _fmtHeaderCell);
            sht.Cells.AddValueCell(1, 5, "Total Time", _fmtHeaderCell);
            sht.Cells.AddValueCell(1, 6, "Time Disqualified", _fmtHeaderCell);
            sht.Cells.AddValueCell(1, 7, "Nett Points", _fmtHeaderCell);

            for (int r = 0; r < _dataSet.ReportGroup.Rows.Count; r++)
            {
                EmitScoreDataSet.ReportGroupRow g        = _dataSet.ReportGroup[r];
                EmitScoreDataSet.CategoryRow    category = _dataSet.Category.FindByCategoryId(g.CategoryId);

                sht.Cells.AddValueCell(r + 2, 1, g.GroupId, _fmtText);
                sht.Cells.AddValueCell(r + 2, 2, g.GroupName, _fmtText);
                sht.Cells.AddValueCell(r + 2, 3, category.CategoryName, _fmtText);

                EmitScoreDataSet.ReportGroupResultRow[] gr =
                    (EmitScoreDataSet.ReportGroupResultRow[])
                    _dataSet.ReportGroupResult.Select(String.Format("GroupId='{0}'", g.GroupId));

                if (!g.IsTotalPointsNull())
                {
                    sht.Cells.AddValueCell(r + 2, 4, g.TotalPoints, _fmtData);
                }

                if (!g.IsTotalTimeSecondsNull())
                {
                    DateTime totalTime = Swipe.CreateBaseDate();
                    totalTime = totalTime.AddSeconds(g.TotalTimeSeconds);
                    sht.Cells.AddValueCell(r + 2, 5, totalTime.ToString("HH:mm:ss"), _fmtTimestamp);
                }
                if (!g.IsTimeDisqualifiedNull())
                {
                    if (g.TimeDisqualified == 1)
                    {
                        sht.Cells.AddValueCell(r + 2, 6, "Yes", _fmtText);
                    }
                }
                if (!g.IsNettPointsNull())
                {
                    sht.Cells.AddValueCell(r + 2, 7, g.NettPoints, _fmtData);
                }
            }
        }
Esempio n. 2
0
        protected void SummaryTab()
        {
            EmitScoreDataSet.LocationRow[] lr =
                (EmitScoreDataSet.LocationRow[])_dataSet.Location.Select();
            int lastLocCol = lr.Length + 3;

            Worksheet sht = Workbook.Worksheets.AddNamed("Summary");

            sht.Cells.AddValueCell(2, 1, "Group No", _fmtHeaderCell);
            sht.Cells.AddValueCell(2, 2, "Group Name", _fmtHeaderCell);
            sht.Cells.AddValueCell(2, 3, "Category", _fmtHeaderCell);

            for (int c = 0; c < lr.Length; c++)
            {
                sht.Cells.AddValueCell(1, c + 4, lr[c].LocationId, _fmtHeaderCell);
                if (!lr[c].IsLocationNameNull())
                {
                    // Output the name if there is one
                    sht.Cells.AddValueCell(2, c + 4, lr[c].LocationName, _fmtHeaderCell);
                }
                else
                {
                    // Or simply the index otherwise
                    sht.Cells.AddValueCell(2, c + 4, c + 1, _fmtHeaderCell);
                }
            }

            sht.Cells.AddValueCell(2, lastLocCol + 1, "Total Points", _fmtHeaderCell);
            sht.Cells.AddValueCell(2, lastLocCol + 2, "Nett Points", _fmtHeaderCell);
            sht.Cells.AddValueCell(2, lastLocCol + 3, "Total Time", _fmtHeaderCell);
            sht.Cells.AddValueCell(2, lastLocCol + 4, "Time Disqualified", _fmtHeaderCell);

            for (int r = 0; r < _dataSet.ReportGroup.Rows.Count; r++)
            {
                EmitScoreDataSet.ReportGroupRow g        = _dataSet.ReportGroup[r];
                EmitScoreDataSet.CategoryRow    category = _dataSet.Category.FindByCategoryId(g.CategoryId);

                sht.Cells.AddValueCell(r + 3, 1, g.GroupId, _fmtText);
                sht.Cells.AddValueCell(r + 3, 2, g.GroupName, _fmtText);
                sht.Cells.AddValueCell(r + 3, 3, category.CategoryName, _fmtText);

                EmitScoreDataSet.ReportGroupResultRow[] gr =
                    (EmitScoreDataSet.ReportGroupResultRow[])
                    _dataSet.ReportGroupResult.Select(String.Format("GroupId='{0}'", g.GroupId));

                // Now export the points for each Location
                for (int c = 0; c < lr.Length; c++)
                {
                    for (int p = 0; p < gr.Length; p++)
                    {
                        if (gr[p].LocationId == lr[c].LocationId)
                        {
                            // Found the Location
                            sht.Cells.AddValueCell(r + 3, c + 4, gr[p].Points, _fmtData);
                        }
                    }
                }

                if (!g.IsTotalPointsNull())
                {
                    sht.Cells.AddValueCell(r + 3, lastLocCol + 1, g.TotalPoints, _fmtData);
                }
                if (!g.IsNettPointsNull())
                {
                    sht.Cells.AddValueCell(r + 3, lastLocCol + 2, g.NettPoints, _fmtData);
                }
                if (!g.IsTotalTimeSecondsNull())
                {
                    DateTime totalTime = Swipe.CreateBaseDate();
                    totalTime = totalTime.AddSeconds(g.TotalTimeSeconds);
                    sht.Cells.AddValueCell(r + 3, lastLocCol + 3, totalTime.ToString("HH:mm:ss"), _fmtTimestamp);
                }
                if (!g.IsTimeDisqualifiedNull())
                {
                    if (g.TimeDisqualified == 1)
                    {
                        sht.Cells.AddValueCell(r + 3, lastLocCol + 4, "Yes", _fmtText);
                    }
                }
            }
        }