软件工程课程设计

发布时间 : 星期四 文章软件工程课程设计更新完毕开始阅读

2、黑盒测试

学生、教师、管理员登录错误:

选课错误:

开课错误:

六、源代码

登录:

private void button1_Click(object sender, EventArgs e) {

CUserInfo User = GetEnityUSer(); CLoginPRO log = new CLoginPRO(); string Res=log.LogSelectUser(User); if (Res == \

MessageBox.Show(\ else if (Res == String.Empty)

MessageBox.Show(\ else {

string[] temp = Res.Split('|'); User.usertype = temp[3];

User.usertime = DateTime.Parse(temp[4]); GlobaInfo.UserInfo = User;

// MessageBox.Show(temp[0] + temp[1] + temp[2] + temp[3] + temp[4]);

// MessageBox.Show(GlobaInfo.UserInfo.userno + GlobaInfo.UserInfo.userpsd + GlobaInfo.UserInfo.usertime.ToString() + temp[3] + GlobaInfo.UserInfo.usertype);

MessageBox.Show(\登录成功!您的权限是:\+ GlobaInfo.UserInfo.usertype);

if (GlobaInfo.UserInfo.usertype == \管理员\ {

AdminMainForm AdminForm = new AdminMainForm(); AdminForm.Show(); this.Hide(); }

if (GlobaInfo.UserInfo.usertype == \教师\ {

TeaMainForm TeaMain = new TeaMainForm(); TeaMain.Show(); this.Hide();

}

if (GlobaInfo.UserInfo.usertype == \学生\ {

StuMainForm StuForm = new StuMainForm(); StuForm.Show(); this.Hide(); } } }

修改密码:

private void button1_Click(object sender, EventArgs e) {

if (!CheckOldWithNew()) return; CUserInfo User=GetUserEnity(); if (NewPsdIsDiffOld()) {

if (CAdminPRO.UpdateUserInfo(User)) {

GlobaInfo.UserInfo.userpsd = txtpsd.Text; MessageBox.Show(\密码修改成功!\ } else {

MessageBox.Show(\发生错误,请稍候重试试!\ } } else {

MessageBox.Show(\原密码输入错误!\ } }

private bool NewPsdIsDiffOld() {

if (txtOldPsd.Text == GlobaInfo.UserInfo.userpsd) return true; else

return false; }

private CUserInfo GetUserEnity() {

CUserInfo user = new CUserInfo();

user.userno = GlobaInfo.UserInfo.userno; user.userpsd = txtpsd.Text;

// user.usertime = DateTime.Parse(dtpAdmitime.Text); user.usertime = DateTime.Today;

user.usertype = GlobaInfo.UserInfo.usertype; return user; }

private bool CheckOldWithNew() {

if (txtpsd.Text == \ {

MessageBox.Show(\新密码或确认新密码不能为空!\ return false; }

if (txtpsd.Text !=txtCompsd.Text) {

MessageBox.Show(\两次输入的密码不等!\ return false; }

return true; }

学生选课界面:

private void 选课ToolStripMenuItem_Click(object sender, EventArgs e) {

StuSelCou StuCou = new StuSelCou(); StuCou.MdiParent = this; StuCou.Show(); }

private void 我的课程列表ToolStripMenuItem_Click(object sender, EventArgs e) {

MyCourse myCourse = new MyCourse(); myCourse.MdiParent = this; myCourse.Show(); }

private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e) {

AlterMyPsdForm AlterMyPsd = new AlterMyPsdForm(); AlterMyPsd.MdiParent = this; AlterMyPsd.Show(); }

private void 注销登录ToolStripMenuItem_Click(object sender, EventArgs e) {

MyLogOut.myLogOut(this);

联系合同范文客服:xxxxx#qq.com(#替换为@)