Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Web;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- namespace LB4_V2
- {
- public partial class WebForm1 : System.Web.UI.Page
- {
- /// <summary>
- /// Prints starting data to a Table in the WEB
- /// </summary>
- /// <param name="registerList"></param>
- public void PrintStartDataToTable(List<LibraryRegister> registerList)
- {
- for (int i = 0; i < registerList.Count; i++)
- {
- TableRow row = new TableRow();
- TableCell cell1 = new TableCell();
- TableCell cell2 = new TableCell();
- TableCell cell3 = new TableCell();
- cell1.Text = registerList[i].name;
- cell2.Text = registerList[i].address;
- cell3.Text = registerList[i].phoneNumber;
- row.Cells.Add(cell1);
- row.Cells.Add(cell2);
- row.Cells.Add(cell3);
- Table1.Rows.Add(row);
- for (int j = 0; j < registerList[i].Count(); j++)
- {
- row = new TableRow();
- TableCell cell4 = new TableCell();
- TableCell cell5 = new TableCell();
- TableCell cell6 = new TableCell();
- TableCell cell7 = new TableCell();
- TableCell cell8 = new TableCell();
- TableCell cell9 = new TableCell();
- cell4.Text = registerList[i].Get(j).name;
- cell5.Text = registerList[i].Get(j).type;
- cell6.Text = registerList[i].Get(j).publishingPlace;
- cell7.Text = registerList[i].Get(j).yearOfRelease.ToString();
- cell8.Text = registerList[i].Get(j).numberOfPages.ToString();
- cell9.Text = registerList[i].Get(j).edition.ToString();
- row.Cells.Add(cell4);
- row.Cells.Add(cell5);
- row.Cells.Add(cell6);
- row.Cells.Add(cell7);
- row.Cells.Add(cell8);
- row.Cells.Add(cell9);
- if (registerList[i].Get(j) is Book)
- {
- TableCell cell10 = new TableCell();
- TableCell cell11 = new TableCell();
- Book book = (Book)registerList[i].Get(j);
- cell10.Text = book.ISBN;
- cell11.Text = book.author;
- row.Cells.Add(cell10);
- row.Cells.Add(cell11);
- }
- else
- {
- if (registerList[i].Get(j) is Journal)
- {
- TableCell cell10 = new TableCell();
- TableCell cell11 = new TableCell();
- TableCell cell12 = new TableCell();
- Journal journal = (Journal)registerList[i].Get(j);
- cell10.Text = journal.ISBN;
- cell11.Text = journal.number.ToString();
- cell12.Text = journal.monthOfRelease.ToString();
- row.Cells.Add(cell10);
- row.Cells.Add(cell11);
- row.Cells.Add(cell12);
- }
- else
- {
- TableCell cell10 = new TableCell();
- TableCell cell11 = new TableCell();
- TableCell cell12 = new TableCell();
- Newspaper newspaper = (Newspaper)registerList[i].Get(j);
- cell10.Text = newspaper.date.ToString();
- cell11.Text = newspaper.number.ToString();
- cell12.Text = newspaper.MonthAndDayOfRelease;
- row.Cells.Add(cell10);
- row.Cells.Add(cell11);
- row.Cells.Add(cell12);
- }
- }
- Table1.Rows.Add(row);
- }
- }
- }
- /// <summary>
- /// Prints specified data to the Table
- /// </summary>
- /// <param name="register"></param>
- public void PrintI(List<LibraryRegister> register)
- {
- for (int i = 0; i < register.Count(); i++)
- {
- TableRow row = new TableRow();
- TableCell cell1 = new TableCell();
- cell1.Text = register[i].name;
- row.Cells.Add(cell1);
- Table2.Rows.Add(row);
- for (int j = 0; j < register[i].Count(); j++)
- {
- row = new TableRow();
- TableCell cell2 = new TableCell();
- TableCell cell3 = new TableCell();
- cell2.Text = register[i].Get(j).name;
- cell3.Text = register[i].Get(j).edition.ToString();
- row.Cells.Add(cell2);
- row.Cells.Add(cell3);
- Table2.Rows.Add(row);
- }
- }
- }
- /// <summary>
- /// Prints publication data to a table
- /// </summary>
- /// <param name="table"></param>
- /// <param name="publications"></param>
- public static void PrintToTable(Table table, LibraryRegister publications)
- {
- for (int i = 0; i < publications.Count(); i++)
- {
- TableRow row = new TableRow();
- TableCell cell4 = new TableCell();
- TableCell cell5 = new TableCell();
- TableCell cell6 = new TableCell();
- TableCell cell7 = new TableCell();
- TableCell cell8 = new TableCell();
- TableCell cell9 = new TableCell();
- cell4.Text = publications.Get(i).name;
- cell5.Text = publications.Get(i).type;
- cell6.Text = publications.Get(i).publishingPlace;
- cell7.Text = publications.Get(i).yearOfRelease.ToString();
- cell8.Text = publications.Get(i).numberOfPages.ToString();
- cell9.Text = publications.Get(i).edition.ToString();
- row.Cells.Add(cell4);
- row.Cells.Add(cell5);
- row.Cells.Add(cell6);
- row.Cells.Add(cell7);
- row.Cells.Add(cell8);
- row.Cells.Add(cell9);
- if (publications.Get(i) is Book)
- {
- TableCell cell10 = new TableCell();
- TableCell cell11 = new TableCell();
- Book book = (Book)publications.Get(i);
- cell10.Text = book.ISBN;
- cell11.Text = book.author;
- row.Cells.Add(cell10);
- row.Cells.Add(cell11);
- }
- else
- {
- if (publications.Get(i) is Journal)
- {
- TableCell cell10 = new TableCell();
- TableCell cell11 = new TableCell();
- TableCell cell12 = new TableCell();
- Journal journal = (Journal)publications.Get(i);
- cell10.Text = journal.ISBN;
- cell11.Text = journal.number.ToString();
- cell12.Text = journal.monthOfRelease.ToString();
- row.Cells.Add(cell10);
- row.Cells.Add(cell11);
- row.Cells.Add(cell12);
- }
- else
- {
- TableCell cell10 = new TableCell();
- TableCell cell11 = new TableCell();
- TableCell cell12 = new TableCell();
- Newspaper newspaper = (Newspaper)publications.Get(i);
- cell10.Text = newspaper.date.ToString();
- cell11.Text = newspaper.number.ToString();
- cell12.Text = newspaper.MonthAndDayOfRelease;
- row.Cells.Add(cell10);
- row.Cells.Add(cell11);
- row.Cells.Add(cell12);
- }
- }
- table.Rows.Add(row);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement