/// <summary> /// 刷新数据 --- 病种组合列表 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2012-12-28</date> private void RefreashGroupsData() { try { DataTable dt = DS_SqlService.GetDiseaseGroups(); dt.Columns.Add("DiseasesGroup"); if (null != dt && dt.Rows.Count > 0) { foreach (DataRow drow in dt.Rows) { drow["DiseasesGroup"] = DS_BaseService.GetDiseaseStringByGroupID(int.Parse(drow["ID"].ToString())); } } string searchStr = this.txt_search.Text.Trim().Replace("'", "''"); string filter = string.Format(" NAME like '%{0}%' or PY like '%{0}%' or WB like '%{0}%' or DiseasesGroup like '%{0}%' or MEMO like '%{0}%' ", searchStr); dt.DefaultView.RowFilter = filter; this.gridControl_groups.DataSource = dt; } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 刷新数据 --- 组合权限列表 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-01-06</date> private void SearchRightData() { try { DataRow drow = gridView_user.GetDataRow(gridView_user.FocusedRowHandle); if (null == drow) { this.gridControl_groupRight.DataSource = new DataTable(); return; } //查询所有组合 DataTable dt = DS_SqlService.GetDiseaseGroups(); //添加组合病种显示列 dt.Columns.Add("DiseasesGroup"); if (null != dt && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { dr["DiseasesGroup"] = DS_BaseService.GetDiseaseStringByGroupID(int.Parse(dr["ID"].ToString())); } } //添加组合权限列 dt.Columns.Add(new DataColumn("FLAG", typeof(bool))); DataRow[] listArry = dt.Select(" 1=1 "); if (allSource.Rows.Count == 0) { allSource = listArry.Length == 0 ? new DataTable() : listArry.CopyToDataTable(); } //筛选条件 string searchStr = this.txt_searchRight.Text.ToUpper();//.Replace("'","''"); checkedList.Clear(); notCheckedList.Clear(); //此用户权限内的组合ID集合 List <string> idList = DS_BaseService.GetDiseaseGroupIDsByUserID(drow["USERID"].ToString().Trim()); if (null == idList || idList.Count == 0) {//此用户没有组合权限 foreach (DataRow dr in listArry) { dr["FLAG"] = false; } notCheckedList = listArry.Where(p => p["NAME"].ToString().ToUpper().Contains(searchStr) || p["PY"].ToString().ToUpper().Contains(searchStr) || p["WB"].ToString().ToUpper().Contains(searchStr) || p["DiseasesGroup"].ToString().ToUpper().Contains(searchStr)).OrderBy(q => q["NAME"]).ToList(); } else { //已勾选项 不过滤 var checkedEnu = listArry.Where(p => null != p["ID"] && idList.Contains(p["ID"].ToString().Trim())).OrderBy(q => q["NAME"]); foreach (DataRow dr in checkedEnu) { dr["FLAG"] = true; checkedList.Add(dr); } //对未勾选项进行过滤 var notCheckedEnu = listArry.Where(p => null != p["ID"] && !idList.Contains(p["ID"].ToString().Trim()) && (p["NAME"].ToString().ToUpper().Contains(searchStr) || p["PY"].ToString().ToUpper().Contains(searchStr) || p["WB"].ToString().ToUpper().Contains(searchStr) || p["DiseasesGroup"].ToString().ToUpper().Contains(searchStr))).OrderBy(q => q["NAME"]); foreach (DataRow dr in notCheckedEnu) { dr["FLAG"] = false; notCheckedList.Add(dr); } } List <DataRow> unionList = checkedList.Union(notCheckedList).ToList(); DataTable endDt = (null == unionList || unionList.Count() == 0) ? new DataTable() : unionList.CopyToDataTable(); defaultSource = endDt.Copy(); this.gridControl_groupRight.DataSource = endDt; } catch (Exception ex) { throw new Exception(ex.Message); } }