private void button1_Click(object sender, EventArgs e) { try { sd.month = comboBox1.Text; string queryPayments = "SELECT SUM(salary) FROM employeePayments WHERE salaryMonth ='" + comboBox1.Text + "'"; label14.Text = sd.readFees(queryPayments).ToString(); string countAdmUser = "******"; label2.Text = sd.countingDepartUsers(countAdmUser); string countFinanceUser = "******"; label5.Text = sd.countingDepartUsers(countFinanceUser); string countLibraryUser = "******"; label4.Text = sd.countingDepartUsers(countLibraryUser); string countHrUser = "******"; label3.Text = sd.countingDepartUsers(countHrUser); string countAdminUser = "******"; label6.Text = sd.countingDepartUsers(countAdminUser); } catch (InvalidCastException) { label14.Text = "0"; label2.Text = "0"; label5.Text = "0"; label4.Text = "0"; label3.Text = "0"; label6.Text = "0"; } }
private void button1_Click(object sender, EventArgs e) { sd.month = comboBox1.Text; if (sd.getFirstName() == true) { string queryPayments = "SELECT SUM(paymentAmount) FROM studentFees where monthName='" + comboBox1.Text + "' and studentYear = '1st Year'"; string queryDues = "SELECT SUM(dueAmount) FROM studentFees where monthName='" + comboBox1.Text + "' and studentYear = '1st Year'"; string queryBalance = "SELECT SUM(balanceAmount) FROM studentFees where monthName='" + comboBox1.Text + "' and studentYear = '1st Year'"; label2.Text = sd.readFees(queryPayments).ToString(); label3.Text = sd.readFees(queryDues).ToString(); label4.Text = sd.readFees(queryBalance).ToString(); } else { label2.Text = "0"; label3.Text = "0"; label4.Text = "0"; } // for second year if (sd.getSecondName() == true) { string queryPayments2nd = "SELECT SUM(paymentAmount) FROM studentFees where monthName='" + comboBox1.Text + "' and studentYear = '2nd Year'"; string queryDues2nd = "SELECT SUM(dueAmount) FROM studentFees where monthName='" + comboBox1.Text + "' and studentYear = '2nd Year'"; string queryBalance2nd = "SELECT SUM(balanceAmount) FROM studentFees where monthName='" + comboBox1.Text + "' and studentYear = '2nd Year'"; label9.Text = sd.readFees(queryPayments2nd).ToString(); label8.Text = sd.readFees(queryDues2nd).ToString(); label7.Text = sd.readFees(queryBalance2nd).ToString(); } else { label9.Text = "0"; label8.Text = "0"; label7.Text = "0"; } }