private void button5_Click(object sender, EventArgs e) { if (balance != 0 && button5.Text == "Disapproved") { MessageBox.Show("Borrower has a balance of " + balance); return; } pincode_approval p = new pincode_approval(); pincode_approval.text = button5.Text; p.ShowDialog(); if (p.DialogResult == DialogResult.OK) { displayinfo(); displayattachment(); disabled(); balancep(); } /* * if (button5.Text == "Approved") * { * con.Open(); * string update = "update customerinfo set approved = 1 where No = '" + id + "'"; * cmd = new OdbcCommand(update, con); * cmd.ExecuteNonQuery(); * con.Close(); * activitylog(); * button5.Text = "Disapproved"; * } * else * { * con.Open(); * string update = "update customerinfo set approved = 0 where No = '" + id + "'"; * cmd = new OdbcCommand(update, con); * cmd.ExecuteNonQuery(); * con.Close(); * activitylog(); * button5.Text = "Approved"; * } * else * { * } * } */ }
private void button2_Click(object sender, EventArgs e) { if (textBox18.Enabled == false) { textBox2.Enabled = true; textBox18.Enabled = true; comboBox1.Enabled = false; checkBox1.Enabled = true; button7.Visible = true; button2.Text = "Save"; } else { con.Open(); DataTable dt3 = new DataTable(); string strAcct3 = "Select pminamount,gminamount from loanmaintenance"; da = new OdbcDataAdapter(strAcct3, con); da.Fill(dt3); con.Close(); if (Convert.ToDecimal(textBox18.Text) < Convert.ToDecimal(min) || Convert.ToDecimal(textBox18.Text) > Convert.ToDecimal(max)) { MessageBox.Show("Invalid Max Loan", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (comboBox1.SelectedIndex == 0) { con.Open(); DataTable dt2 = new DataTable(); string strAcct2 = "Select Comaker from customerinfo where No = '" + CreditInvistigator.id + "' "; da = new OdbcDataAdapter(strAcct2, con); da.Fill(dt2); con.Close(); if (dt2.Rows[0].ItemArray[0].ToString() == "0" && checkBox1.Checked == true) { MessageBox.Show("Please input comaker information", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (checkBox1.Checked == true && dataGridView1.Rows.Count == 0) { MessageBox.Show("Attachment is Empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (checkBox1.Checked == true && Convert.ToDouble(label11.Text) < 8000) { MessageBox.Show("Grand total is not enough", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToDecimal(dt3.Rows[0].ItemArray[0].ToString()) > Convert.ToDecimal(textBox18.Text) && comboBox1.SelectedIndex == 0 && checkBox1.Checked == true) { MessageBox.Show("Max amount is less than minimum amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToDecimal(dt3.Rows[0].ItemArray[1].ToString()) > Convert.ToDecimal(textBox18.Text) && comboBox1.SelectedIndex == 1 && checkBox1.Checked == true) { MessageBox.Show("Max amount is less than minimum amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } pincode_approval p = new pincode_approval(); p.ShowDialog(); if (p.DialogResult == DialogResult.OK) { updateability(); textBox2.Enabled = false; textBox18.Enabled = false; comboBox1.Enabled = true; checkBox1.Enabled = false; button7.Visible = false; maxloanactivitylog(); button2.Text = "Update"; } } }