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 newAdmissionBox_Load(object sender, EventArgs e) { showingData sd = new showingData(); string query = "select count(registrationNo) from studentDetails"; string queryforMales = "select count(gender_std) from studentDetails where gender_std ='Male'"; string queryFemales = "select count(gender_std) from studentDetails where gender_std ='Female'"; string firstYear = "select count(year_std) from studentDetails where year_std ='1st Year'"; string secondYear = "select count(year_std) from studentDetails where year_std ='2nd Year'"; int countingAdmissions = sd.countAdmission(query); int countingMales = sd.countAdmission(queryforMales); int countingFirstYear = sd.countAdmission(firstYear); int countingSecondYear = sd.countAdmission(secondYear); int countFemales = sd.countAdmission(queryFemales); label2.Text = countingAdmissions.ToString(); label3.Text = countingMales.ToString(); label7.Text = countingFirstYear.ToString(); label9.Text = countingSecondYear.ToString(); label5.Text = countFemales.ToString(); }
private void masterAdmin_Load(object sender, EventArgs e) { showingData sd = new showingData(); string countBook = "select count(serialNo) from addingBooks"; string countEmployees = "select count(Id) from employeeBoxData"; string countStudents = "select count(registrationNo) from studentDetails"; int countingBooks = sd.countAdmission(countBook); int countingEmployees = sd.countAdmission(countEmployees); int countingStudents = sd.countAdmission(countStudents); if (countingBooks != 0 || countingEmployees != 0 || countingStudents != 0) { label6.Text = countingBooks.ToString(); label4.Text = countingEmployees.ToString(); label2.Text = countingStudents.ToString(); } else { MessageBox.Show("No records entered yet!!", "Alert"); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { sd = new showingData(); connection cn = new connection(); OleDbConnection con = cn.Connect(); con.Open(); string query = "select firstName from libraryMembershipForm where registrationNo = " + comboBox1.Text; string queryForCount = "select count(studentID) from IssueBooks where studentID = " + comboBox1.Text; countingAdmissions = sd.countAdmission(queryForCount); textBox1.Text = countingAdmissions.ToString(); OleDbCommand cmd = new OleDbCommand(query, con); OleDbDataReader read = cmd.ExecuteReader(); if (read.Read()) { textBox2.Text = read[0].ToString(); } con.Close(); }