/// <summary> /// 显示所有人员, 并定位于findEmployeeId /// jianqg 20120222 增加参数,findEmployeeId,可以定位于该人员 /// </summary> /// <param name="findEmployeeId">需要查找的人员id</param> private void ShowEmployee(object findEmployeeId) { try { this.lstEmployee.Items.Clear(); string sql = @"select a.employee_id,a.name,'' as code,(case a.sex when 0 then '未指定' when 1 then '男' when 2 then '女' end) as sex, case a.rylx when 1 then '医生' when 2 then '护士' when 3 then '收费员' when 4 then '药库操作员' when 5 then '药房操作员' when 6 then '医技人员' when 7 then '其他' when 8 then '自助终端' end as rylx, a.d_code as ys_code, dbo.fun_getyszcjb(ys_typeid) type_name, case d.type when 0 then '普通护士' when 1 then '组长护士' when 2 then '护士长' end as hsjb from jc_employee_property a left join pub_user b on a.employee_id=b.employee_id left join jc_role_doctor c on a.employee_id=c.employee_id left join jc_role_nurse d on a.employee_id=d.employee_id where a.delete_bit=0 order by a.employee_id" ; DataTable tableEmployee = InstanceForm.BDatabase.GetDataTable(sql); for (int i = 0; i < tableEmployee.Rows.Count; i++) { ListViewItem item = new ListViewItem(); item.Text = tableEmployee.Rows[i]["name"].ToString().Trim(); item.SubItems.Add(tableEmployee.Rows[i]["sex"].ToString( )); item.SubItems.Add(tableEmployee.Rows[i]["code"].ToString().Trim()); item.SubItems.Add(tableEmployee.Rows[i]["rylx"].ToString().Trim()); item.SubItems.Add(tableEmployee.Rows[i]["ys_code"].ToString( ).Trim( )); item.SubItems.Add(tableEmployee.Rows[i]["type_name"].ToString( ).Trim( )); item.SubItems.Add(tableEmployee.Rows[i]["hsjb"].ToString( ).Trim( )); item.Tag = Convert.ToInt32(tableEmployee.Rows[i]["employee_id"]); item.Name = item.Tag.ToString(); //jiang 20120222 增加 设置 key,方便查找 sql = "employee_id=" + Convert.ToInt32(tableEmployee.Rows[i]["employee_id"]); DataRow[] drs = this.tableEmpDept.Select(sql); string dept = ""; for (int j = 0; j < drs.Length; j++) { string name = drs[j]["name"].ToString().Trim(); if (name != "") { dept = dept + name + ","; } } if (dept != "") { dept = dept.Substring(0, dept.Length - 1); } item.SubItems.Add(dept); this.lstEmployee.Items.Add(item); if (findEmployeeId != null && findEmployeeId.ToString() == item.Tag.ToString()) { lstEmployee.Items[item.Name].Selected = true; lstEmployee.EnsureVisible(item.Index); lstEmployee.Select(); } } } catch { } }