Esempio n. 1
0
        protected void draw_custom_table()
        {
            SQLFunctions conn = new SQLFunctions();
            TableRow     row;
            TableCell    cell;

            tableContent.Rows.Clear();

            resultsTally        rt  = evaluateTopBooks();
            List <resultsTally> lrt = new List <resultsTally>();


            row  = new TableRow();
            cell = new TableCell();

            if (rt.book_id > -1)
            {
                cell.Text = "With " + rt.numberVotes + " number one votes, the clear #1 is : " + rt.bookTitle;
                row.Cells.Add(cell);
            }
            else if (rt.book_id == -2)
            {
                lrt       = returnTiedTopBooks();
                cell.Text = "Tied with " + lrt[0].numberVotes + " number one votes, the two best books are : " + lrt[0].bookTitle + " and " + lrt[1].bookTitle;
                row.Cells.Add(cell);
            }
            else
            {
                cell.Text = "There no was no clear #1 pick for best book!";
                row.Cells.Add(cell);

                //cell = new TableCell();
                //List<resultsTally> lrt = evaluateTopBookPlurality();
                //cell.Text = "With " + lrt[0].numberVotes + " the plurality of people voted #1 as : " + lrt[0].bookTitle;
            }

            tableContent.Rows.Add(row);


            rt = new resultsTally();
            rt = evaluateBottomBooks();

            row  = new TableRow();
            cell = new TableCell();

            if (rt.book_id > -1)
            {
                cell.Text = "With " + rt.numberVotes + " number seven votes, the most disliked book is : " + rt.bookTitle;
                row.Cells.Add(cell);
            }
            else if (rt.book_id == -2)
            {
                lrt = new List <resultsTally>();
                //lrt = returnTiedBottomBooks();
                cell.Text = "Tied with " + lrt[0].numberVotes + " number seven votes, the two worst books are : " + lrt[0].bookTitle + " and " + lrt[1].bookTitle;
                row.Cells.Add(cell);
            }
            else
            {
                cell.Text = "There no was no clear #1 pick for worst book!";
                row.Cells.Add(cell);
            }

            tableContent.Rows.Add(row);

            int pages = conn.getTotalPagesRead(2018);

            if (pages > -1)
            {
                row       = new TableRow();
                cell      = new TableCell();
                cell.Text = "We have read " + pages + " number of pages in 2018";
                row.Cells.Add(cell);
                tableContent.Rows.Add(row);
            }

            bookModel highCount = conn.getHighPageCount();

            if (highCount.bookPageLength > -1)
            {
                row  = new TableRow();
                cell = new TableCell();

                cell.Text = "The high page count is " + highCount.bookTitle + " with " + highCount.bookPageLength + " pages.";
                row.Cells.Add(cell);
                tableContent.Rows.Add(row);
            }

            bookModel lowCount = conn.getLowPageCount();

            if (highCount.bookPageLength > -1)
            {
                row  = new TableRow();
                cell = new TableCell();

                cell.Text = "The low page count is " + lowCount.bookTitle + " with " + lowCount.bookPageLength + " pages.";
                row.Cells.Add(cell);
                tableContent.Rows.Add(row);
            }

            int pubdate = conn.getAvgBookPublishYear(2018);

            if (pubdate > -1)
            {
                row       = new TableRow();
                cell      = new TableCell();
                cell.Text = "The average first published year is " + pubdate;
                row.Cells.Add(cell);
                tableContent.Rows.Add(row);
            }
        }