private void button4_Click(object sender, EventArgs e)
 {
     li        = new library();
     li.serial = Convert.ToInt32(textBox1.Text);
     li.deleteBook();
     dataGridView1.DataSource = goFill().Tables[0];
 }
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         li = new library();
         string query = "update addingBooks SET titleBook = '" + textBox2.Text + "', authorBook = '" + textBox3.Text + "', quantity ='" + Convert.ToInt32(textBox4.Text) + "', placeLibrary='" + comboBox1.Text + "', conditionBook='" + comboBox2.Text + "' where serialNo= " + Convert.ToInt32(textBox1.Text);
         li.updateBook(query);
         dataGridView1.DataSource = goFill().Tables[0];
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
     }
     catch (FormatException)
     {
         MessageBox.Show("Insert All Values!!", "Alert!!");
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            dg.query = "SELECT serialNo,titleBook,authorBook,quantity,placeLibrary,conditionBook from addingBooks where quantity >" + 0;
            dataGridView1.DataSource = dg.goFill().Tables[0];
            sd = new showingData();
            li = new library();
            string queryForCount = "select count(studentID) from IssueBooks where studentID = " + comboBox1.Text;

            countingAdmissions = sd.countAdmission(queryForCount);

            numberOfQuantity = li.checkQuantity(Convert.ToInt32(comboBox2.Text));
            if (countingAdmissions >= limit)
            {
                MessageBox.Show("Return previous Books!!", "Alert");
            }
            else
            {
                if (numberOfQuantity > 0)
                {
                    string querya  = "Select bookID from IssueBooks where studentID =" + comboBox1.Text;
                    string checkID = li.alreadyExitsBook(querya);
                    if (comboBox2.Text != checkID)
                    {
                        string query = "insert into IssueBooks(studentID,studentName,takenBooks,maxAllowed,bookID,issueDate,lastDate)values('" + comboBox1.Text + "','" + textBox2.Text + "','" + Convert.ToInt32(textBox1.Text) + "','" + Convert.ToInt32(textBox3.Text) + "','" + comboBox2.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')";
                        li = new library();
                        li.updateBook(query);
                        li.minusQuantity(Convert.ToInt32(comboBox2.Text));

                        MessageBox.Show("Book has been issued Successfully!!!");
                        textBox1.Clear();
                        textBox2.Clear();
                    }
                    else
                    {
                        MessageBox.Show("This book is already Issued to you!!");
                    }
                }
                else
                {
                    MessageBox.Show("Book quantity is zero!!", "Alert");
                }
            }
        }
        private void issueBook_Load(object sender, EventArgs e)
        {
            // dataGridView1.DataSource = dg.goFill().Tables[0];
            radioLoad rad = new radioLoad();

            comboBox1.DataSource    = rad.mydt("select * from libraryMembershipForm");
            comboBox1.DisplayMember = "registrationNo";
            comboBox1.ValueMember   = "registrationNo";

            comboBox2.DataSource    = rad.mydt("select * from addingBooks");
            comboBox2.DisplayMember = "serialNo";
            comboBox2.ValueMember   = "serialNo";
            li = new library();


            textBox3.Text = limit.ToString();
            textBox4.Text = DateTime.Now.ToShortDateString();
            textBox5.Text = DateTime.Now.AddDays(15).ToShortDateString();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
         {
             MessageBox.Show("Enter all values", "Alert!!");
         }
         else
         {
             li = new library();
             string query = "INSERT into libraryMembershipForm(registrationNo,firstName,booksTaken,maxAllowed,feeStudent,paymentStudent) values('" + comboBox1.Text + "','" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + comboBox2.Text + "','" + textBox4.Text + "')";
             li.updateBook(query);
         }
     }
     catch (OleDbException)
     {
         MessageBox.Show("User already exits", "Alert!!");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         li              = new library();
         li.title        = textBox2.Text;
         li.authorName   = textBox3.Text;
         li.quantityBook = Convert.ToInt32(textBox4.Text);
         li.place        = comboBox1.Text;
         li.condition    = comboBox2.Text;
         li.insertBook();
         dataGridView1.DataSource = goFill().Tables[0];
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
     }
     catch (FormatException)
     {
         MessageBox.Show("Insert All Values!!", "Alert!!");
     }
 }
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            library li = new library();

            dataGridView1.DataSource = li.fillData(Convert.ToInt32(comboBox2.Text)).Tables[0];
        }