教务管理员操作流程

2019-03-22 18:48

教务管理员操作流程

1、

使用Admin账号登陆——教务管理员系统

代码区域:

int count = 0;

bool isValidUser = false; if (loginType == \教务管理员\) {

string sql = string.Format(\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) {

message = \用户名或密码不存在!\; }

else 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 = \; try {

SqlCommand command=new SqlCommand(sql,DBHelper.connection); DBHelper.connection.Open();

SqlDataReader reader=command.ExecuteReader(); while(reader.Read()){

string gradeName=(string)reader[0]; 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(\GradeName='{0}'\,cboGrade.Text);

SqlCommand command = new SqlCommand(sql, DBHelper.connection); try {

DBHelper.connection.Open();

SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) {

gradeId = (int)reader[0]; }

reader.Close();

}

catch (Exception ex) {

MessageBox.Show(\操作数据库出错\); Console.WriteLine(ex.Message); } finally {

DBHelper.connection.Close(); }

sql = \ +gradeId; command.CommandText = sql; try {

DBHelper.connection.Open();

SqlDataReader reader = command.ExecuteReader();

string className = \; cboClass.Items.Clear(); while (reader.Read()) {

className = (string)reader[\]; 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 (教师信息添加窗体)

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(); } } }

新增教师信息→弹出窗口(教师信息添加)→Teacher表

保存按钮代码如下:

查询修改信息→学生信息→查询及删除信息(可以进行模糊查询)


教务管理员操作流程.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:汽车故障诊断系统的设计与实现

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: