private void SaveTexts(string id, TreeNodeCollection nodes) { for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Checked) { //if (nodes[i].Tag.ToString().Contains("Class_Datacodecs")) //{ // Class_Datacodecs temp = (Class_Datacodecs)nodes[i].Tag; // SqlStrs.Add("insert into T_ROLE_TEXT(ROLE_ID,TEXT_ID)values(" + id + ",'" + temp.Id + "')"); //} //else //{ if (nodes[i].Tag.ToString().Contains("Class_Text")) { Class_Text temp = (Class_Text)nodes[i].Tag; SqlStrs.Add("insert into T_ROLE_TEXT(ROLE_ID,TEXT_ID)values(" + id + ",'" + temp.Id + "')"); } //} } if (nodes[i].Nodes.Count > 0) { SaveTexts(id, nodes[i].Nodes); } } }
/// <summary> /// 根据权限选中相应的树节点 /// </summary> /// <param name="texts">权限集合</param> /// <param name="nodes">节点集合</param> private void ALLCheckByID(Class_Text[] texts, TreeNodeCollection nodes) { for (int i = 0; i < nodes.Count; i++) { for (int j = 0; j < texts.Length; j++) { if (!nodes[i].Tag.ToString().Contains("Class_Datacodecs")) { Class_Text temp = (Class_Text)nodes[i].Tag; if (temp.Id == texts[j].Id) { nodes[i].Checked = true; break; } } else { nodes[i].Checked = true; break; } } if (nodes[i].Nodes.Count > 0) { ALLCheckByID(texts, nodes[i].Nodes); } } }
/// <summary> /// 实例Class_Text化查询结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> public static Class_Text[] GetSelectClassDs(DataSet tempds) { if (tempds != null) { if (tempds.Tables[0].Rows.Count > 0) { Class_Text[] class_text = new Class_Text[tempds.Tables[0].Rows.Count]; for (int i = 0; i < tempds.Tables[0].Rows.Count; i++) { class_text[i] = new Class_Text(); 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); } }
/// <summary> /// 对文书进行分类设置 /// </summary> /// <param Name="Directionarys">所有文书节点集合</param> /// <param Name="currentnode">当前文书节点</param> public static void SetTreeView(Class_Text[] Directionarys, TreeNode current) { for (int i = 0; i < Directionarys.Length; i++) { Class_Text cunrrentDir = (Class_Text)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(); if (Directionarys[i].Issimpleinstance == "0") //是单例文书 { tn.SelectedImageIndex = 7; tn.ImageIndex = 7; } else { tn.ImageIndex = 9; tn.SelectedImageIndex = 9; } current.Nodes.Add(tn); SetTreeView(Directionarys, tn); } } }
/// <summary> /// 设置树图标 /// </summary> /// <param name="nodes">节点集合</param> public static void SetTreeNodesImage(NodeCollection nodes) { for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Parent == null) { nodes[i].ImageIndex = 15; } else if (nodes[i].Nodes.Count > 0 && nodes[i].Parent != null) { nodes[i].ImageIndex = 20; } else { if (nodes[i].Tag != null) { Class_Text cunrrentDir = (Class_Text)nodes[i].Tag; if (cunrrentDir.Issimpleinstance == "0") //是单例文书 { nodes[i].ImageIndex = 17; } else { nodes[i].ImageIndex = 18; } } } if (nodes[i].Nodes.Count > 0) { SetTreeNodesImage(nodes[i].Nodes); } } }
/// <summary> /// 实例Class_Text化查询结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> public static Class_Text[] GetTextDs(DataTable tempdt) { if (tempdt != null) { if (tempdt.Rows.Count > 0) { Class_Text[] class_text = new Class_Text[tempdt.Rows.Count]; for (int i = 0; i < tempdt.Rows.Count; i++) { class_text[i] = new Class_Text(); class_text[i].Id = Convert.ToInt32(tempdt.Rows[i]["ID"].ToString()); if (tempdt.Rows[i]["PARENTID"].ToString() != "0") { class_text[i].Parentid = Convert.ToInt32(tempdt.Rows[i]["PARENTID"].ToString()); } class_text[i].Sid = tempdt.Rows[i]["sid"].ToString(); class_text[i].Textcode = tempdt.Rows[i]["TEXTCODE"].ToString();; class_text[i].Textname = tempdt.Rows[i]["TEXTNAME"].ToString(); class_text[i].Isenable = tempdt.Rows[i]["ISENABLE"].ToString(); class_text[i].Txxttype = tempdt.Rows[i]["ISBELONGTOTYPE"].ToString(); class_text[i].Issimpleinstance = tempdt.Rows[i]["issimpleinstance"].ToString(); class_text[i].Ishighersign = tempdt.Rows[i]["ishighersign"].ToString(); class_text[i].Right_range = tempdt.Rows[i]["right_range"].ToString(); class_text[i].Ishavetime = tempdt.Rows[i]["ishavetime"].ToString(); class_text[i].Formname = tempdt.Rows[i]["formname"].ToString(); class_text[i].Other_textname = tempdt.Rows[i]["OTHER_TEXTNAME"].ToString(); } return(class_text); } else { return(null); } } else { return(null); } }