//职务选定项改变事件 private void chkZhiwu_CheckedChanged(object sender, EventArgs e) { if (!flagIsCheck) { if (trvBookOprate.SelectedNode != null) { if (trvBookOprate.SelectedNode.Level == 1) { if (trvBookOprate.SelectedNode.Tag != null) { if (trvBookOprate.SelectedNode.Tag.GetType().ToString().Contains("Class_Text_A")) { TreeNode parentNode = trvBookOprate.SelectedNode; foreach (TreeNode tn in parentNode.Nodes) { Class_Text_A temp = (Class_Text_A)tn.Tag; SetZhiWu(temp.Id); //设置职务,循环遍历删除权限 } } } } else if (trvBookOprate.SelectedNode.Level == 2) { SetZhiWu(CurrentSelectDocId); //设置职务,单独删除权限 } } } }
private void Save_WorkGroup() { if (trvBookOprate.SelectedNode != null) { if (trvBookOprate.SelectedNode.Tag != null) { ArrayList strSqls = new ArrayList(); if (trvBookOprate.SelectedNode.Tag.GetType().ToString().Contains("Class_Text_A")) { Class_Text_A temp = (Class_Text_A)trvBookOprate.SelectedNode.Tag; /* * 文书的使用范围 */ strSqls.Add("delete from T_TEXTUSEAREA where TEXTTYPE=" + temp.Id.ToString() + ""); strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,WORKGROUP)values(" + CurrentSelectDocId + "," + cboWorkGroup.SelectedValue.ToString() + ")"); string[] strSql2s = new string[strSqls.Count]; for (int i = 0; i < strSqls.Count; i++) { strSql2s[i] = strSqls[i].ToString(); } App.ExecuteBatch(strSql2s); } } } }
/// <summary> /// 选择所有的使用范围和职务职称等 /// </summary> private void RangeSelectAllByNode(TreeNode node) { Doc_Ranges.Clear(); //Doc_Job.Clear(); //Doc_Other.Clear(); Class_Text_A selectdoc = (Class_Text_A)node.Tag; /* * 使用范围部分 */ string Sql_textusearea = "select * from t_textusearea where texttype=" + selectdoc.Id + ""; DataSet ds_textusearea = App.GetDataSet(Sql_textusearea); for (int i = 0; i < ds_textusearea.Tables[0].Rows.Count; i++) { Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Texttype = selectdoc.Id; temp.Workgroup = Convert.ToInt16(ds_textusearea.Tables[0].Rows[i]["WORKGROUP"]); cboWorkGroup.SelectedValue = temp.Workgroup; Doc_Ranges.Add(temp); } Save_WorkGroup(); }
private void trvBookOprate_AfterSelect(object sender, TreeViewEventArgs e) { if (trvBookOprate.SelectedNode != null) { if (SaveCount > 0) { App.Msg("刚才的文书权限设置,都已经保存!"); } if (trvBookOprate.SelectedNode.Nodes.Count > 0) { lblSelectDocType.Text = "当前文书类型:"; } else //此处只针对单个文书设置权限,对于批量设置权限,在各个执行方法中 { lblSelectDocType.Text = "当前文书类型:" + trvBookOprate.SelectedNode.Text; if (trvBookOprate.SelectedNode.Tag != null) { if (trvBookOprate.SelectedNode.Tag.GetType().ToString().Contains("Class_Text_A")) { Class_Text_A temp = (Class_Text_A)trvBookOprate.SelectedNode.Tag; CurrentSelectDocId = temp.Id; IniReflesh(); RangeSelectAllByNode(trvBookOprate.SelectedNode); } } } IniReflesh(); //控件重置 SaveCount = 0; //保存操作数还原为零 } }
/// <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> /// 实例Class_Text化查询结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> private static Class_Text_A[] GetSelectClassDs(DataSet tempds) { if (tempds != null) { if (tempds.Tables[0].Rows.Count > 0) { Class_Text_A[] class_text = new Class_Text_A[tempds.Tables[0].Rows.Count]; for (int i = 0; i < tempds.Tables[0].Rows.Count; i++) { class_text[i] = new Class_Text_A(); class_text[i].Id = Convert.ToInt32(tempds.Tables[0].Rows[i]["ID"].ToString()); if (tempds.Tables[0].Rows[i]["PARENTID"].ToString() != "0") { class_text[i].Parentid = Convert.ToInt32(tempds.Tables[0].Rows[i]["PARENTID"].ToString()); } class_text[i].Textcode = tempds.Tables[0].Rows[i]["TEXTCODE"].ToString();; class_text[i].Textname = tempds.Tables[0].Rows[i]["TEXTNAME"].ToString(); class_text[i].Isenable = tempds.Tables[0].Rows[i]["ISENABLE"].ToString(); class_text[i].Txxttype = tempds.Tables[0].Rows[i]["ISBELONGTOTYPE"].ToString(); class_text[i].Issimpleinstance = tempds.Tables[0].Rows[i]["issimpleinstance"].ToString(); } return(class_text); } else { return(null); } } else { return(null); } }
//设置其他权限 private void chkOtherRights_MouseUp(object sender, MouseEventArgs e) { if (trvBookOprate.SelectedNode != null) { if (trvBookOprate.SelectedNode.Level == 1) { if (trvBookOprate.SelectedNode.Tag != null) { if (trvBookOprate.SelectedNode.Tag.GetType().ToString().Contains("Class_Text_A")) { TreeNode parentNode = trvBookOprate.SelectedNode; foreach (TreeNode tn in parentNode.Nodes) { Class_Text_A temp = (Class_Text_A)tn.Tag; SetOtherRights(temp.Id); //设置其它权限 } } } } else if (trvBookOprate.SelectedNode.Level == 2) { SetOtherRights(CurrentSelectDocId); //设置其它权限 } } }
/// <summary> /// 对文书进行分类设置 /// </summary> /// <param Name="Directionarys">所有文书节点集合</param> /// <param Name="currentnode">当前文书节点</param> private static void SetTreeView(Class_Text_A[] Directionarys, TreeNode current) { for (int i = 0; i < Directionarys.Length; i++) { Class_Text_A cunrrentDir = (Class_Text_A)current.Tag; if (Directionarys[i].Parentid == cunrrentDir.Id) { TreeNode tn = new TreeNode(); tn.Tag = Directionarys[i]; tn.Text = Directionarys[i].Textname; tn.Name = Directionarys[i].Id.ToString(); tn.ImageIndex = 9; tn.SelectedImageIndex = 9; current.Nodes.Add(tn); SetTreeView(Directionarys, tn); } } }
/// <summary> /// 选择按钮设置权限 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lsbButton_SelectedIndexChanged(object sender, EventArgs e) { try { if (trvBookOprate.SelectedNode != null) { if (lsbButton.SelectedItem != null && trvBookOprate.SelectedNode.Nodes.Count == 0) { SelectButtonRightSet(CurrentSelectDocId); //选择按钮权限设置 } else if (lsbButton.SelectedItem != null && trvBookOprate.SelectedNode.Level == 1) //批量修改文书权限 { chkZhiwu.Checked = false; cboSign2.Enabled = false; cboZhiChen.Enabled = false; chkZhicheng.Checked = false; cboSign1.Enabled = false; cboZhiWu.Enabled = false; //清空其他权限 for (int i = 0; i < chkOtherRights.Items.Count; i++) { chkOtherRights.SetItemChecked(i, false); } int buttonid = Convert.ToInt16(lsbButton.SelectedValue); if (trvBookOprate.SelectedNode.Tag.GetType().ToString().Contains("Class_Text_A")) { TreeNode parentNode = trvBookOprate.SelectedNode; foreach (TreeNode tn in parentNode.Nodes) { Class_Text_A temp = (Class_Text_A)tn.Tag; Doc_Job.Add("delete from t_text_jobtitle_relation where TEXTTYPE=" + temp.Id + " and textcontrol=" + buttonid + ""); //单个设置权限 Doc_Other.Add("delete from t_text_other_set where TEXTTYPE=" + temp.Id + " and TEXTCONTROL=" + buttonid + ""); } string[] SqlsJob = new string[Doc_Job.Count]; string[] SqlsOther = new string[Doc_Other.Count]; for (int i = 0; i < Doc_Job.Count; i++) { SqlsJob[i] = Doc_Job[i].ToString(); } for (int i = 0; i < Doc_Other.Count; i++) { SqlsOther[i] = Doc_Other[i].ToString(); } if (App.ExecuteBatch(SqlsJob) > 0 || App.ExecuteBatch(SqlsOther) > 0) { SaveCount++; } } } } } catch { } finally { flagIsCheck = false; } }
/// <summary> /// 所有文书子节点的使用范围设置 /// </summary> private void ChildNodeRangeSet(TreeNodeCollection nodes) { for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Nodes.Count > 0) { ChildNodeRangeSet(nodes[i].Nodes); } else { if (nodes[i].Tag.GetType().ToString().Contains("Class_Text_A")) { Class_Text_A selectdoc = (Class_Text_A)nodes[i].Tag; ArrayList strSqls = new ArrayList(); strSqls.Add("delete from T_TEXTUSEAREA where TEXTTYPE=" + selectdoc.Id.ToString() + ""); //分院信息 string Sql = "select * from T_SUB_HOSPITALINFO"; DataSet ds_hospital = App.GetDataSet(Sql); //医生组 string Sql_section = "select * from T_SECTIONINFO"; DataSet ds_section = App.GetDataSet(Sql_section); for (int i1 = 0; i1 < ds_hospital.Tables[0].Rows.Count; i1++) { DataRow[] Rows = ds_section.Tables[0].Select("shid = " + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ""); if (Rows.Length > 0) { for (int j = 0; j < Rows.Length; j++) { Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Texttype = selectdoc.Id; temp.Section = Convert.ToInt16(Rows[j]["sid"].ToString()); temp.Belonghospital = Convert.ToInt16(ds_hospital.Tables[0].Rows[i1]["SHID"].ToString()); temp.Workgroup = 212; strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + temp.Texttype.ToString() + "," + temp.Belonghospital.ToString() + "," + temp.Section.ToString() + "," + temp.Workgroup.ToString() + ")"); } } else { strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + selectdoc.Id.ToString() + "," + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ",0," + 212 + ")"); } } //护士组 string Sql_sickarea = "select * from t_sickareainfo"; DataSet ds_sickarea = App.GetDataSet(Sql_sickarea); for (int i1 = 0; i1 < ds_hospital.Tables[0].Rows.Count; i1++) { DataRow[] Rows = ds_sickarea.Tables[0].Select("shid = " + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ""); if (Rows.Length > 0) { for (int j = 0; j < Rows.Length; j++) { Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Texttype = selectdoc.Id; temp.Section = Convert.ToInt16(Rows[j]["said"].ToString()); temp.Belonghospital = Convert.ToInt16(ds_hospital.Tables[0].Rows[i1]["SHID"].ToString()); temp.Workgroup = 213; strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + temp.Texttype.ToString() + "," + temp.Belonghospital.ToString() + "," + temp.Section.ToString() + "," + temp.Workgroup.ToString() + ")"); } } else { strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + selectdoc.Id.ToString() + "," + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ",0," + 213 + ")"); } } string[] strsqls2 = new string[strSqls.Count]; for (int k = 0; k < strsqls2.Length; k++) { strsqls2[k] = strSqls[k].ToString(); } if (App.ExecuteBatch(strsqls2) > 0) { SaveCount++; } } } } }