数据库原理与设计大作业源代码.docx

上传人:b****2 文档编号:12917075 上传时间:2023-04-22 格式:DOCX 页数:14 大小:155.34KB
下载 相关 举报
数据库原理与设计大作业源代码.docx_第1页
第1页 / 共14页
数据库原理与设计大作业源代码.docx_第2页
第2页 / 共14页
数据库原理与设计大作业源代码.docx_第3页
第3页 / 共14页
数据库原理与设计大作业源代码.docx_第4页
第4页 / 共14页
数据库原理与设计大作业源代码.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

数据库原理与设计大作业源代码.docx

《数据库原理与设计大作业源代码.docx》由会员分享,可在线阅读,更多相关《数据库原理与设计大作业源代码.docx(14页珍藏版)》请在冰豆网上搜索。

数据库原理与设计大作业源代码.docx

数据库原理与设计大作业源代码

数据库原理与设计大作业源代码

(1)用户登录界面

运行超市管理信息系统后,首先进入用户登录界面,用户输入用户名和密码后,系统进行验证,验证通过进入程序的主界面。

在进行系统登录过程中,登录模块将调用数据库里的用户信息表,并对用户名和密码进行验证,只有输入了正确的账号和密码后,系统登录才会成功。

在登录模块中,对系统的尝试登录次数进行了限制,禁止用户无终止的进行系统登录尝试,在本系统中,当用户对系统的三次登录失败后,系统将自动机制登录,突出登录模块。

并在输入了错误的或者是不存在的账户和密码时,系统会给出出错信息提示,指明登录过程中的错误输入或者错误操作,以便用户进行正确的登录。

登录界面如图5-2所示。

图5-2登录界面

主要实现代码如下:

//登录

privatevoidradBtnOk_Click(objectsender,EventArgse)

{

try

{

if(radTxtBoxUser.Text.Trim()=="")

{

this.radLbInfo.Text="请输入您的用户名!

";

}

elseif(radTxtBoxPsw.Text.Trim()=="")

{

this.radLbInfo.Text="请输入您的密码!

";

}

else

{

commandUnitcom=newcommandUnit();

stringstr=@"select*fromUserInfowhereloginNo='"+radTxtBoxUser.Text.ToString()+"'";

DataTabletable=com.GetDataSet(str);

if(table.Rows.Count<=0)

{

this.radLbInfo.Text="用户名不存在!

";

radTxtBoxUser.Text="";

radTxtBoxPsw.Text="";

return;

}

str=@"select*fromUserInfowhereloginNo='"+radTxtBoxUser.Text.ToString()+"'andpassWord='"+radTxtBoxPsw.Text.ToString()+"'";

DataTabletableUser=com.GetDataSet(str);

if(tableUser.Rows.Count>0)

{

_currentUser=radTxtBoxUser.Text;

_currentPsw=radTxtBoxPsw.Text;

IsLogin=true;

this.Close();

}

else

{

this.radLbInfo.Text="密码错误!

";

radTxtBoxPsw.Text="";

}

}

}

catch(System.Exceptionex)

{

throwex;

}

}

(2)主界面

系统登录成功后,进入主界面菜单。

主界面如图5-3所示。

图5-3主界面

(3)修改密码界面

成功登录系统后,单击“用户信息管理”菜单的“修改密码”,可以进入“修改密码”界面,进行密码的修改。

修改密码界面如图5-4所示。

图5-4修改密码界面

主要实现代码如下:

//修改密码

protectedvirtualvoidradBtnOk_Click(objectsender,EventArgse)

{

if(radTxtBoxOldPsw.Text==null||radTxtBoxOldPsw.Text.Trim()=="")

{

MessageBox.Show("请输入旧密码!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

return;

}

if(radTxtBoxNewPsw.Text==null||radTxtBoxNewPsw.Text.Trim()==""

||radTxtBoxEnterPsw.Text==null||radTxtBoxEnterPsw.Text.Trim()=="")

{

MessageBox.Show("请输入新密码!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

return;

}

stringcurrPwd=RFrmLogin.CurrentPsw;

if(currPwd==radTxtBoxOldPsw.Text.Trim())

{

if(isSame())

{

commandUnitcom=newcommandUnit();

stringstr=@"updateUserInfosetpassWord='"+radTxtBoxEnterPsw.Text.ToString()+"'whereloginNo='"+RFrmLogin.CurrentUser+"'";

if(com.ExecuteCommand(str)>0)

{

MessageBox.Show("密码修改成功!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

else

{

MessageBox.Show("密码修改失败,请联系管理员!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

}

else

{

MessageBox.Show("两次密码输入不一致!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

}

else

{

MessageBox.Show("输入密码错误!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

}

(4)修改密码界面

管理员成功登录系统后,单击“用户信息管理”菜单的“修改权限”,可以进入“修改权限”界面,进行员工权限的修改。

修改权限界面如图5-5所示。

图5-5修改权限界面

主要实现代码如下:

//修改权限

protectedoverridevoidradBtnOk_Click(objectsender,EventArgse)

{

if(radTxtBoxOldPsw.Text==null||radTxtBoxOldPsw.Text.Trim()=="")

{

MessageBox.Show("请输入用户名!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

return;

}

if(radComBoxPower.Text==null||radComBoxPower.Text.Trim()=="")

{

MessageBox.Show("请为用户设置权限!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

return;

}

commandUnitcom=newcommandUnit();

stringstr=@"updateUserInfosetpower='"+radComBoxPower.SelectedValue.ToString()+"'whereloginNo='"+radTxtBoxOldPsw.Text.ToString()+"'";

if(com.ExecuteCommand(str)>0)

{

MessageBox.Show("权限修改成功!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

else

{

MessageBox.Show("权限修改失败,请联系管理员!

","提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);

}

}

(5)编辑员工信息界面

管理员成功登录系统后,单击“基本信息管理”菜单的“员工信息”,可以进入“查看员工信息”界面和“编辑员工信息”界面,“查看员工信息”界面只能查看员工信息,“编辑员工信息”界面进行员工信息的修改、添加、删除等功能。

编辑员工信息界面如图5-6所示。

图5-6编辑员工信息界面

主要实现代码如下:

//保存

protectedvirtualvoidtSBtnSave_Click(objectsender,EventArgse)

{

try

{

if(IsVilude())

{

boolisSuccess=false;

commandUnitcom=newcommandUnit();

EmployeeModelemp;

for(intj=0;j

{

emp=newEmployeeModel();

#region同步数据

if(radWithGV.Rows[j].Tag!

=null)

{

emp=radWithGV.Rows[j].TagasEmployeeModel;

}

else

{

emp.EmployeeNo=radWithGV.Rows[j].Cells["employeeNo"].Value.ToString();

emp.Name=radWithGV.Rows[j].Cells["name"].Value.ToString();

emp.Sex=radWithGV.Rows[j].Cells["sex"].Value.ToString();

emp.IdCard=radWithGV.Rows[j].Cells["idCard"].Value.ToString();

emp.Duty=radWithGV.Rows[j].Cells["duty"].Value.ToString();

emp.Note=radWithGV.Rows[j].Cells["note"].Value.ToString();

emp.IsNew=true;

}

#endregion

if(emp.IsNew)

{

stringstr="select*fromEmployeeInfowhereemployeeNo='"+emp.EmployeeNo+"'";

DataTabledtable=com.GetDataSet(str);

if(dtable.Rows.Count<=0)

{

str=@"insertintoEmployeeInfovalues('"+emp.EmployeeNo+"','"+emp.Name+"','"+emp.Sex+"','"+emp.IdCard+"','"+emp.Duty+"','"+emp.Note+"')";

if(com.ExecuteCommand(str)>0)

{

_isSaved=true;

isSuccess=true;

emp.IsNew=false;

radWithGV.Rows[j].Tag=emp;

}

}

else

{

MessageBox.Show("该员工已存在,请审核信息!

");

}

}

elseif(emp.IsModified)

{

stringstrSql=@"updateEmployeeInfosetname='"+emp.Name+"',sex='"+emp.Sex+"',idCard='"+emp.IdCard+"',duty='"

+emp.Duty+"',note='"+emp.Note+"'whereemployeeNo='"+emp.EmployeeNo+"'";

if(com.ExecuteCommand(strSql)>0)

{

_isSaved=true;

isSuccess=true;

emp.IsModified=false;

radWithGV.Rows[j].Tag=emp;

}

}

else

continue;

}

if(isSuccess)

{

MessageBox.Show("保存成功!

");

}

}

else

{

MessageBox.Show("数据非法!

");

}

}

catch(System.Exceptionex)

{

throwex;

}

}

 

(6)职务信息界面

管理员成功登录系统后,单击“基本信息管理”菜单的“职务信息”,可以进入“职务信息”界面,“职务信息”界面进行职务信息的修改、添加、删除等功能。

职务信息界面如图5-7所示。

图5-7职务信息界面

主要实现代码如下:

protectedoverridevoidtSBtnDelete_Click(objectsender,EventArgse)

{

DutyModelemployee=this.radWithGV.CurrentRow.TagasDutyModel;

if(employee!

=null)

{if(!

employee.IsNew)

{commandUnitcom=newcommandUnit();

stringnumRow=radWithGV.CurrentRow.Cells["dutyId"].Value.ToString();

stringstr="deletefromdutyInfowheredutyId='"+numRow+"'";

if(com.ExecuteCommand(str)>0)

{

this.radWithGV.Rows.Remove(radWithGV.CurrentRowasGridViewDataRowInfo);

IsSaved=true;

}

}

else

{

this.radWithGV.Rows.Remove(radWithGV.CurrentRowasGridViewDataRowInfo);

}

}

}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 小升初

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1