/// <summary> /// 删除角色 /// </summary> void DelRole() { if (this.gvRole.SelectedRows.Count == 0) { MessageBox.Show("请在列表中选择要【回收角色】的医师。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string empName = this.gvRole.SelectedRows[0].Cells["empname"].Value.ToString(); string roleName = this.gvRole.SelectedRows[0].Cells["rolename"].Value.ToString(); if (Convert.ToInt32(this.gvRole.SelectedRows[0].Cells["status"].Value) == 2) { MessageBox.Show("医师 【" + empName + "】 角色 【" + roleName + "】 已回收。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("确认回收:医师 【" + empName + "】 角色 【" + roleName + "】 ??", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } EntityLogSetCaseRole vo = new EntityLogSetCaseRole(); vo.mapId = this.gvRole.SelectedRows[0].Cells["mapid"].Value.ToString(); vo.recycleOperId = this.LoginInfo.m_strEmpID; vo.serNo = Convert.ToDecimal(this.gvRole.SelectedRows[0].Cells["serno"].Value.ToString()); clsDcl_Charge svc = new clsDcl_Charge(); if (svc.DelCaseRole(vo) > 0) { MessageBox.Show("回收角色成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.gvRole.Rows.Remove(this.gvRole.SelectedRows[0]); } else { MessageBox.Show("回收角色失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } svc = null; }
/// <summary> /// 添加角色 /// </summary> void AddRole() { EntityLogSetCaseRole vo = new EntityLogSetCaseRole(); if (this.txtRole.Tag != null) { vo.roleId = this.txtRole.Tag.ToString(); } else { MessageBox.Show("必须选择角色", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtRole.Focus(); return; } vo.empNo = this.txtDoctCode.Text.Trim(); if (vo.empNo == string.Empty) { MessageBox.Show("请先输入医师工号", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtDoctCode.Focus(); return; } clsDcl_Charge svc = new clsDcl_Charge(); DataTable dtEmp = svc.GetEmpInfo(vo.empNo); if (dtEmp == null || dtEmp.Rows.Count == 0) { MessageBox.Show("医师工号无效,请重新输入。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtDoctCode.Focus(); return; } DataRow drEmp = dtEmp.Rows[0]; foreach (DataRow dr in dtEmp.Rows) { if (dr["default_inpatient_dept_int"] != DBNull.Value && Convert.ToInt32(dr["default_inpatient_dept_int"]) == 1) { drEmp = dr; break; } } DataTable dtRole = svc.QueryCaseRole("", "", vo.empNo); if (dtRole != null && dtRole.Rows.Count > 0) { foreach (DataRow dr in dtRole.Rows) { if (dr["roleid"].ToString() == vo.roleId && Convert.ToInt32(dr["status"]) == 1) { MessageBox.Show("角色: " + dr["rolename"].ToString() + ", 已添加。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtRole.Focus(); return; } } } vo.empId = drEmp["empid_chr"].ToString(); vo.areaId = drEmp["deptid_chr"].ToString(); vo.giveOperId = this.LoginInfo.m_strEmpID; if (svc.AddCaseRole(vo) > 0) { MessageBox.Show("添加角色成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.QueryRole(); } else { MessageBox.Show("添加角色失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }