private void metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == 7 && e.RowIndex >= 0) { DialogResult dc = MessageBox.Show("Are you sure you want to terminate payment?", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dc == DialogResult.Yes) { if (metroGrid1.Rows[e.RowIndex].Cells[6].Value.ToString() == "Course fee for Certificate course") { d.delete("DELETE FROM PaymentDetails WHERE Payment_No='" + Convert.ToInt32(metroGrid1.Rows[e.RowIndex].Cells[0].Value) + "'"); } else if (metroGrid1.Rows[e.RowIndex].Cells[6].Value.ToString() == "Registration fee for Certificate course") { d.update("UPDATE Stud_details SET reg_fee=NULL WHERE stud_no='" + txt_studno.Text + "'"); d.delete("DELETE FROM PaymentDetails WHERE Payment_No='" + Convert.ToInt32(metroGrid1.Rows[e.RowIndex].Cells[0].Value) + "'"); } MessageBox.Show("Succefully terminated payment", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); label1.Text = General_methods.Generate_RandomNumber(0, 99999).ToString(); } else { } } }
private void cmb_batch_SelectedIndexChanged(object sender, EventArgs e) { txt_batch_no.Text = General_methods.get_batch_no_from_batch_name(cmb_batch.Text); txt_course_namer.Text = General_methods.get_course_name_from_course_no(General_methods.get_course_no_of_batch_from_batch_no(txt_batch_no.Text)); cmb_medium.Text = General_methods.get_medium_from_batch_no(txt_batch_no.Text); stud_no_change(); }
private void cmb_name_SelectedIndexChanged(object sender, EventArgs e) { txt_fee.Text = d.singleString("SELECT course_fee FROM Course_details_master WHERE course_no='" + General_methods.get_course_no_from_course_name(cmb_name.Text) + "'"); txt_registration_fee_txt.Text = d.singleString("SELECT reg_fee FROM Course_details_master WHERE course_no='" + General_methods.get_course_no_from_course_name(cmb_name.Text) + "'"); cmb_medium.DataSource = General_methods.fill_course_mediums_combobox(General_methods.get_course_no_from_course_name(cmb_name.Text)); cmb_medium.SelectedIndex = 0; }
private void metroTile2_Click(object sender, EventArgs e) { Edit_personal_info q = new Edit_personal_info(); q.Show(); q.txt_studno.Text = this.txt_no.Text; q.txt_fname.Text = txt_fname.Text.Split(' ').GetValue(0).ToString(); q.txt_mname.Text = txt_fname.Text.Split(' ').GetValue(1).ToString(); q.txt_lname.Text = txt_fname.Text.Split(' ').GetValue(2).ToString(); q.metroDateTime1.Value = Convert.ToDateTime(txt_bday.Text); q.txt_nic.Text = txt_nic.Text; q.txt_desig.DataSource = General_methods.fill_designations_combobox(); q.txt_desig.Text = txt_desig.Text; q.batch = txt_batchno.Text; q.prev_nic = txt_nic.Text; if (txt_gender.Text == "male") { q.metroRadioButton1.Checked = true; } else { q.metroRadioButton2.Checked = true; } q.metroTile1.Click += HandleCustomEvent1; }
private void metroTile1_Click(object sender, EventArgs e) { if (txt_amount_full_pay.Text == "") { MessageBox.Show("Please confirm amount paying", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult dr = MessageBox.Show("You are about to save a payment. Press yes to confirm", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { d.insert("INSERT INTO PaymentDetails (Gross_amount,Discount_percent,Net_amount,Date,Time,stud_no_org_no,program_no,Remark) VALUES('" + txt_course_fee_for_full_payament.Text.Remove(txt_course_fee_for_full_payament.Text.Length - 2, 2) + "','" + txt_discout_for_full_payment.Text + "','" + txt_amount_full_pay.Text.Remove(txt_amount_full_pay.Text.Length - 2, 2) + "','" + DateTime.Today.ToShortDateString() + "','" + DateTime.Now.ToLongTimeString() + "','" + studno + "','None','Full payement for diploma course')"); d.update("UPDATE Dip_stud_modules SET payement_no='" + d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails") + "' WHERE stud_no='" + studno + "' "); MessageBox.Show("Details Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult a1 = MessageBox.Show("Generate Recipt?", "Notofication", MessageBoxButtons.OK, MessageBoxIcon.Information); //this label is used for event firing label1.Text = General_methods.Generate_RandomNumber(0, 72653).ToString(); if (a1 == DialogResult.Yes) { } else { } } } }
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; }
private void metroTile5_Click(object sender, EventArgs e) { if (txt_reg_fee_paying.Text.Any(char.IsLetter) == true || txt_reg_fee_paying.Text == "" || Convert.ToDouble(txt_reg_fee_of_course.Text.Remove(txt_reg_fee_of_course.Text.Length - 2, 2)) < Convert.ToDouble(txt_reg_fee_paying.Text)) { MessageBox.Show("Please enter valid registration fee", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult dr = MessageBox.Show("You are about to save a payment. Press yes to confirm", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { d.insert("INSERT INTO PaymentDetails (Gross_amount,Discount_percent,Net_amount,Date,Time,stud_no_org_no,program_no,Remark) VALUES('" + txt_reg_fee_of_course.Text.Remove(txt_reg_fee_of_course.Text.Length - 2, 2) + "','0','" + txt_reg_fee_paying.Text + "','" + General_methods.get_current_date() + "','" + General_methods.get_current_time().ToString() + "','" + txt_studno.Text + "','None','Registration fee for diploma course')"); d.update("UPDATE Stud_details SET reg_fee='" + d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails").ToString() + "' WHERE stud_no='" + txt_studno.Text + "'"); MessageBox.Show("Details Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult a1 = MessageBox.Show("Generate Recipt?", "Notofication", MessageBoxButtons.OK, MessageBoxIcon.Information); //this label is used for event firing label1.Text = General_methods.Generate_RandomNumber(0, 2837872).ToString(); if (a1 == DialogResult.Yes) { } else { } } } }
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 metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == 7 && e.RowIndex >= 0) { DialogResult dc = MessageBox.Show("Are you sure you want to terminate payment?", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dc == DialogResult.Yes) { d.update("UPDATE Short_program_participation SET payment_no=Null WHERE payment_no='" + metroGrid1.Rows[e.RowIndex].Cells[0].Value.ToString() + "'"); d.delete("DELETE FROM PaymentDetails WHERE Payment_No='" + metroGrid1.Rows[e.RowIndex].Cells[0].Value.ToString() + "'"); MessageBox.Show("Succefully terminated payment", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); label1.Text = General_methods.Generate_RandomNumber(0, 99999).ToString(); } else { } } else if (e.ColumnIndex == 9 && e.RowIndex >= 0) { show_studs.pay_no = metroGrid1.Rows[e.RowIndex].Cells[0].Value.ToString(); show_studs s = new show_studs(); s.Show(); } }
private void txt_org_SelectedIndexChanged(object sender, EventArgs e) { string[] d = General_methods.get_organization_details_from_org_name(txt_org.Text); txt_Oadd.Text = d[0]; txt_office_tel_1.Text = d[1]; txt_oemail.Text = d[2]; txt_fax.Text = d[3]; }
private void metroTile1_Click(object sender, EventArgs e) { string remark = "Payament for short programs / workshops (Company) -" + txt_remark.Text; if (txt_netamount.Text == "") { MessageBox.Show("Please calculate the final amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_amount.Text == "") { MessageBox.Show("Participants have not been selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cmb_payment_mode.Text == "") { MessageBox.Show("Please select payment method", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cmb_payment_mode.SelectedIndex == 2 && txt_chequeno.Text == "") { MessageBox.Show("Please enter the cheque number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult dr = MessageBox.Show("You are about to save a payment. Press yes to confirm", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { d.insert("INSERT INTO PaymentDetails(Gross_amount,Discount_percent,Net_amount,Date,Time,stud_no_org_no,program_no,Remark,Payment_mode) VALUES ('" + txt_amount.Text.Remove(txt_amount.Text.Length - 2, 2).ToString() + "','" + txt_discount.Text + "','" + txt_netamount.Text.Remove(txt_netamount.Text.Length - 2, 2).ToString() + "','" + General_methods.get_current_date() + "','" + General_methods.get_current_time() + "','" + General_methods.find_organization_no_from_organization_name(cmb_companies.Text) + "','" + txt_progno.Text + "','" + remark + "','" + cmb_payment_mode.Text + "')"); int id = d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails"); for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.CheckedItems.Contains(checkedListBox1.Items[i]) == true && a.Contains(i) == false) { d.update("UPDATE Short_program_participation SET payment_no='" + id + "' WHERE ref_no='" + checkedListBox1.Items[i].ToString().Split('-').GetValue(1) + "'"); } else { } } if (cmb_payment_mode.SelectedIndex == 2) { d.insert("INSERT INTO Cheque_payments (Payment_no,Cheque_no) VALUES ('" + d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails") + "','" + txt_chequeno.Text + "')"); } MessageBox.Show("Details Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult a1 = MessageBox.Show("Generate Recipt?", "Notofication", MessageBoxButtons.OK, MessageBoxIcon.Information); //this label is used for event firing label1.Text = General_methods.Generate_RandomNumber(1, 678767).ToString(); ////////////// if (a1 == DialogResult.Yes) { } else { } } else { } } }
private void Form1_Load(object sender, EventArgs e) { cmb_rperson2.Items.Add("None"); cmb_rperson2.Text = "None"; cmb_rperson3.Items.Add("None"); cmb_rperson3.Text = "None"; //txt_venue.Text = "NILS"; cmb_rperson1.DataSource = General_methods.fill_lecturer_names_combobox(); }
private void Module_selection_Load(object sender, EventArgs e) { if (state == false) { lbl_course_name.Text = General_methods.get_course_name_from_course_no(lbl_course_no.Text); lbl_min_mods.Text = d.singleString("SELECT No_of_modules_to_be_selected FROM Course_details_master WHERE course_no='" + lbl_course_no.Text + "'"); con.Open(); SqlCommand cmd = new SqlCommand("SELECT Module_name,compulsory FROM Dip_module_details_2 WHERE Course_no='" + lbl_course_no.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); int i = 0; while (dr.Read()) { checkedListBox1.Items.Add(dr.GetValue(0).ToString()); if (dr.GetBoolean(1) == true) { checkedListBox1.SetItemChecked(i, true); a.Add(i); } else { checkedListBox1.SetItemChecked(i, false); } i++; } con.Close(); } else { lbl_course_name.Text = General_methods.get_course_name_from_course_no(lbl_course_no.Text); lbl_min_mods.Text = d.singleString("SELECT No_of_modules_to_be_selected FROM Course_details_master WHERE course_no='" + lbl_course_no.Text + "'"); con.Open(); SqlCommand cmd = new SqlCommand("SELECT Module_name,compulsory FROM Dip_module_details_2 WHERE Course_no='" + lbl_course_no.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); int i = 0; while (dr.Read()) { checkedListBox1.Items.Add(dr.GetValue(0).ToString()); if (dr.GetBoolean(1) == true) { checkedListBox1.SetItemChecked(i, true); a.Add(i); } if (d.singleInt("SELECT COUNT(*) FROM Dip_stud_modules WHERE stud_no='" + lbl_stud_no.Text + "' AND module_no='" + General_methods.get_module_no_from_module_name(dr.GetValue(0).ToString(), lbl_course_no.Text) + "'") != 0) { checkedListBox1.SetItemChecked(i, true); } else { checkedListBox1.SetItemChecked(i, false); } i++; } con.Close(); } }
private void metroTile4_Click(object sender, EventArgs e) { string remark = "Payament for short programs / workshops (Individual) -" + txt_remark_individual.Text; if (txt_amount_payable_individual.Text == "") { MessageBox.Show("Please select participant", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_amount_paying_individual.Text == "") { MessageBox.Show("Please enter amount paying", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_discount_individual.Text == "") { MessageBox.Show("Please enter discount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_netamount_individual.Text == "") { MessageBox.Show("Final amount not calculated", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cmb_payment_mode2.Text == "") { MessageBox.Show("Please select payment method", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cmb_payment_mode2.SelectedIndex == 2 && txt_cheque_no2.Text == "") { MessageBox.Show("Please enter the cheque number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult dr = MessageBox.Show("You are about to save a payment. Press yes to confirm", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { d.insert("INSERT INTO PaymentDetails(Gross_amount,Discount_percent,Net_amount,Date,Time,stud_no_org_no,program_no,Remark) VALUES ('" + txt_amount_paying_individual.Text.ToString() + "','" + txt_discount.Text + "','" + txt_netamount_individual.Text.Remove(txt_netamount_individual.Text.Length - 2, 2).ToString() + "','" + General_methods.get_current_date() + "','" + General_methods.get_current_time() + "','" + cmb_individual_participants.Text.Split('-').GetValue(0).ToString() + "','" + txt_progno.Text + "','" + remark + "')"); int id = d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails"); d.update("UPDATE Short_program_participation SET payment_no='" + id + "' WHERE ref_no='" + cmb_individual_participants.Text.Split('-').GetValue(0).ToString() + "'"); if (cmb_payment_mode2.SelectedIndex == 2) { d.insert("INSERT INTO Cheque_payments (Payment_no,Cheque_no) VALUES ('" + d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails") + "','" + txt_cheque_no2.Text + "')"); } MessageBox.Show("Details Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult a1 = MessageBox.Show("Generate Recipt?", "Notofication", MessageBoxButtons.OK, MessageBoxIcon.Information); //this label is used for event firing label1.Text = General_methods.Generate_RandomNumber(1, 678767).ToString(); ////////////// if (a1 == DialogResult.Yes) { } else { } } else { } } }
private void metroTile4_Click(object sender, EventArgs e) { if (txt_mosule_wise_amount_after_discount.Text == "") { MessageBox.Show("Please calculate the final amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_amount_paying_module_wise.Text == "") { MessageBox.Show("Paying amounts for modules have not been confirmed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cmb_payment_mode.Text == "") { MessageBox.Show("Please select payment method", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cmb_payment_mode.SelectedIndex == 2 && txt_chequeno.Text == "") { MessageBox.Show("Please enter the cheque number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult dr = MessageBox.Show("You are about to save a payment. Press yes to confirm", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { d.insert("INSERT INTO PaymentDetails(Gross_amount,Discount_percent,Net_amount,Date,Time,stud_no_org_no,program_no,Remark,Payment_mode) VALUES ('" + txt_amount_paying_module_wise.Text.Remove(txt_amount_paying_module_wise.Text.Length - 2, 2).ToString() + "','" + txt_mod_wise_discount.Text + "','" + txt_mosule_wise_amount_after_discount.Text.Remove(txt_mosule_wise_amount_after_discount.Text.Length - 2, 2).ToString() + "','" + General_methods.get_current_date() + "','" + General_methods.get_current_time() + "','" + txt_studno.Text + "','None','Module wise Payement for Diploma course','" + cmb_payment_mode.Text + "')"); int id = d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails"); for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.CheckedItems.Contains(checkedListBox1.Items[i]) == true && a.Contains(i) == false) { d.update("UPDATE Dip_stud_modules SET payement_no='" + id + "' WHERE stud_no='" + txt_studno.Text + "' AND module_no='" + General_methods.get_module_no_from_module_name(checkedListBox1.Items[i].ToString(), General_methods.get_course_no_from_course_name(txt_course_name.Text)) + "'"); } else { } } if (cmb_payment_mode.SelectedIndex == 2) { d.insert("INSERT INTO Cheque_payments (Payment_no,Cheque_no) VALUES ('" + d.singleInt("SELECT MAX(Payment_No) FROM PaymentDetails") + "','" + txt_chequeno.Text + "')"); } MessageBox.Show("Details Saved Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult a1 = MessageBox.Show("Generate Recipt?", "Notofication", MessageBoxButtons.OK, MessageBoxIcon.Information); //this label is used for event firing label1.Text = General_methods.Generate_RandomNumber(1, 678767).ToString(); ////////////// if (a1 == DialogResult.Yes) { } else { } } else { } } }
private void cmb_name1_SelectedIndexChanged(object sender, EventArgs e) { if (cmb_type_2.SelectedIndex == 0) { cmb_module_2.DataSource = General_methods.fill_module_combobox(General_methods.get_course_no_from_course_name(cmb_name1.Text)); } else { cmb_module_2.Enabled = false; } }
private void cmb_type_SelectedIndexChanged(object sender, EventArgs e) { if (cmb_type.SelectedIndex == 0) { cmb_name.DataSource = General_methods.fill_course_combobox("Diploma"); } else if (cmb_type.SelectedIndex == 1) { cmb_name.DataSource = General_methods.fill_course_combobox("Certificate"); } cmb_name.SelectedIndex = 0; }
private void metroTile9_Click(object sender, EventArgs e) { if (txt_mod_wise_discount.Text.Any(char.IsLetter) == true || txt_mod_wise_discount.Text == "" || Convert.ToDouble(txt_mod_wise_discount.Text) > 100) { MessageBox.Show("Please enter valid discount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { txt_mosule_wise_amount_after_discount.Text = (Convert.ToDouble(txt_amount_paying_module_wise.Text.Remove(txt_amount_paying_module_wise.Text.Length - 2, 2)) * Convert.ToDouble(100 - Convert.ToDouble(txt_mod_wise_discount.Text)) / 100).ToString("R") + "/="; txt_final_amount_mod_wise.Text = General_methods.calc_amount_payable(txt_studno.Text, Convert.ToDouble(txt_amount_paying_module_wise.Text.Remove(txt_amount_paying_module_wise.Text.Length - 2, 2)), "Diploma").ToString("R") + "/="; } }
public void set_items_to_items_list(string type, List <string> k) { if (type == "other") { k.Clear(); con.Open(); SqlCommand cmd = new SqlCommand("SELECT s.program_no,s.scheduled_date,c.Program_title,s.course_type,s.course_no FROM Session_details s INNER JOIN Short_program_details c ON s.program_no=c.Code WHERE s.course_type='Workshop' OR s.course_type='One-day' OR s.course_type='Two-day'OR s.course_type='Three-day' ", con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { if (dr.GetValue(2).ToString() == "None") { k.Add(dr.GetValue(0).ToString() + " - " + dr.GetDateTime(1).ToString("dd/MM/yyy") + " - " + General_methods.get_course_name_from_course_no(dr.GetValue(4).ToString()) + " - " + dr.GetValue(3).ToString()); } else { k.Add(dr.GetValue(0).ToString() + " - " + dr.GetDateTime(1).ToString("dd/MM/yyy") + " - " + dr.GetValue(2).ToString() + " - " + dr.GetValue(3).ToString()); } } con.Close(); } else { k.Clear(); txt_enter_name.Items.Clear(); txt_enter_name.Text = ""; con.Open(); SqlCommand cmd = new SqlCommand("SELECT stud_no,f_name,m_name,l_name,NIC,ref,course_no FROM Stud_details", con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { if (General_methods.get_course_type_from_course_no(dr.GetValue(6).ToString()) == type) { if (dr.IsDBNull(5)) { k.Add(dr.GetValue(0).ToString() + " - " + dr.GetValue(1).ToString() + " " + dr.GetValue(2).ToString() + " " + dr.GetValue(3).ToString() + " - " + dr.GetValue(4).ToString()); } else { SqlConnection con2 = new SqlConnection(Credentials.connection); SqlCommand cmd2 = new SqlCommand("SELECT f_name,m_name,l_name,NIC,course_no FROM Stud_details WHERE stud_no='" + dr.GetValue(5).ToString() + "'", con2); con2.Open(); SqlDataReader dr2 = cmd2.ExecuteReader(); dr2.Read(); k.Add(dr.GetValue(0).ToString() + " - " + dr2.GetValue(0).ToString() + " " + dr2.GetValue(1).ToString() + " " + dr2.GetValue(2).ToString() + " - " + dr2.GetValue(3).ToString()); dr2.Close(); con2.Close(); } } } con.Close(); } }
private void cmb_type_SelectedIndexChanged(object sender, EventArgs e) { cmb_batch.DataSource = General_methods.fill_batches_combobox(cmb_type.Text); if (cmb_type.SelectedIndex == 0) { state = false; } else { state = true; } }
public void edit_batch_no_and_name() { if (cmb_type.Text == "Diploma") { txt_batch_no.Text = "NILS/Dip/" + General_methods.get_course_no_from_course_name(cmb_name.Text) + "/" + cmb_medium.Text + "/" + cmb_year.Text + "/" + dat_startdate.Value.ToString("MMMM") + "/" + txt_batch_for_year.Text; txt_batch_name.Text = cmb_name.Text + "-" + cmb_medium.Text + "-" + cmb_year.Text + "-" + dat_startdate.Value.ToString("MMMM") + "-" + txt_batch_for_year.Text; } else if (cmb_type.Text == "Certificate") { txt_batch_no.Text = "NILS/Certif/" + General_methods.get_course_no_from_course_name(cmb_name.Text) + "/" + cmb_medium.Text + "/" + cmb_year.Text + "/" + dat_startdate.Value.ToString("MMMM") + "/" + txt_batch_for_year.Text; txt_batch_name.Text = cmb_name.Text + "-" + cmb_medium.Text + "-" + cmb_year.Text + "-" + dat_startdate.Value.ToString("MMMM") + "-" + txt_batch_for_year.Text; } }
private void tile_update_Click(object sender, EventArgs e) { try { Database d = new Database(); DialogResult result = MessageBox.Show("Are you sure you want to edit program details?", "NILS", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { string resourceP2; string resourceP3; if (metroCheckBox1.Checked == true) { resourceP2 = General_methods.get_lec_no_from_lec_name(cmb_rp_2.Text); } else { resourceP2 = "None"; } if (metroCheckBox2.Checked == true) { resourceP3 = General_methods.get_lec_no_from_lec_name(cmb_rp_3.Text); } else { resourceP3 = "None"; } if (cmb_type_2.SelectedIndex != 5) { con.Open(); d.update("UPDATE Session_details SET scheduled_date='" + txt_date.Value.ToString("MM/dd/yyyy") + "',course_type='" + ctype + "',course_no='" + course_no.Text + "',Resource_person_1='" + General_methods.get_lec_no_from_lec_name(cmb_rp_1.Text) + "',Resource_person_2='" + resourceP2 + "',Resource_person_3='" + resourceP3 + "',venue=N'" + txt_venue.Text + "' WHERE (program_no='" + txt_progno.Text + "')"); MessageBox.Show("Details edited Succefully", "NILS", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); con.Close(); } else { con.Open(); d.update("UPDATE Session_details SET scheduled_date='" + txt_date.Value.ToString("MM/dd/yyyy") + "',course_type='Workshop', course_no='None', Resource_person_1='" + General_methods.get_lec_no_from_lec_name(cmb_rp_1.Text) + "',Resource_person_2='" + resourceP2 + "', Resource_person_3='" + resourceP3 + "',venue=N'" + txt_venue.Text + "' WHERE (program_no='" + txt_progno.Text + "')"); d.update("UPDATE Short_program_details SET Program_title='" + txt_progtitle.Text + "' WHERE Code='" + txt_progno.Text + "'"); MessageBox.Show("Details edited Succefully", "NILS", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); con.Close(); } } else { } } catch (Exception V) { MessageBox.Show(V.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void metroCheckBox2_CheckedChanged(object sender, EventArgs e) { if (metroCheckBox2.Checked == true) { cmb_rp_3.Enabled = true; cmb_rp_3.DataSource = General_methods.fill_lecturer_names_combobox(); } else { cmb_rp_3.DataSource = null; cmb_rp_3.Enabled = false; cmb_rp_3.Items.Add("None"); cmb_rp_3.SelectedItem = "None"; } }
private void metroCheckBox1_CheckedChanged(object sender, EventArgs e) { if (metroCheckBox1.Checked == true) { cmb_rperson2.DataSource = General_methods.fill_lecturer_names_combobox(); cmb_rperson2.Enabled = true; cmb_rperson2.Items.Remove("None"); } else { cmb_rperson2.DataSource = null; cmb_rperson2.Items.Add("None"); cmb_rperson2.Text = "None"; cmb_rperson2.Enabled = false; } }
private void metroTile10_Click(object sender, EventArgs e) { if (txt_amount_paying.Text.Any(char.IsLetter) == true || txt_amount_paying.Text == "" || Convert.ToDouble(txt_amount_paying.Text) > Convert.ToDouble(txt_amount_payabme.Text.Remove(txt_amount_payabme.Text.Length - 2, 2))) { MessageBox.Show("Please enter correct amount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_discount.Text.Any(char.IsLetter) == true || txt_discount.Text == "" || Convert.ToDouble(txt_discount.Text) > 100) { MessageBox.Show("Please enter valid discount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { txt_final_amount.Text = (Convert.ToDouble(txt_amount_paying.Text) * Convert.ToDouble(100 - Convert.ToDouble(txt_discount.Text)) / 100).ToString("R") + "/="; txt_amount_payable_2.Text = General_methods.calc_amount_payable(txt_studno.Text, Convert.ToDouble(txt_amount_paying.Text), "Certificate").ToString(); } }
private void cmb_type_SelectedIndexChanged(object sender, EventArgs e) { if (cmb_type.SelectedIndex == 0) { cmb_course_1.DataSource = General_methods.fill_course_combobox("Diploma"); type = "Diploma"; } if (cmb_type.SelectedIndex == 1) { cmb_course_1.DataSource = General_methods.fill_course_combobox("Certificate"); type = "Certificate"; } cmb_batch.Items.Clear(); cmb_batch.Text = ""; cmb_medium.Text = ""; txt_studno_1.Text = ""; }
private void metroTile1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_fname.Text) || txt_fname.Text.Any(char.IsDigit)) { MessageBox.Show(this, "Please enter correct First name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (string.IsNullOrEmpty(txt_mname.Text) || txt_mname.Text.Any(char.IsDigit)) { MessageBox.Show(this, "Please enter correct Middle name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (string.IsNullOrEmpty(txt_lname.Text) || txt_lname.Text.Any(char.IsDigit)) { MessageBox.Show(this, "Please enter correct Last name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (General_methods.NIC_validation(txt_nic.Text, metroDateTime1.Value, gen) == "invalid") { MessageBox.Show(this, "Some Details do not match the NIC number entered. Please check NIC, birthdate and gender selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_nic.Text != prev_nic && General_methods.check_if_id_exists(txt_nic.Text, batch) == "false") { MessageBox.Show(this, "A student with the same NIC already exists in this batch", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (metroRadioButton1.Checked == false && metroRadioButton2.Checked == false) { MessageBox.Show(this, "Please select gender", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txt_desig.Text == "") { MetroMessageBox.Show(this, "Please enter designation", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult d1 = MessageBox.Show(this, "Edit Details?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d1 == DialogResult.Yes) { Database d = new Database(); d.update("UPDATE Stud_details SET f_name='" + txt_fname.Text + "', m_name='" + txt_mname.Text + "',l_name='" + txt_lname.Text + "',NIC='" + txt_nic.Text + "',Birthday='" + metroDateTime1.Value.ToString() + "',gender='" + gen + "',designation='" + txt_desig.Text + "' WHERE stud_no='" + txt_studno.Text + "'"); MessageBox.Show(this, "Successfully updated record", "done", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Close(); } else { } } }
private void metroTile1_Click(object sender, EventArgs e) { if (txt_name.Text == "") { MessageBox.Show(this, "Please enter participants name", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (txt_email.Text == "") { MessageBox.Show(this, "Please enter participants email", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (txt_phoneno.MaskCompleted == false) { MessageBox.Show(this, "Please enter participants phone no", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (cmb_desigs.Text == "") { MessageBox.Show(this, "Please enter participants phone no", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (General_methods.Quick_NIC_Validation(txt_NIC.Text) == "Invalid") { MessageBox.Show(this, "Please enter valid NIC", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (cmb_org.Text == "") { MessageBox.Show(this, "Please select Organization of participant", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (txt_destrict.Text == "") { MessageBox.Show(this, "Please select Address of participant", "Missing Field", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { DialogResult d2 = MessageBox.Show("Update details?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d2 == DialogResult.Yes) { Database d = new Database(); d.update("UPDATE Short_program_participation SET address='" + txt_destrict.Text + "',designation='" + cmb_desigs.Text + "',Email='" + txt_email.Text + "',Name='" + txt_name.Text + "',NIC='" + txt_NIC.Text + "',Organization_id='" + General_methods.find_organization_no_from_organization_name(cmb_org.Text) + "',phone_no='" + txt_phoneno.Text + "' WHERE ref_no='" + lbl_no.Text + "'"); MessageBox.Show("Details Updated Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); label1.Text = General_methods.Generate_RandomNumber(3, 678).ToString(); Close(); } } }
public static void studcredentials() { SqlConnection con = new SqlConnection(Credentials.connection); con.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM Stud_details WHERE stud_no='" + studno + "'", con); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); courseno = dr.GetValue(17).ToString(); coursename = General_methods.get_course_name_from_course_no(dr.GetValue(17).ToString()); fname = dr.GetValue(1).ToString(); lname = dr.GetValue(2).ToString(); email = dr.GetValue(14).ToString(); dr.Close(); SqlCommand cmd1 = new SqlCommand("SELECT course_name FROM Course_details_master WHERE course_no='" + courseno + "'", con); SqlDataReader dr1 = cmd1.ExecuteReader(); dr1.Read(); coursename = dr1.GetValue(0).ToString(); dr1.Close(); SqlCommand cmd2 = new SqlCommand("SELECT * FROM Folder_ids WHERE course_no='" + courseno + "'", con); SqlDataReader dr2 = cmd2.ExecuteReader(); dr2.Read(); notes_folder = dr2.GetValue(2).ToString(); assignment_folder = dr2.GetValue(3).ToString(); papers_folder = dr2.GetValue(4).ToString(); dr2.Close(); /*SqlCommand cmd3 = new SqlCommand("SELECT f_name FROM Dip_stud_details WHERE stud_no='" + Class_student.studno + "'", con); * SqlDataReader dr3 = cmd3.ExecuteReader(); * dr3.Read(); * fname = dr3.GetValue(0).ToString(); * dr3.Close(); * SqlCommand cmd4 = new SqlCommand("SELECT l_name FROM Dip_stud_details WHERE stud_no='" + Class_student.studno + "'", con); * SqlDataReader dr4 = cmd4.ExecuteReader(); * dr4.Read(); * lname = dr4.GetValue(0).ToString();*/ }
public UC_payements_certif() { InitializeComponent(); pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; if (General_methods.calc_amount_payable(studno, 0, "Certificate") == 0) { groupBox3.Enabled = false; groupBox3.Text = "Course fee fully Payed"; } metroGrid1.DataSource = d.show("SELECT Payment_No,Gross_amount,Discount_percent,Net_amount,Date,Time,Remark FROM PaymentDetails WHERE stud_no_org_no='" + studno + "'"); metroGrid1.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; metroGrid1.AllowUserToAddRows = false; DataGridViewButtonColumn bt = new DataGridViewButtonColumn(); bt.Text = "Terminate Payment"; bt.FlatStyle = FlatStyle.Flat; bt.UseColumnTextForButtonValue = true; bt.Width = 150; metroGrid1.Columns.Add(bt); DataGridViewButtonColumn bt2 = new DataGridViewButtonColumn(); bt2.Text = "Generate Recipt"; bt2.FlatStyle = FlatStyle.Flat; bt2.UseColumnTextForButtonValue = true; bt2.Width = 150; metroGrid1.Columns.Add(bt2); con.Open(); SqlCommand cmd2 = new SqlCommand("SELECT reg_fee FROM Stud_details WHERE stud_no='" + studno + "'", con); SqlDataReader dr2 = cmd2.ExecuteReader(); dr2.Read(); if (!dr2.IsDBNull(0)) { groupBox2.Enabled = false; groupBox2.Text = "Registration fee payed"; } else { } con.Close(); }