private void button1_Click(object sender, EventArgs e) { if (reqContentValue.Text.Trim() != "" && reqResultValue.Text != "") { string insertStr = "insert into requestInfo(reqType,reqContent,reqPeople,reqDate)values('"; insertStr += reqTypeValue.Text + "','"; insertStr += "申核教师为" + VerName + ",申核学生的学号为" + stuIDValue.Text + ",申核内容为:" + reqContentValue.Text + ",申核结果为:" + reqResultValue.Text + "','"; insertStr += reqPeopleValue.Text + "','"; insertStr += reqTimeValue.Text + "')"; int i = operate.sqlCmd(insertStr); if (i == 1) { MessageBox.Show("申核提交成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else { MessageBox.Show("申核提交失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("消息不全", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim() != "") { string insertStr = "insert into requestInfo(reqType,reqPeople,reqContent,reqDate)"; insertStr += "values('申请复核(学生)','"; insertStr += stuID + "','"; insertStr += textBox1.Text + "','"; insertStr += DateTime.Now.ToString() + "')"; int i = operate.sqlCmd(insertStr); if (i == 1) { MessageBox.Show("申请复核成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Clear(); groupBox2.Enabled = false; } else { MessageBox.Show("申请复核失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("未填写申请内容", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button2_Click(object sender, EventArgs e) { if (stuReqValue.Text.Trim() != "" && stuReqConValue.Text.Trim() != "" && stuNameValue.Text.Trim() != "") { string insertStr = "insert into requestInfo(reqType,reqPeople,reqContent,reqDate)"; insertStr += "values('" + stuReqValue.Text + "(学生)','"; insertStr += stuNameValue.Text + "','"; insertStr += stuReqConValue.Text + "','"; insertStr += DateTime.Now.ToString() + "')"; int i = operate.sqlCmd(insertStr); if (i == 1) { MessageBox.Show("提交申请成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); stuReqConValue.Clear(); } else { MessageBox.Show("提交申请失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.frmStudent_Load(sender, e); } else { MessageBox.Show("信息不完整", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button4_Click(object sender, EventArgs e) { if (reqTypeValue.Text == "申请查看学生") { if (reqIDValue.Text.Trim() != "") { string insertStr = "insert into requestInfo(reqType,reqContent,reqPeople,reqDate)values('"; insertStr += reqTypeValue.Text + "','学号为"; insertStr += reqIDValue.Text + "','"; insertStr += corNameValue.Text + "','"; insertStr += DateTime.Now.ToString() + "')"; int i = operate.sqlCmd(insertStr); if (i == 1) { MessageBox.Show("提交成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); reqIDValue.Clear(); } else { MessageBox.Show("提交失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } else if (reqTypeValue.Text == "认证申请") { if (reqContentValue.Text.Trim() != "") { string insertStr = "insert into requestInfo(reqType,reqContent,reqPeople,reqDate)values('"; insertStr += reqTypeValue.Text + "','"; insertStr += reqContentValue.Text + "','"; insertStr += corNameValue.Text + "','"; insertStr += DateTime.Now.ToString() + "')"; int i = operate.sqlCmd(insertStr); if (i == 1) { MessageBox.Show("提交成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); reqContentValue.Clear(); } else { MessageBox.Show("提交失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } }
private void button3_Click(object sender, EventArgs e) { bool crt = true; foreach (Control control in Controls) { if (control is TextBox) { TextBox tb = (TextBox)control; if (tb.Text.Trim() == "") { crt = false; } } else if (control is Label) { Label lb = (Label)control; if (lb.BorderStyle == BorderStyle.FixedSingle) { crt = false; } } } if (crt == false) { MessageBox.Show("输入不正确或者还有未填项", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { string updateStr = "update corInfo set "; updateStr += "corName='" + corNameValue.Text + "',"; updateStr += "corResPerson='" + corResPersonValue.Text + "',"; updateStr += "corRegAdd='" + corRegAddValue.Text + "',"; updateStr += "corTel='" + corTelValue.Text + "',"; updateStr += "corPerson='" + corPersonValue.Text + "',"; updateStr += "corPersonTel='" + corPersonTelValue.Text + "',"; updateStr += "corPersonEmail='" + corPersonEmailValue.Text + "',"; updateStr += "corContinent='" + corConValue.Text + "',"; updateStr += "corAdd='" + corAddValue.Text + "'where corID='" + corID + "'"; int i = operate.sqlCmd(updateStr); if (i == 1) { MessageBox.Show("修改成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else { MessageBox.Show("修改失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void button1_Click(object sender, EventArgs e) { bool crtT = true; foreach (Control control in Controls) { if (control is Label) { Label lb = (Label)control; if (lb.BorderStyle == BorderStyle.FixedSingle) { crtT = false; } } } if (crtT == true) { string updateStr = "update stuInfo set "; updateStr += "stuName='" + stuNameValue.Text + "',"; updateStr += "stuFmrName='" + stuFmrNameValue.Text + "',"; updateStr += "stuSex='" + stuSexValue.Text + "',"; updateStr += "stuBirth='" + stuBirthValue.Text + "',"; updateStr += "stuNation='" + stuNationValue.Text + "',"; updateStr += "stuPoli='" + stuPoliValue.Text + "',"; updateStr += "stuRes='" + stuResValue.Text + "',"; updateStr += "stuIDNum='" + stuIDCValue.Text + "',"; updateStr += "stuWorkPlace='" + stuWorkPlaceValue.Text + "',"; updateStr += "workPC='" + stuPCValue.Text + "',"; updateStr += "workTel='" + stuWorkTelValue.Text + "',"; updateStr += "stuAdd='" + stuAddValue.Text + "',"; updateStr += "stuTel='" + stuTelValue.Text + "',"; updateStr += "stuExp='" + stuExpValue.Text + "',"; updateStr += "stuPrzCrt='" + stuPrzCrtValue.Text + "' where stuID='" + stuID + "'"; int i = operate.sqlCmd(updateStr); if (i == 1) { MessageBox.Show("上传成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("上传失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("数据不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button1_Click(object sender, EventArgs e) { try { if (userName.Text.Trim() == "" || userPwd.Text.Trim() == "") { MessageBox.Show("用户名或密码不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { SqlConnection conn = DBConnections.conn(); conn.Open(); string sqlStr = "select * from userInfo where userName='******' and userPwd='" + userPwd.Text + "'"; SqlCommand cmd = new SqlCommand(sqlStr, conn); SqlDataReader sdr = cmd.ExecuteReader(); sdr.Read(); if (sdr.HasRows) { DataSet ds = operate.getTable(sqlStr); ds.Dispose(); string auth = ds.Tables[0].Rows[0][4].ToString(); string time = DateTime.Now.ToString(); sqlStr = "update userInfo set LastLogin='******' where UserName='******'"; operate.sqlCmd(sqlStr); conn.Close(); switch (auth) { case "admin": MessageBox.Show("登陆成功,您是系统管理", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); frmAdmin fm1 = new frmAdmin(); fm1.name = ds.Tables[0].Rows[0][7].ToString(); fm1.Show(); break; case "student": MessageBox.Show("登陆成功,您是学生用户", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); frmStudent fm2 = new frmStudent(); fm2.stuID = ds.Tables[0].Rows[0][5].ToString(); fm2.Show(); break; case "teacher": MessageBox.Show("登陆成功,您是教师用户", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); frmTeacher fm3 = new frmTeacher(); fm3.name = ds.Tables[0].Rows[0][8].ToString(); fm3.Show(); break; case "corporation": MessageBox.Show("登陆成功,您是企业用户", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); frmCorporation fm4 = new frmCorporation(); fm4.corID = ds.Tables[0].Rows[0][6].ToString(); fm4.Show(); break; } this.Hide(); } else { conn.Close(); MessageBox.Show("登陆失败,请检查帐号或密码是否正确", "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); userPwd.Clear(); } } } catch { MessageBox.Show("错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button1_Click(object sender, EventArgs e) { bool crt = true; foreach (Control control in Controls) { if (control is Label) { Label lb = (Label)control; if (lb.BorderStyle == BorderStyle.FixedSingle) { crt = false; break; } } } if (crt == true) { if (userPwdValue.Text.Trim() != "") { string updateStr = "update userInfo set "; updateStr += "userPwd='" + userPwdValue.Text + "',"; switch (userAuthValue.Text) { case "毕业生": updateStr += "userAuth='student',"; break; case "教师": updateStr += "userAuth='teacher',"; break; case "企业": updateStr += "userAuth='corporation',"; break; case "管理": updateStr += "userAuth='admin',"; break; default: break; } switch (userAuthValue.Text) { case "毕业生": updateStr += "stuID='" + stuIDValue.Text + "'"; break; case "教师": updateStr += "teaName='" + teaNameValue.Text + "'"; break; case "企业": updateStr += "corID='" + corIDValue.Text + "'"; break; case "管理": updateStr += "admName='" + adNameValue.Text + "'"; break; default: break; } updateStr += "where userID='" + userID + "'"; int i = operate.sqlCmd(updateStr); if (i == 1) { MessageBox.Show("修改成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } else { MessageBox.Show("修改失败", "失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("信息不完整或不正确", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void button1_Click(object sender, EventArgs e) { bool crt = true; int count = 0; int fail = 0; foreach (Control control in Controls) { if (control is Label) { Label lb = (Label)control; if (lb.BorderStyle == BorderStyle.FixedSingle) { crt = false; } } } if (crt == true) { int num1 = 0, num2 = 0; int.TryParse(textBox1.Text, out num1); int.TryParse(textBox2.Text, out num2); for (int i = num1; i < num2; ++i) { if (comboBox1.Text == "毕业生") { int num3; int.TryParse(startStuIDValue.Text, out num3); string str = "insert into stuInfo(stuID)values('" + (num3 + i - num1).ToString() + "')"; int n = operate.sqlCmd(str); if (n == 1) { str = "insert into userInfo(userID,userName,userPwd,userAuth,stuID)values('"; str += i.ToString() + "','"; str += (num3 + i - num1).ToString() + "','"; str += textBox3.Text + "','"; str += "student','"; str += (num3 + i - num1).ToString() + "')"; n = operate.sqlCmd(str); if (n == 1) { ++count; } else { ++fail; } } else { ++fail; } } else if (comboBox1.Text == "企业") { int num3; int.TryParse(startStuIDValue.Text, out num3); string str = "insert into corInfo(corID)values('" + (num3 + i - num1).ToString() + "')"; int n = operate.sqlCmd(str); if (n == 1) { str = "insert into userInfo(userID,userName,userPwd,userAuth,corID)values('"; str += i.ToString() + "','"; str += (num3 + i - num1).ToString() + "','"; str += textBox3.Text + "','"; str += "corporation','"; str += (num3 + i - num1).ToString() + "')"; n = operate.sqlCmd(str); if (n == 1) { ++count; } else { ++fail; } } else { ++fail; } } } MessageBox.Show("共插入" + count.ToString() + "条记录,失败" + fail.ToString() + "条", "插入完成", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { } }