private void button2_Click(object sender, EventArgs e) { { if (string.IsNullOrWhiteSpace(textBox1.Text) || string.IsNullOrWhiteSpace(textBox2.Text) || string.IsNullOrWhiteSpace(textBox4.Text) || string.IsNullOrWhiteSpace(textBox5.Text)) { MessageBox.Show("TextBoxes are Empty Please Check Again"); } else { dbDataContext vdb = new dbDataContext(); Bookinfo vb = new Bookinfo(); dbDataContext vdv = new dbDataContext(); vb.Name = textBox1.Text; vb.Author = textBox2.Text; vb.Edition = textBox3.Text; vb.Type = textBox4.Text; vdb.Bookinfos.InsertOnSubmit(vb); vdb.SubmitChanges(); File.Copy(temp, @"C:\Users\Assaduzzaman\Documents\Visual Studio 2015\Projects\VirtualLibrary\VirtualLibrary\PDFBOOK\" + textBox1.Text + ".pdf"); MessageBox.Show("Book is added successfully in the library. Thank you"); // this.Visible = false; // this.Visible = true; textBox1.Text = null; textBox2.Text = null; textBox3.Text = null; textBox4.Text = null; } } }
private void button1_Click(object sender, EventArgs e) { try { using (dbDataContext data = new dbDataContext()) { Bookinfo Book = data.Bookinfos.Single(Bookinfo => Bookinfo.Name == textBox1.Text); name = Book.Name; MessageBox.Show("This Book is Available In the Library "); textBox1.Text = null; } } catch { MessageBox.Show("This Book is not Available In the Library "); textBox1.Text = null; } }
partial void UpdateBookinfo(Bookinfo instance);
partial void DeleteBookinfo(Bookinfo instance);
partial void InsertBookinfo(Bookinfo instance);