private void Tutors_management_Load(object sender, EventArgs e) { CmbClass cmbc = new CmbClass(); cmbc.cboDataBind(cbo_principal, "SELECT distinct 姓名 FROM [Workers]", "Workers", "姓名"); cbo_principal.SelectedItem = null; txt_printnum.Text = print_num1; string mysql = string.Format("SELECT distinct 教员编号 FROM [Parents-Tutors] WHERE 家长编号='{0}' " + "AND 打印编号='{1}'", parent_num1, print_num1); cmbc.cboDataBind(cbo_tutors_num, mysql, "Parents-Tutors", "教员编号"); /* if (state1 != null) * { * string[] state = state1.Split(' '); * string tempstate = state.Last(); * cbo_state.SelectedItem = tempstate; * }*/ flag2 = true; if (tutors_num1 != "") { cbo_tutors_num.Text = tutors_num1; } /* if (tutors_name1 != "") * txt_tutors_name.Text = tutors_name1; * * * if (remarks1 != "") * txt_remark.Text = remarks1;*/ /* mysql = string.Format("SELECT * FROM [Parents-Tutors] WHERE 打印编号='{0}' AND 教员编号='{1}'", print_num1, tutors_num1); * int i = mydb.Rownum(mysql); * if (i > 0) * flag = true;//记录存在*/ }
private void Payment_Load(object sender, EventArgs e) { txt_parent_num.Text = parent_num1; txt_print_num.Text = print_num1; cbo_state.SelectedItem = "已缴"; cbo_state.Enabled = false; CmbClass cmbc = new CmbClass(); cmbc.cboDataBind(cbo_principal, "SELECT distinct 姓名 FROM [Workers]", "Workers", "姓名"); cbo_principal.SelectedItem = null; }
private void Tutors_Add_Load(object sender, EventArgs e) { CmbClass cmbc = new CmbClass(); cmbc.cboDataBind(cbo_reception, "SELECT distinct 姓名 FROM [Workers]", "Workers", "姓名"); cbo_reception.SelectedItem = null; cbo_tutor_state.SelectedItem = "接入"; string mysql = "SELECT MAX(家长编号) FROM [parents]"; int parents_num = int.Parse(mydb.Returnafield(mysql)); parents_num++; txt_parent_num.Text = parents_num.ToString(); mysql = "SELECT MAX(打印编号) FROM [parents]"; int print_num = int.Parse(mydb.Returnafield(mysql)); print_num++; txt_print_num.Text = print_num.ToString(); }
private void Workers_Revise_Load(object sender, EventArgs e) { txt_name.Text = name1; if (sex1 == "男") { rdo_man.Checked = true; } if (sex1 == "女") { rdo_woman.Checked = true; } txt_student_num.Text = student_num1; cbo_subject.Text = subject1; cmbc.cboDataBind(cbo_subject, "SELECT distinct 院系专业 FROM [Workers]", "Workers", "院系专业"); txt_phone.Text = phone1; txt_position.Text = position1; txt_month.Text = month1; txt_sum.Text = sum1; }
private void Students_Revise_Load(object sender, EventArgs e) { CmbDataGridview cmbd = new CmbDataGridview(); CCTRS ctr = new CCTRS(); ctr.ColorDataGridView(dgv_parents); string mystr = "SELECT 家长编号,打印编号,经办状态,经办时间,经办人,处理备注 FROM [Tutors-Parents] WHERE " + "教员编号='" + tutors_num1 + "'" + " ORDER BY (SELECT right(经办时间,10)) DESC"; cmbd.bind(dgv_parents, mystr, "Tutors-Parents"); dgv_parents.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader; dgv_parents.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; txt_num.Text = tutors_num1; txt_student_name.Text = tutors_name1; txt_student_num.Text = student_num1; cmbc.cboDataBind(cbo_subject, "SELECT distinct 院系专业 FROM [Tutors]", "Tutors", "院系专业"); cbo_subject.Text = grade_subject1; cbo_degree.Text = tutors_degree1; if (sex1 == "男") { rdo_man.Checked = true; } if (sex1 == "女") { rdo_woman.Checked = true; } txt_phone.Text = phone1; txt_place.Text = place1; if (blacklist1 == "是") { cbo_yesno.SelectedItem = "是"; } if (blacklist1 == "否") { cbo_yesno.SelectedItem = "否"; } txt_imprisonment.Text = imprisonment1; txt_important_remarks.Text = remarks1; }
private void Tutors_revise_Load(object sender, EventArgs e) { CmbClass cmbc = new CmbClass(); cmbc.cboDataBind(cbo_reception, "SELECT distinct 姓名 FROM [Workers]", "Workers", "姓名"); CmbDataGridview cmbd = new CmbDataGridview(); CCTRS ctr = new CCTRS(); ctr.ColorDataGridView(dgv_tutors); string mystr = "SELECT 教员编号,教员姓名,经办状态,经办时间,经办人,处理备注 FROM [Parents-Tutors] WHERE " + "打印编号='" + print_num1 + "' ORDER BY (SELECT right(经办时间,10)) DESC"; cmbd.bind(dgv_tutors, mystr, "Parents-Tutors"); dgv_tutors.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader; dgv_tutors.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; txt_parent_num.Text = parent_num1; txt_print_num.Text = print_num1; mystr = "SELECT 接入时间 FROM [Parents] WHERE ID='" + ID1 + "'"; dt_recepiton_time.Text = mydb.Returnafield(mystr); txt_parent_name.Text = parent_name1; txt_phone.Text = phone1; mystr = "SELECT 家教地址简单 FROM [Parents] WHERE ID='" + ID1 + "'"; txt_sadd.Text = mydb.Returnafield(mystr); txt_dadd.Text = dadd1; txt_grade_subject.Text = grade_subject1; if (student_sex1 == "男") { rdo_man.Checked = true; } if (student_sex1 == "女") { rdo_woman.Checked = true; } txt_tutor_price.Text = tutors_price1; txt_tutor_time.Text = tutors_time1; mystr = "SELECT 接待人 FROM [Parents] WHERE ID='" + ID1 + "'"; cbo_reception.Text = mydb.Returnafield(mystr); mystr = "SELECT 教员要求性别 FROM [Parents] WHERE ID='" + ID1 + "'"; cbo_sex.SelectedItem = mydb.Returnafield(mystr); mystr = "SELECT 教员要求地域 FROM [Parents] WHERE ID='" + ID1 + "'"; txt_place.Text = mydb.Returnafield(mystr); mystr = "SELECT 教员要求年级 FROM [Parents] WHERE ID='" + ID1 + "'"; txt_grade.Text = mydb.Returnafield(mystr); mystr = "SELECT 教员要求专业 FROM [Parents] WHERE ID='" + ID1 + "'"; txt_subject.Text = mydb.Returnafield(mystr); mystr = "SELECT 教员要求其他 FROM [Parents] WHERE ID='" + ID1 + "'"; txt_other_requests.Text = mydb.Returnafield(mystr); // string[] tutors_state = tutors_state1.Split(' '); // cbo_tutor_state.SelectedItem = tutors_state.Last(); cbo_tutor_state.SelectedItem = tutors_state1; txt_important_remarks.Text = important_mark1; cbo_payment_state.SelectedItem = payment_state1; dt_payment_time.Text = payment_time1; if (cbo_payment_state.SelectedItem.ToString() == "待缴" || cbo_payment_state.SelectedItem.ToString() == "无需缴纳") { dt_payment_time.Enabled = false; } if (cbo_payment_state.SelectedItem.ToString() == "已缴") { dt_payment_time.Enabled = true; } flag = true; }
private void btn_check_Click(object sender, EventArgs e) { if (txt_num.Text == "") { MessageBox.Show("请输入教员编号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int i = mydb.Rownum("SELECT * FROM [Tutors] WHERE 教员编号='" + txt_num.Text.Trim() + "'"); if (i > 0) { MessageBox.Show("该教员编号已存在,请重新输入教员编号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_num.Text = ""; return; } if (txt_student_name.Text == "") { MessageBox.Show("请输入姓名!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_student_num.Text == "") { MessageBox.Show("请输入学号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } i = mydb.Rownum("SELECT * FROM [Tutors] WHERE 学号='" + txt_student_num.Text.Trim() + "'"); if (i > 0) { MessageBox.Show("该学号已存在,请重新输入学号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_student_num.Text = ""; return; } if (cbo_subject.Text == "") { MessageBox.Show("请输入院系专业!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!rdo_man.Checked && !rdo_woman.Checked) { MessageBox.Show("请选择性别!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (cbo_degree.SelectedItem == null) { MessageBox.Show("请选择在读学位!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_phone.Text == "") { MessageBox.Show("请输入联系方式!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_phone.TextLength > 11) { MessageBox.Show("联系方式不得超过11位!请重新输入!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_phone.Text = ""; return; } i = mydb.Rownum("SELECT * FROM [Tutors] WHERE 联系方式='" + txt_phone.Text.Trim() + "'"); if (i > 0) { MessageBox.Show("该联系方式已存在,请重新输入!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_phone.Text = ""; return; } if (txt_place.Text == "") { MessageBox.Show("请输入生源地!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } string sex; if (rdo_man.Checked) { sex = rdo_man.Text; } else { sex = rdo_woman.Text; } string mysql; mysql = string.Format("INSERT INTO [Tutors] (教员编号,姓名,学号,院系专业,在读学位,性别,联系方式,生源地," + "重要备注,是否黑名单) VALUES " + "('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", txt_num.Text.Trim(), txt_student_name.Text.Trim(), txt_student_num.Text.Trim(), cbo_subject.Text.Trim(), cbo_degree.Text, sex, txt_phone.Text.Trim(), txt_place.Text.Trim(), txt_important_remarks.Text.Trim(), "否"); try { mydb.ExecuteNonQuery(mysql); MessageBox.Show("添加信息成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information); i = mydb.Rownum("SELECT * FROM [Subject] WHERE 专业='" + cbo_subject.Text.Trim() + "'"); if (i == 0) { mysql = "INSERT INTO [Subject] (专业) VALUES ('" + cbo_subject.Text.Trim() + "')"; mydb.ExecuteNonQuery(mysql); } SetTop(); txt_student_name.Text = ""; txt_student_num.Text = ""; cbo_degree.SelectedItem = null; rdo_man.Checked = false; rdo_woman.Checked = false; txt_phone.Text = ""; txt_place.Text = ""; txt_important_remarks.Text = ""; cmbc.cboDataBind(cbo_subject, "SELECT distinct 院系专业 FROM [Tutors]", "Tutors", "院系专业"); cbo_subject.Text = ""; mysql = "SELECT MAX(教员编号) FROM [Tutors]"; int tutors_num = int.Parse(mydb.Returnafield(mysql)); tutors_num++; txt_num.Text = tutors_num.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btn_check_Click(object sender, EventArgs e) { if (txt_name.Text == "") { MessageBox.Show("请输入工作人员姓名!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!rdo_man.Checked && !rdo_woman.Checked) { MessageBox.Show("请选择性别!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_student_num.Text == "") { MessageBox.Show("请输入学号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int i = mydb.Rownum("SELECT * FROM [Workers] WHERE 学号='" + txt_student_num.Text.Trim() + "'"); if (i > 0) { MessageBox.Show("该学号已存在,请重新输入学号!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_student_num.Text = ""; return; } if (cbo_subject.Text == "") { MessageBox.Show("请输入院系专业!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_phone.Text == "") { MessageBox.Show("请输入联系方式!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } i = mydb.Rownum("SELECT * FROM [Tutors] WHERE 联系方式='" + txt_phone.Text.Trim() + "'"); if (txt_phone.TextLength > 11) { MessageBox.Show("联系方式不得超过11位!请重新输入!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_phone.Text = ""; return; } if (i > 0) { MessageBox.Show("该联系方式已存在,请重新输入!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txt_phone.Text = ""; return; } string sex; if (rdo_man.Checked) { sex = rdo_man.Text; } else { sex = rdo_woman.Text; } string mysql; mysql = string.Format("INSERT INTO [Workers] (姓名,性别,学号,院系专业,联系方式,职位) VALUES " + "('{0}','{1}','{2}','{3}','{4}','{5}')", txt_name.Text.Trim(), sex, txt_student_num.Text.Trim(), cbo_subject.Text.Trim(), txt_phone.Text.Trim(), txt_position.Text.Trim()); try { mydb.ExecuteNonQuery(mysql); MessageBox.Show("添加信息成功", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information); i = mydb.Rownum("SELECT * FROM [Subject] WHERE 专业='" + cbo_subject.Text.Trim() + "'"); if (i == 0) { mysql = "INSERT INTO [Subject] (专业) VALUES ('" + cbo_subject.Text.Trim() + "')"; mydb.ExecuteNonQuery(mysql); } cmbc.cboDataBind(cbo_subject, "SELECT distinct 院系专业 FROM [Workers]", "Workers", "院系专业"); txt_name.Text = ""; rdo_man.Checked = false; rdo_woman.Checked = false; txt_student_num.Text = ""; cbo_subject.Text = ""; txt_phone.Text = ""; txt_position.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }