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

2018-11-28 18:46

图5-5 修改权限界面

主要实现代码如下:

//修改权限

protected override void radBtnOk_Click(object sender, EventArgs e) {

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

commandUnit com = new commandUnit();

string str = @\ +

radComBoxPower.SelectedValue.ToString() + \ + 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 编辑员工信息界面

主要实现代码如下:

//保存

protected virtual void tSBtnSave_Click(object sender, EventArgs e)

{

try {

if (IsVilude())

{

bool isSuccess = false;

commandUnit com = new commandUnit(); EmployeeModel emp;

for (int j = 0; j < radWithGV.RowCount; j++) {

emp = new EmployeeModel(); #region 同步数据

if (radWithGV.Rows[j].Tag != null) {

emp = radWithGV.Rows[j].Tag as EmployeeModel;

} else {

emp.EmployeeNo =

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

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

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

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

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

radWithGV.Rows[j].Cells[\].Value.ToString(); emp.IsNew = true;

}

#endregion

if (emp.IsNew) {

string str = \where employeeNo = '\ + emp.EmployeeNo + \;

DataTable dtable = com.GetDataSet(str); if (dtable.Rows.Count <= 0) {

str = @\

values('\ + 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(\该员工已存在,请审核信息!\);

} }

else if (emp.IsModified) {

string strSql = @\name = '\ + emp.Name + \= '\ + emp.Sex + \= '\ + emp.IdCard + \

+ emp.Duty + \ + emp.Note + \ + 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.Exception ex) {

throw ex;

} }

(6) 职务信息界面

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

图5-7 职务信息界面

主要实现代码如下:

protected override void tSBtnDelete_Click(object sender, EventArgs e)

{

DutyModel employee = this.radWithGV.CurrentRow.Tag as DutyModel;

if (employee != null) { if (!employee.IsNew)

{commandUnit com = new commandUnit(); string numRow =

radWithGV.CurrentRow.Cells[\].Value.ToString(); string str = \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); } } }


数据库原理与设计大作业源代码(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2013公共关系

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

马上注册会员

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