private void txt_enter_name_SelectedIndexChanged(object sender, EventArgs e) { UC_payments.studno = txt_enter_name.Text.Split('-').GetValue(0).ToString(); UC_payments u = new UC_payments(); metroPanel1.Controls.Clear(); con.Open(); SqlCommand cmd = new SqlCommand("EXECUTE stud_details_for_payments '" + txt_enter_name.Text.Split('-').GetValue(0).ToString() + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); u.txt_studno.Text = dr.GetValue(0).ToString(); u.txt_studname.Text = dr.GetValue(1).ToString(); u.txt_course_name.Text = General_methods.get_course_name_from_course_no(dr.GetValue(2).ToString()); u.txt_batch_no.Text = dr.GetValue(3).ToString(); u.txt_course_fee_for_full_payament.Text = u.txt_cfee.Text = u.txt_module_pay_course_fee.Text = dr.GetValue(4).ToString() + "/="; u.txt_nic.Text = dr.GetValue(5).ToString(); u.txt_batch_name.Text = General_methods.get_batch_name_from_batch_ne(dr.GetValue(3).ToString()); General_methods.get_stud_pic(u.pictureBox1, dr.GetValue(0).ToString()); u.txt_amount_payable.Text = General_methods.calc_amount_payable(txt_enter_name.Text.Split('-').GetValue(0).ToString().ToString(), 0, "Diploma").ToString() + "/="; u.txt_reg_fee_of_course.Text = dr.GetValue(6).ToString() + "/="; metroPanel1.Controls.Add(u); dr.Close(); con.Close(); u.label1.TextChanged += handler; }
public void handler2(object sender, EventArgs e) { UC_payements_certif.studno = txt_certif_enter_name.Text.Split('-').GetValue(0).ToString(); UC_payements_certif u = new UC_payements_certif(); metroPanel2.Controls.Clear(); con.Open(); SqlCommand cmd = new SqlCommand("EXECUTE stud_details_for_payments '" + txt_certif_enter_name.Text.Split('-').GetValue(0).ToString() + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); u.txt_studno.Text = dr.GetValue(0).ToString(); u.txt_studname.Text = dr.GetValue(1).ToString(); u.txt_course_name.Text = General_methods.get_course_name_from_course_no(dr.GetValue(2).ToString()); u.txt_batch_no.Text = dr.GetValue(3).ToString(); u.txt_reg_fee.Text = u.txt_cfee.Text = u.txt_course_fee.Text = dr.GetValue(4).ToString() + "/="; u.txt_nic.Text = dr.GetValue(5).ToString(); u.txt_batch_name.Text = General_methods.get_batch_name_from_batch_ne(dr.GetValue(3).ToString()); General_methods.get_stud_pic(u.pictureBox1, dr.GetValue(0).ToString()); u.txt_amount_payabme.Text = General_methods.calc_amount_payable(txt_certif_enter_name.Text.Split('-').GetValue(0).ToString().ToString(), 0, "Certificate").ToString() + "/="; u.txt_reg_fee.Text = dr.GetValue(6).ToString() + "/="; metroPanel2.Controls.Add(u); dr.Close(); con.Close(); u.label1.TextChanged += handler2; }
private void metroTile1_Click(object sender, EventArgs e) { if (txt_nic_already_exists.Text == "") { MessageBox.Show(this, "Please enter NIC to search", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if ((txt_nic_already_exists.Text.Length == 12 || txt_nic_already_exists.Text.Length == 10) == false) { MessageBox.Show(this, "Invalid NIC entered. Please enter valid NIC number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_nic_already_exists.Text.Length == 12 && txt_nic_already_exists.Text.Any(char.IsLetter) == true) { MessageBox.Show(this, "Invalid NIC entered. Please enter valid NIC number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_nic_already_exists.Text.Length == 10 && (txt_nic_already_exists.Text.Last() != 'V' || txt_nic_already_exists.Text.Last() != 'X' || txt_nic_already_exists.Text.Last() != 'v' || txt_nic_already_exists.Text.Last() != 'x')) { MessageBox.Show(this, "Invalid NIC entered. Please enter valid NIC number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (d3.singleInt("SELECT COUNT(*) FROM Stud_details WHERE NIC ='" + txt_nic_already_exists.Text + "'") == 0) { MessageBox.Show(this, "A student with this NIC is not recorded in the system", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { state = true; txt_org.DataSource = General_methods.fill_companys_combobx(); DialogResult d = MessageBox.Show(this, "Student with NIC " + txt_nic_already_exists.Text + " Found in system. Load Details of student?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { SqlConnection con2 = new SqlConnection(Credentials.connection); con2.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM Stud_details WHERE NIC='" + txt_nic_already_exists.Text + "'", con2); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); ref_stud_no = dr.GetValue(0).ToString(); txt_firstname.Text = dr.GetValue(1).ToString(); txt_middlename.Text = dr.GetValue(2).ToString(); txt_lname.Text = dr.GetValue(3).ToString(); if (dr.GetValue(4).ToString() == "male") { metroRadioButton6.Checked = true; } else { metroRadioButton5.Checked = true; } txt_nic.Text = dr.GetValue(5).ToString(); txt_org.Text = General_methods.find_organization_name_from_organization_no(dr.GetValue(6).ToString()); txt_desig.Text = dr.GetValue(7).ToString(); txt_Radd.Text = dr.GetValue(8).ToString(); txt_mobile.Text = dr.GetValue(9).ToString(); txt_residence_tel.Text = dr.GetValue(10).ToString(); txt_resi_email.Text = dr.GetValue(11).ToString(); metroDateTime1.Value = Convert.ToDateTime(dr.GetValue(14)); txt_contact_person_1_name.Text = dr.GetValue(15).ToString(); txt_contacts_person_1_no.Text = dr.GetValue(16).ToString(); txt_contact_person_2_name.Text = dr.GetValue(17).ToString(); txt_contact_person_2_no.Text = dr.GetValue(18).ToString(); txt_homeno.Text = dr.GetValue(22).ToString(); General_methods.get_stud_pic(pictureBox1, dr.GetValue(0).ToString()); foreach (Control c in groupBox5.Controls) { if (c is CheckBox && c.Text == dr.GetValue(19).ToString()) { CheckBox v = (CheckBox)c; v.Checked = true; } } dr.Close(); con2.Close(); } else { } } }
public void redraw_controls(string data) { invisible(); con.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM Stud_details WHERE stud_no='" + data + "' ", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dr.IsDBNull(23)) { txt_no.Text = dr.GetValue(0).ToString(); no = dr.GetValue(0).ToString(); txt_fname.Text = dr.GetValue(1).ToString() + " " + dr.GetValue(2).ToString() + " " + dr.GetValue(3).ToString(); txt_gender.Text = dr.GetValue(4).ToString(); txt_nic.Text = dr.GetValue(5).ToString(); txt_desig.Text = dr.GetValue(7).ToString(); txt_address.Text = dr.GetValue(22).ToString() + " " + d.singleString("SELECT Address_string FROM Place_Details WHERE place_id='" + dr.GetValue(8).ToString() + "'"); txt_resi_tel.Text = dr.GetValue(10).ToString(); txt_mobile.Text = dr.GetValue(9).ToString(); txt_resi_email.Text = dr.GetValue(11).ToString(); contact_p_1_name.Text = dr.GetValue(15).ToString(); contact_p_1_no.Text = dr.GetValue(16).ToString(); contact_p_2_name.Text = dr.GetValue(17).ToString(); contact_p_2_no.Text = dr.GetValue(18).ToString(); txt_batchno.Text = dr.GetValue(21).ToString(); txt_stud_name_with_initials.Text = dr.GetValue(24).ToString(); txt_batch_name.Text = General_methods.get_batch_name_from_batch_ne(dr.GetValue(21).ToString()); txt_course_code.Text = dr.GetValue(12).ToString(); txt_course_name.Text = General_methods.get_course_name_from_course_no(dr.GetValue(12).ToString()); txt_typ.Text = General_methods.get_course_type_from_course_no(dr.GetValue(12).ToString()); txt_medium.Text = dr.GetValue(13).ToString(); txt_bday.Text = Convert.ToDateTime(dr.GetValue(14).ToString()).ToLongDateString(); txt_age.Text = (DateTime.Today.Year - Convert.ToDateTime(txt_bday.Text).Year).ToString(); txt_org_name.Text = General_methods.find_organization_name_from_organization_no(dr.GetValue(6).ToString()); string[] a = General_methods.get_organization_details_from_org_name(txt_org_name.Text); txt_oaddress.Text = a[0]; txt_otel.Text = a[1]; txt_oemail.Text = a[2]; txt_fax.Text = a[3]; if (!dr.IsDBNull(20)) { General_methods.get_stud_pic(pictureBox1, dr.GetValue(0).ToString()); } visible(); con.Close(); dr.Close(); listBox1.Items.Clear(); if (General_methods.get_course_type_from_course_no(txt_course_code.Text) == "Diploma") { con.Open(); SqlCommand cmd3 = new SqlCommand("SELECT module_no FROM Dip_stud_modules WHERE stud_no='" + txt_no.Text + "'", con); SqlDataReader dr3 = cmd3.ExecuteReader(); while (dr3.Read()) { listBox1.Items.Add(General_methods.get_module_name_from_module_no(dr3.GetValue(0).ToString())); } dr3.Close(); con.Close(); } else { groupBox5.Visible = false; } } else { SqlConnection con2 = new SqlConnection(Credentials.connection); SqlCommand cmd2 = new SqlCommand("SELECT * FROM Stud_details WHERE stud_no='" + dr.GetValue(23).ToString() + "' ", con2); con2.Open(); SqlDataReader dr2 = cmd2.ExecuteReader(); dr2.Read(); txt_no.Text = dr2.GetValue(0).ToString(); no = dr2.GetValue(0).ToString(); txt_fname.Text = dr2.GetValue(1).ToString() + " " + dr2.GetValue(2).ToString() + " " + dr2.GetValue(3).ToString(); txt_gender.Text = dr2.GetValue(4).ToString(); txt_nic.Text = dr2.GetValue(5).ToString(); txt_desig.Text = dr2.GetValue(7).ToString(); txt_address.Text = dr2.GetValue(22).ToString() + " " + dr.GetValue(22).ToString() + " " + d.singleString("SELECT Address_string FROM Place_Details WHERE place_id='" + dr2.GetValue(8).ToString() + "'"); txt_resi_tel.Text = dr2.GetValue(10).ToString(); txt_mobile.Text = dr2.GetValue(9).ToString(); txt_resi_email.Text = dr2.GetValue(11).ToString(); contact_p_1_name.Text = dr2.GetValue(15).ToString(); contact_p_1_no.Text = dr2.GetValue(16).ToString(); contact_p_2_name.Text = dr2.GetValue(17).ToString(); contact_p_2_no.Text = dr2.GetValue(18).ToString(); txt_batchno.Text = dr.GetValue(21).ToString(); txt_stud_name_with_initials.Text = dr2.GetValue(24).ToString(); txt_batch_name.Text = General_methods.get_batch_name_from_batch_ne(dr.GetValue(21).ToString()); txt_course_code.Text = dr.GetValue(12).ToString(); txt_course_name.Text = General_methods.get_course_name_from_course_no(dr.GetValue(12).ToString()); txt_typ.Text = General_methods.get_course_type_from_course_no(dr.GetValue(12).ToString()); txt_medium.Text = dr.GetValue(13).ToString(); txt_org_name.Text = General_methods.find_organization_name_from_organization_no(dr2.GetValue(6).ToString()); string[] a = General_methods.get_organization_details_from_org_name(txt_org_name.Text); txt_oaddress.Text = a[0]; txt_otel.Text = a[1]; txt_oemail.Text = a[2]; txt_fax.Text = a[3]; visible(); con.Close(); con2.Close(); dr.Close(); dr2.Close(); listBox1.Items.Clear(); if (General_methods.get_course_type_from_course_no(txt_course_code.Text) == "Diploma") { con.Open(); SqlCommand cmd3 = new SqlCommand("SELECT module_no FROM Dip_stud_modules WHERE stud_no='" + txt_no.Text + "'", con); SqlDataReader dr3 = cmd3.ExecuteReader(); while (dr3.Read()) { listBox1.Items.Add(General_methods.get_module_name_from_module_no(dr3.GetValue(0).ToString())); } dr3.Close(); con.Close(); } else { groupBox5.Visible = false; } } }