private void btnSearch_Click(object sender, EventArgs e) { Ebook temp = new Ebook(); DataSet ds = temp.SearchEBooks(txtTitle.Text, txtAuthorLast.Text); dgvResults.DataSource = ds; dgvResults.DataMember = ds.Tables["Ebooks_Temp"].ToString(); }
private void btnInsert_Click(object sender, EventArgs e) { Ebook temp = new Ebook(); temp.Title = txtTitle.Text; temp.AuthorFirst = txtAuthorFirst.Text; temp.AuthorLast = txtAuthorLast.Text; temp.Email = txtEmail.Text; temp.DatePublished = dtpDatePublished.Value; temp.DateRentalExpires = dtpDateRentalExpires.Value; int intTempPages; bool blnResult = Int32.TryParse(Console.ReadLine(), out intTempPages); if (blnResult == false) { lblFeedback.Text += "Sorry incorrect page #. Please try again. (Ex: 214) "; } else { temp.Pages = intTempPages; } int intBMPage; blnResult = Int32.TryParse(Console.ReadLine(), out intBMPage); if (blnResult == false) { lblFeedback.Text += "Sorry incorrect Bookmark page #. Please try again. (Ex: 214) "; } else { temp.BookmarkPage = intBMPage; } if (!temp.Feedback.Contains("ERROR:")) { lblFeedback.Text = temp.AddARecord(); } else { lblFeedback.Text = temp.Feedback; } }
public Form1(int intEBook_ID) { InitializeComponent(); Ebook temp = new Ebook(); SqlDataReader dr = temp.FindOneEBook(intEBook_ID); while (dr.Read()) { txtTitle.Text = dr["Title"].ToString(); txtAuthorFirst.Text = dr["AuthorFirst"].ToString(); txtAuthorLast.Text = dr["AuthorLast"].ToString(); txtEmail.Text = dr["Email"].ToString(); txtPages.Text = dr["Pages"].ToString(); txtBookmarkPage.Text = dr["BookmarkPage"].ToString(); lblEBook_ID.Text = dr["EBook_ID"].ToString(); dtpDatePublished.Value = DateTime.Parse(dr["DatePublished"].ToString()); dtpDateRentalExpires.Value = DateTime.Parse(dr["DateRentalExpires"].ToString()); lblEBook_ID.Text = dr["EBook_ID"].ToString(); } }