public static void LoadBook(SqlDataReader reader)
        {
            
            while (reader.Read())
            {
                Books book = new Books();

                book.BookID = (int)reader["BookID"];
                book.Title = reader["Title"].ToString();
                book.WriterID = (int)reader["WriterID"];
                book.PublicherID = (int)reader["PublicherID"];

                books.Add(book);
            }
        }
Beispiel #2
0
        public Form3(Books bk)
        {
            bks = bk;
            type = 1;
            InitializeComponent();
            for (int i = 0; i < 4; i++)
            {
                Label lb = new Label();
                lb.Location = new System.Drawing.Point(5, i * 20 + i * 2 + 5);
                lb.AutoSize = true;
                switch (i)
                {
                    case 0: lb.Text = "BookID :"; break;
                    case 1: lb.Text = "Title :"; break;
                    case 2: lb.Text = "WriterID :"; break;
                    case 3: lb.Text = "PublicherID :"; break;
                    default: break;
                }


                TextBox tB = new TextBox();
                tB.Location = new System.Drawing.Point(90, i * 20 + i * 2 + 5);
                tB.Size = new System.Drawing.Size(222, 20);
                //tB.ReadOnly = true;
                switch (i)
                {
                    case 0: tB.Text = bk.BookID.ToString(); tB.ReadOnly = true; break;
                    //tB.Text = BooksManager.Books[nums].BookID.ToString(); break;
                    case 1: tB.Text = bk.Title; break;
                    //tB.Text = BooksManager.Books[nums].Title.ToString(); break;
                    case 2: tB.Text = bk.WriterID.ToString(); tB.ReadOnly = true; break;
                    //tB.Text = BooksManager.Books[nums].WriterID.ToString(); break;
                    case 3: tB.Text = bk.PublicherID.ToString(); tB.ReadOnly = true; break;
                    //tB.Text = BooksManager.Books[nums].PublicherID.ToString(); break;
                    default: break;
                }

                this.Controls.Add(lb);
                this.Controls.Add(tB);
                //Console.WriteLine("{0}: {1}", reader.GetName(i), reader[i]);
            }
        }
Beispiel #3
0
 public Book(Books bk, string tl)
 {
     bookFromList = bk;
     title = tl;
 }