/// <summary> /// 判断是否选中当前项 /// </summary> private void IsCheckSectionsItem() { if (trvBookOprate.SelectedNode != null) { if (trvBookOprate.SelectedNode.Tag != null) { //清空所有的选项 for (int i = 0; i < chkListSection.Items.Count; i++) { chkListSection.SetSelected(i, false); } Class_Text_A temp = (Class_Text_A)trvBookOprate.SelectedNode.Tag; Class_Sub_Hospital temp_sub_hospital = (Class_Sub_Hospital)chkListFenyuan.SelectedItem; DataSet ds = App.GetDataSet("select * from t_textusearea where texttype=" + temp.Id.ToString() + " and belonghospital=" + temp_sub_hospital.Id.ToString() + ""); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //科室或病区 for (int j = 0; j < chkListSection.Items.Count; j++) { Class_Sections temp2 = (Class_Sections)chkListSection.Items[j]; if (ds.Tables[0].Rows[i]["section"].ToString() == temp2.Sid.ToString()) { chkListSection.SetItemChecked(j, true); } } } } } }
/// <summary> /// 显示所有的分院信息 /// </summary> private void Sub_Hospital() { try { string Sql = "select * from T_SUB_HOSPITALINFO"; DataSet ds = App.GetDataSet(Sql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Class_Sub_Hospital temp = new Class_Sub_Hospital(); temp.Id = ds.Tables[0].Rows[i]["SHID"].ToString(); temp.Sub_code = ds.Tables[0].Rows[i]["SUB_HOSPITAL_CODE"].ToString(); temp.Sub_name = ds.Tables[0].Rows[i]["SUB_HOSPITAL_NAME"].ToString(); chkListFenyuan.Items.Add(temp); chkListFenyuan.DisplayMember = "Sub_name"; chkListFenyuan.ValueMember = "Sub_code"; } } catch { } }
/// <summary> /// 范围修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chkListSection_MouseUp(object sender, MouseEventArgs e) { if (chkListFenyuan.SelectedItem != null) { Class_Sub_Hospital temp_hospital = (Class_Sub_Hospital)chkListFenyuan.SelectedItem; RemoveAllSectionByShid(Convert.ToInt16(temp_hospital.Id)); /* * 加载新设置的分院科室或病区 */ for (int i = 0; i < chkListSection.CheckedItems.Count; i++) { Class_Sections temp_section = (Class_Sections)chkListSection.CheckedItems[i]; Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Belonghospital = Convert.ToInt16(temp_hospital.Id); temp.Section = temp_section.Sid; temp.Texttype = CurrentSelectDocId; temp.Workgroup = Convert.ToInt16(cboWorkGroup.SelectedValue); Doc_Ranges.Add(temp); } } }