【教务管理员操作流程】

上传人:陈** 文档编号:97743400 上传时间:2022-05-27 格式:DOCX 页数:9 大小:23.54KB
返回 下载 相关 举报
【教务管理员操作流程】_第1页
第1页 / 共9页
【教务管理员操作流程】_第2页
第2页 / 共9页
【教务管理员操作流程】_第3页
第3页 / 共9页
点击查看更多>>
资源描述
编号:时间:2021年x月x日书山有路勤为径,学海无涯苦作舟页码:第9页 共9页教务管理员操作流程1、 使用Admin账号登陆教务管理员系统代码区域:int count = 0; bool isValidUser = false; if (loginType = 教务管理员) string sql = string.Format(select count(*) from Admin where LoginId=0 AND LoginPwd=1, loginId, loginPwd); try SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); count = (int)command.ExecuteScalar(); if (count = 1) isValidUser = true; else index+; if (index = 3) Application.Exit(); isValidUser = false; catch (Exception ex) message = ex.Message; Console.WriteLine(ex.Message); finally DBHelper.connection.Close(); if (cboType.Text = 教务管理员) AdminForm adminForm = new AdminForm(); adminForm.Show(); return true; 成功进入后可以进行AdminForm.cs (教务管理员窗体)用户管理新增用户新增学生信息(代码如下:) AddStudentForm addstudnetForm = new AddStudentForm(); addstudnetForm.MdiParent = this; addstudnetForm.Show();弹出窗口(学生信息添加)Student表AdminStudentForm.cs保存按钮代码如下: if (TianJia() try SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); int result = command.ExecuteNonQuery(); if (result != 1) MessageBox.Show(添加失败, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(添加成功, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); private void AddStudentForm_Load(object sender, EventArgs e) string sql = select gradeName from Grade; try SqlCommand command=new SqlCommand(sql,DBHelper.connection); DBHelper.connection.Open(); SqlDataReader reader=command.ExecuteReader(); while(reader.Read() string gradeName=(string)reader0; cboGrade.Items.Add(gradeName); reader.Close(); catch(Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); private void cboGrade_SelectedIndexChanged(object sender, EventArgs e) if (cboGrade.Text.Trim() != ) int gradeId = -1; string sql = string.Format(select GradeId from Grade where GradeName=0,cboGrade.Text); SqlCommand command = new SqlCommand(sql, DBHelper.connection); try DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.Read() gradeId = (int)reader0; reader.Close(); catch (Exception ex) MessageBox.Show(操作数据库出错); Console.WriteLine(ex.Message); finally DBHelper.connection.Close(); sql = SELECT ClassName FROM Class WHERE GradeId= +gradeId; command.CommandText = sql; try DBHelper.connection.Open(); SqlDataReader reader = command.ExecuteReader(); string className = ; cboClass.Items.Clear(); while (reader.Read() className = (string)readerClassName; cboClass.Items.Add(className); reader.Close(); catch (Exception ex) MessageBox.Show(操作数据库出错); Console.WriteLine(ex.Message); finally DBHelper.connection.Close(); private void txtStudentPassword_TextChanged(object sender, EventArgs e) AdminTeacherForm.cs (教师信息添加窗体) 新增教师信息弹出窗口(教师信息添加)Teacher表保存按钮代码如下:if (TianJia() try SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); int result = command.ExecuteNonQuery(); if (result != 1) MessageBox.Show(添加失败, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(添加成功, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); catch (Exception ex) MessageBox.Show(操作数据库出错, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); Console.WriteLine(ex.Message); finally DBHelper.connection.Close(); 查询修改信息学生信息查询及删除信息(可以进行模糊查询)SearchStudentForm.cs (学生查询及删除信息窗体)查询按钮代码:if (txtName.Text = ) MessageBox.Show(请输入用户名, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); else SearchStudent(); private void tsmiDelete_Click(object sender, EventArgs e) if (listView1.SelectedItems.Count = 0) MessageBox.Show(您没有选择任何用户, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else DialogResult choice = MessageBox.Show(确定要删除该用户吗, 警告, MessageBoxButtons.OK, MessageBoxIcon.Information); if (choice = DialogResult.OK) int result = 0; try string sql = string.Format(delete Student where StudentId=0, (int)listView1.SelectedItems0.Tag); SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); result = command.ExecuteNonQuery(); catch (Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); if (result 1) MessageBox.Show(删除失败, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else MessageBox.Show(删除成功, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); SearchStudent(); UpdateStudentForm.cs (学生更新信息窗体)保存信息按钮代码:DialogResult result = MessageBox.Show(确实要将修改保存到数据库吗?, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); if (result = DialogResult.OK) SqlCommandBuilder builder = new SqlCommandBuilder(dataAdapter); dataAdapter.Update(dataSet, Student); MessageBox.Show(保存成功, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(保存失败, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); SearchTeacherForm.cs (教师查询及删除信息窗体)查询按钮代码:if (txtName.Text = ) MessageBox.Show(请输入用户名, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); else SearchTeacher(); private void btnExit_Click(object sender, EventArgs e) this.Close(); private void tsmiDelete1_Click(object sender, EventArgs e) if (listView1.SelectedItems.Count = 0) MessageBox.Show(您没有选择任何用户, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else DialogResult choice = MessageBox.Show(确定要删除该用户吗, 警告, MessageBoxButtons.OK, MessageBoxIcon.Information); if (choice = DialogResult.OK) int result = 0; try string sql = string.Format(delete Teacher where TeacherId=0, (int)listView1.SelectedItems0.Tag); SqlCommand command = new SqlCommand(sql, DBHelper.connection); DBHelper.connection.Open(); result = command.ExecuteNonQuery(); catch (Exception ex) MessageBox.Show(ex.Message); finally DBHelper.connection.Close(); if (result 1) MessageBox.Show(删除失败, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else MessageBox.Show(删除成功, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); SearchTeacher(); UpdateTeacherForm.cs (教师更新信息窗体)保存信息按钮代码:DialogResult result = MessageBox.Show(确实要将修改保存到数据库吗?, 输入提示,MessageBoxButtons.OK, MessageBoxIcon.Information); if (result = DialogResult.OK) SqlCommandBuilder builder = new SqlCommandBuilder(dataAdapter); dataAdapter.Update(dataSet, Teacher); MessageBox.Show(保存成功, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(保存失败, 输入提示, MessageBoxButtons.OK, MessageBoxIcon.Information); 娱乐通过引用完成操作退出系统 重新登录(代码如下:) LoginForm fm1 = new LoginForm(); this.Hide(); fm1.Show();帮助说明版权说明(HelpForm.cs 帮助窗体)帮助信息(MessageBox.Show(欢迎使用帮助系统n本系统新建用户初始密码:n【123】, 帮助信息);)运行屏保(引用外部文件)第 9 页 共 9 页
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 工作总结


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!