1、数据库原理与设计大作业源代码数据库原理与设计大作业源代码(1) 用户登录界面运行超市管理信息系统后,首先进入用户登录界面,用户输入用户名和密码后,系统进行验证,验证通过进入程序的主界面。在进行系统登录过程中,登录模块将调用数据库里的用户信息表,并对用户名和密码进行验证,只有输入了正确的账号和密码后,系统登录才会成功。在登录模块中,对系统的尝试登录次数进行了限制,禁止用户无终止的进行系统登录尝试,在本系统中,当用户对系统的三次登录失败后,系统将自动机制登录,突出登录模块。并在输入了错误的或者是不存在的账户和密码时,系统会给出出错信息提示,指明登录过程中的错误输入或者错误操作,以便用户进行正确的登
2、录。登录界面如图5-2所示。 图5-2 登录界面主要实现代码如下:/登录 private void radBtnOk_Click(object sender, EventArgs e) try if (radTxtBoxUser.Text.Trim() = ) this.radLbInfo.Text = 请输入您的用户名!; else if (radTxtBoxPsw.Text.Trim() = ) this.radLbInfo.Text = 请输入您的密码!; else commandUnit com = new commandUnit(); string str = select * fr
3、om UserInfo where loginNo = + radTxtBoxUser.Text.ToString() + ; DataTable table = com.GetDataSet(str); if (table.Rows.Count 0) _currentUser = radTxtBoxUser.Text; _currentPsw = radTxtBoxPsw.Text; IsLogin = true; this.Close(); else this.radLbInfo.Text = 密码错误!; radTxtBoxPsw.Text = ; catch (System.Excep
4、tion ex) throw ex; (2) 主界面系统登录成功后,进入主界面菜单。主界面如图5-3所示。图5-3 主界面(3) 修改密码界面成功登录系统后,单击“用户信息管理”菜单的“修改密码”,可以进入“修改密码”界面,进行密码的修改。修改密码界面如图5-4所示。图5-4 修改密码界面主要实现代码如下:/修改密码protected virtual void radBtnOk_Click(object sender, EventArgs e) if (radTxtBoxOldPsw.Text = null | radTxtBoxOldPsw.Text.Trim() = ) MessageBo
5、x.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;
6、 string currPwd = RFrmLogin.CurrentPsw; if (currPwd = radTxtBoxOldPsw.Text.Trim() if (isSame() commandUnit com = new commandUnit(); string str = update UserInfo set passWord = + radTxtBoxEnterPsw.Text.ToString() + where loginNo = + RFrmLogin.CurrentUser + ; if (com.ExecuteCommand(str) 0) MessageBox.
7、Show(密码修改成功!。, 提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(密码修改失败,请联系管理员!。, 提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(两次密码输入不一致!, 提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(输入密码错误!, 提醒, MessageBoxButto
8、ns.OK, MessageBoxIcon.Information); (4) 修改密码界面管理员成功登录系统后,单击“用户信息管理”菜单的“修改权限”,可以进入“修改权限”界面,进行员工权限的修改。修改权限界面如图5-5所示。 图5-5 修改权限界面主要实现代码如下:/修改权限protected override void radBtnOk_Click(object sender, EventArgs e) if (radTxtBoxOldPsw.Text = null | radTxtBoxOldPsw.Text.Trim() = ) MessageBox.Show(请输入用户名!。, 提
9、醒, MessageBoxButtons.OK, MessageBoxIcon.Information); return; if (radComBoxPower.Text = null | radComBoxPower.Text.Trim() = ) MessageBox.Show(请为用户设置权限!。, 提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); return; commandUnit com = new commandUnit(); string str = update UserInfo set power = + rad
10、ComBoxPower.SelectedValue.ToString() + where loginNo = + radTxtBoxOldPsw.Text.ToString() + ; if (com.ExecuteCommand(str) 0) MessageBox.Show(权限修改成功!。, 提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show(权限修改失败,请联系管理员!。, 提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); (5
11、) 编辑员工信息界面管理员成功登录系统后,单击“基本信息管理”菜单的“员工信息”,可以进入“查看员工信息”界面和“编辑员工信息”界面,“查看员工信息”界面只能查看员工信息,“编辑员工信息”界面进行员工信息的修改、添加、删除等功能。编辑员工信息界面如图5-6所示。图5-6 编辑员工信息界面主要实现代码如下:/保存 protected virtual void tSBtnSave_Click(object sender, EventArgs e) try if (IsVilude() bool isSuccess = false; commandUnit com = new commandUnit
12、(); EmployeeModel emp; for (int j = 0; j radWithGV.RowCount; j+) emp = new EmployeeModel(); #region 同步数据 if (radWithGV.Rowsj.Tag != null) emp = radWithGV.Rowsj.Tag as EmployeeModel; else emp.EmployeeNo = radWithGV.Rowsj.CellsemployeeNo.Value.ToString(); emp.Name = radWithGV.Rowsj.Cellsname.Value.ToS
13、tring(); emp.Sex = radWithGV.Rowsj.Cellssex.Value.ToString(); emp.IdCard = radWithGV.Rowsj.CellsidCard.Value.ToString(); emp.Duty = radWithGV.Rowsj.Cellsduty.Value.ToString(); emp.Note = radWithGV.Rowsj.Cellsnote.Value.ToString(); emp.IsNew = true; #endregion if (emp.IsNew) string str = select * fro
14、m EmployeeInfo where employeeNo = + emp.EmployeeNo + ; DataTable dtable = com.GetDataSet(str); if (dtable.Rows.Count 0) _isSaved = true; isSuccess = true; emp.IsNew = false; radWithGV.Rowsj.Tag = emp; else MessageBox.Show(该员工已存在,请审核信息!); else if (emp.IsModified) string strSql = update EmployeeInfo s
15、et name = + emp.Name + ,sex = + emp.Sex + ,idCard = + emp.IdCard + ,duty = + emp.Duty + ,note = + emp.Note + where employeeNo = + emp.EmployeeNo + ; if (com.ExecuteCommand(strSql) 0) _isSaved = true; isSuccess = true; emp.IsModified = false; radWithGV.Rowsj.Tag = emp; else continue; if (isSuccess) M
16、essageBox.Show(保存成功!); else MessageBox.Show(数据非法!); catch (System.Exception ex) throw ex; (6) 职务信息界面管理员成功登录系统后,单击“基本信息管理”菜单的“职务信息”,可以进入“职务信息”界面 ,“职务信息”界面进行职务信息的修改、添加、删除等功能。职务信息界面如图5-7所示。图5-7 职务信息界面主要实现代码如下: protected override void tSBtnDelete_Click(object sender, EventArgs e) DutyModel employee = th
17、is.radWithGV.CurrentRow.Tag as DutyModel; if (employee != null) if (!employee.IsNew) commandUnit com = new commandUnit(); string numRow = radWithGV.CurrentRow.CellsdutyId.Value.ToString(); string str = delete from dutyInfo where dutyId = + numRow + ; if (com.ExecuteCommand(str) 0) this.radWithGV.Rows.Remove(radWithGV.CurrentRow as GridViewDataRowInfo); IsSaved = true; else this.radWithGV.Rows.Remove(radWithGV.CurrentRow as GridViewDataRowInfo);
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1