教务管理员操作流程_第1页
教务管理员操作流程_第2页
教务管理员操作流程_第3页
教务管理员操作流程_第4页
教务管理员操作流程_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、【教务管理员操作流程】使用Admin账号登陆教务治理员系统代码区域:int count = 0;bool isValidEser = false:if (loginType = *教务治理员)string sql = string. Format (select count (*) from Admin where Loginld=* 0) AND LoginPwd=* U loginld, loginPwd);trySqlCommand command = new SqlCommandCsql, DBHelper. connection): DBHelper.connection. Open

2、();count = (int)command, EsecuteScalar():if (count = 1)isValidCser = true;elseindex;if (index = 3)Application. Exit C);isValidCser = false;catch (Exception ex)message = ex. Message;Console. WriteLine(ex. Message);finallyDBHelper.connection.Closet);if (cboType, Test = *教务治理员)Adm inForm adm inForm = n

3、ew AdminFormO ; adminForm, Show);return true:成功进入后能够进行AdminForm. cs(教务治理员窗体)用户j台理一新増用户一新增学生信息(代码如下:)AddstudentForm addstudnetForm = new AddStudentForm(); addstudnetForm. MdiParent = this;addstudnetForm. ShowO;-弹出窗口(学生信息添加一Student表AdminStudentForm. cs储存按钮代码如下:if (TianJiaO)trySqlCommand command = new

4、SqlCommandCsql, DBHelper. connection);DBHelper. connection. Open();int result = command, EsecuteXonOuery();if (result != 1)MessageBox. Show MessageBoxButtons. OK.Message&oxicon. Information);catch (Exception ex)Uessage&ox.Show(ex. Message);finally DBHelper.connection. Close 0;private void AddStudent

5、Form_Load(object sender, EventArgs e)string sql = select gradeXame from Grade*;try SqlCommand command=new SqlCommand(sql,DBHelper. connection);DBHelper. connection. Open();SqlDataReader reader=command. ExecuteReader();while (reader, ReadO) string gradeXame= (string) reader O;cboGrade, Items, Add(gra

6、deXame);reader. Close();catch(Exception ex)Message&ox.Show(ex. Message);JfinallytDBHelper.connection. Close();private void cboGrade_SelectedIndexChanged(object sender* EventArgs e)if (cboGrade, Text. TrimO != *int gradeld = !;string sql = string. Format(select Gradeld from Grade whereGradeName= O ,

7、cboGrade. Text);SqlCommand command = new SqlCommandCsql, DBHelper. connection): tryDBHelper. connection. Open();SqlDataReader reader = command. ExecuteReader(); if (reader, ReadO)gradeld = (int)readerO;reader. Close();catch (Exception ex)MessageBox. Show; while (reader, ReadO)className = (string)rea

8、der*ClassXame*; cboClass. Items, Add(classXame);reader. Close ();catch (Exception ex)MessageBox. Show*操作数据库出错); Console. WriteLine(ex. Message);finallyDBHelper. connection. Close 0;private void txtStudentFassvord_TextChanged(object sender, EventArgs e)AdminTeacherForm. cs (教师信息添加窗体新增教师信息一弹出窗口(教师信息添加

9、)一Teacher表 储存按钮代码如下:if (TianJiaO)trySqlCommand command = new SqlCommandCsql, DBHelper. connection): DBHelper. connection. Open();int result = command, EsecuteXonQuery ();if (result != 1)MessageBox. Show*添加失败 *输入提示.MessageBoxButtons. OK,MessageBoxIcon. Information);elseMessageBox. Show *输入提示 MessageB

10、oxButtons. OK,MessageBoxIcon. Information);catch (Exception ex)MessageBox. Show*操作数据库出错:*输入提示:MessageBoxButtons. OK,UessageBoxIcon. Information);Console. ffriteLine(ex. Message);finallyDBHelper.connection. Closet);查询修改信息-学生信息-査询及删除信息(能够进行模糊査询SearchStudentForm. cs(学生査询及删除信息窗体)査询按賀代码:if (txtName. Test

11、 = *)Message&ox. Show(*请输入用户名输入提示 MessageBoxButtons. OK.MessageBoxIcon. Information);txtName, Focus ();else SearchStudent ();private void tsniiDelete_Click(object sender, EventArgs e)if (listViewl. Selecteditems- Count = 0)Message&ox. Show(*您没有选择任何用户:*输入提示:MessageBoxButtons. OK,MessageBoxIcon. Infor

12、mation);else DialogResult choice = MessageBox. Show(确定箜删除该用户吗警告, MessageBoxButtons. OK, MessageBoxIcon. Informat ion);if (choice = DialogResult. OK) int result = 0;trystring sql = string. Format(*delete Student where StudentId=0 (int)listViewl, SelecteditemsO. Tag);SqlCommand command = new SqlComman

13、dCsql, DBHelper. connection):DBHelper. connection. Open();result = command, EsecuteXonQuery();catch (Exception ex)MessageBox. Show (ex. Message);finally DBHelper.connection. Closet);if (result 1)MessageBox. Show*删除失败 *输入提示.MessageBoxButtons.Message&oxicon. Exclamation);else MessageBox. Show MessageB

14、oxButtons.Message&oxicon. Information);SearchStudent ();UpdateStudentForm. cs(学生更新信息窗体)储存信息按钮代码:DialogResult result = MessageBcx. Show(*确实要将修改储存到数据库吗? *, *输入提示:Me ssageBoxBut tons. OK, MessageBoxIcon. Informat ion);if (result = DialogResult. OK)new SqlCommandSuiIder(daxaAdapter);Student*);输入提示* Mess

15、ageBoxSuxtons. OK,输入提示 MessageBoxButtons. OK,SqlCommandBuilder buiIder = dataAdapter. Update(dataSet, Message&ox. Show(*储 成功* MessageBoxIcon. Information);elseMessageBox. Show(*储存失败.MessageBoxIcon. Information);SearchTeacherForm. cs(教师査询及删除借息窗体)査询按钮代码:if (txtName, Text = *)MessageBox. Show(*请输入用户名输入

16、提示MessageBoxButtons. OK.MessageBoxIcon. Information);txtName, Focus ();elseSearchTeacher0;private void btnExit_Click(object sender, EventArgs e)this. CloseO ;private void tsniiDeletel_Click(object sender, EventArgs e)if (listViewl. Selecteditems, Count = 0)Message&ox. Show(*您没有选择任何用户:*输入提示:MessageBo

17、xButtons. OK, MessageBoxIcon. Information);else DialogResult choice = MessageBcx. Show(*确世翌删除该用户吗*普告, MessageBoxButtons. OK, MessageBexIcon. Informat ion);if (choice = DialogResult. OK) int result = 0;trystring sql = string. Format(*delete Teacher where TeacherId=0 (int)listViewl, SelectedlternsO. T

18、ag);SqlCommand command = new SqlCommandCsql, DBHelper. connection);DBHelper. connection. Open();result = command, EsecuteXonOuery();catch (Exception ex)MessageBox.Show(ex. Message);finally DBHelper.connection. Close 0;if (result 1)MessageBox. Show MessageBoxButtons.MessageBoxIcon. Exclamation);else MessageBox. Show(*删除成功输入提示 MessageBoxButtons. OK.Message&oxicon. Information);SearchTeacher ();UpdateTeache

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论