private void btnAddParticular_Click_1(object sender, EventArgs e) { string particular = ""; string query = "Select AssessmentID, AssessmentName, ISNULL(Amount,0) from assessment WHERE AssessmentName = '"; if (cmbParticular.SelectedIndex > -1) { particular = cmbParticular.SelectedItem.ToString(); } else { particular = cmbParticular.Text; } try { if (!string.IsNullOrEmpty(particular)) { int count = new clsDB().Con().countRecord(query + particular + "'"); string[] column = { "No", "Particulars", "Amount" }; string[][] data = new string[count][]; string[] obj = new string[3]; bool hasAmount = false; // if has record in the database - get data for transfer if (count > 0) { if (new clsDB().Con().SelectData(query + particular + "'", obj)) { data[0] = obj; // check if the amount is zero and ask for input if (float.Parse(data[0][2]) >= 0 || data[0][1] == "Tuition Fee") { frmParticularAmountDataEntry f = new frmParticularAmountDataEntry(int.Parse(data[0][0])); // FLAG for TUITION FEE if (data[0][1] == "Tuition Fee") { f.isTuitionFee = true; isTuitionFee = true; } f.ShowDialog(); data[0][2] = Convert.ToString(f.amount); hasAmount = f.hasAmount; } else { hasAmount = true; } if (hasAmount && new clsDB().Con().listViewTransferData(data, lvDataEntryOP, column)) { float[] account = Payor.computeAccount(lvDataEntryOP); // Set TEMPORARY FIX for TUITION PAYMENT - G lbTotal.Text = Convert.ToString(account[0] + account[1]); tAmount.Text = Convert.ToString(account[0] + account[1]); /** * lbTotal.Text = Convert.ToString(account[1]); * tAmount.Text = Convert.ToString(account[1]); */ } } } else { pNewParticular.Visible = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAddParticular_Click_1(object sender, EventArgs e) { string particular = ""; string query = "Select AssessmentID, AssessmentName, ISNULL(Amount,0) from assessment WHERE AssessmentName = '"; if (cmbParticular.SelectedIndex > -1) particular = cmbParticular.SelectedItem.ToString(); else particular = cmbParticular.Text; try { if (!string.IsNullOrEmpty(particular)) { int count = new clsDB().Con().countRecord(query + particular + "'"); string[] column = { "No", "Particulars", "Amount"}; string[][] data = new string[count][]; string[] obj = new string[3]; bool hasAmount = false; // if has record in the database - get data for transfer if (count > 0) { if (new clsDB().Con().SelectData(query + particular + "'", obj)) { data[0] = obj; // check if the amount is zero and ask for input if (float.Parse(data[0][2]) == 0 || data[0][1] == "Tuition Fee") { frmParticularAmountDataEntry f = new frmParticularAmountDataEntry(int.Parse(data[0][0])); // FLAG for TUITION FEE if (data[0][1] == "Tuition Fee") { f.isTuitionFee = true; isTuitionFee = true; } f.ShowDialog(); data[0][2] = Convert.ToString(f.amount); hasAmount = f.hasAmount; } else hasAmount = true; if (hasAmount && new clsDB().Con().listViewTransferData(data, lvDataEntryOP, column)) { float[] account = Payor.computeAccount(lvDataEntryOP); // Set TEMPORARY FIX for TUITION PAYMENT - G lbTotal.Text = Convert.ToString(account[0] + account[1]); tAmount.Text = Convert.ToString(account[0] + account[1]); /** lbTotal.Text = Convert.ToString(account[1]); tAmount.Text = Convert.ToString(account[1]); */ } } } else { pNewParticular.Visible = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }