/// <summary> /// 查询角色 /// </summary> void QueryRole() { try { string startDate = this.dteStart.Value.ToString("yyyy-MM-dd"); string endDate = this.dteEnd.Value.ToString("yyyy-MM-dd"); if (Convert.ToDateTime(startDate + " 00:00:00") > Convert.ToDateTime(endDate + " 00:00:00")) { MessageBox.Show("开始日期不能大于结束日期。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } clsPublic.PlayAvi("查询数据,请稍候..."); clsDcl_Charge svc = new clsDcl_Charge(); this.gvRole.DataSource = svc.QueryCaseRole(startDate, endDate, ""); svc = null; } finally { clsPublic.CloseAvi(); } }
/// <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); } }