《(2020年)流程管理流程再造教务管理员操作流程》由会员分享,可在线阅读,更多相关《(2020年)流程管理流程再造教务管理员操作流程(9页珍藏版)》请在金锄头文库上搜索。
1、教务管理员操作流程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();
2、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 =
3、 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 = n
4、ew 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 (Exce
5、ption 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.
6、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()
7、!= ) 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; reade
8、r.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()