private void ShowFormPanel(string Role_ID) { pnlGrid.Visible = false; pnlForm.Visible = true; if (!string.IsNullOrEmpty(Role_ID)) { dbo_RoleClass role = dbo_RoleDataClass.Select_Record(Role_ID); txtRole_ID.Text = role.Role_ID; txtRole_Name.Text = role.Role_Name; TreeView2.Nodes.Clear(); TreeView2.ShowLines = false; List <MenuNode> RootNode = dbo_RolePermissionDataClass.GetMenuNode(int.Parse(txtRole_ID.Text)); BindTree(RootNode, null); TreeView2.ExpandAll(); TreeView2.ShowLines = false; } }
public void Button_Command(Object sender, CommandEventArgs e) { switch (e.CommandName) { case "Expand": if (panel_sample.Visible == true) { TreeView1.ExpandAll(); } else { TreeView2.ExpandAll(); } break; case "Collapse": if (panel_sample.Visible == true) { TreeView1.CollapseAll(); } else { TreeView2.CollapseAll(); } break; default: // Do nothing. break; } }
private void refreshTreeToolStripButton_Click(object sender, EventArgs e) { // Clic sur le menu "Refresh" // Sauvegarde du chemin du noeud actuel string currentPath = null; if (folderTreeView.SelectedNode != null) { currentPath = folderTreeView.SelectedNode.FullPath; } _RefreshTreeView(); // Correction ANO : rétablit le noeud sélectionné if (currentPath != null) { _KeepListSelection = true; TreeView2.SelectNodeByPath(folderTreeView, currentPath); // Noeud non trouvé > on sélectionne le noeud racine /*if (folderTreeView.SelectedNode == null) * TreeView2.SelectNodeByPath(folderTreeView,_TREENODE_ROOT);*/ } }
/// <summary> /// 点中父类,展开子类 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void TreeView2_SelectedNodeChanged(object sender, EventArgs e) { //点击根节点 if (TreeView2.SelectedValue.Substring(2, 4).Equals("0000")) { TreeView2.CollapseAll(); TreeView2.SelectedNode.Expanded = true; return; } //当前用户当前菜单功能分配 gongneng mGongneng = new gongneng(); string pBianhao = TreeView2.SelectedValue; mGongneng.Daihao = yonghuLabel.Text; mGongneng.Yingyong = RadioButtonList_Yingyong.SelectedValue.ToString(); mGongneng.Bianhao = TreeView2.SelectedValue; DataTable dt = bGongneng.getGongneng_Bianhao(mGongneng); if (dt.Rows.Count < 1) { return; } for (int i = 0; i < 10; i++) { if (dt.Rows[0]["canshu" + i.ToString()].ToString().Equals("1")) { CheckBoxList_canshu.Items[i].Selected = true; } else { CheckBoxList_canshu.Items[i].Selected = false; } } }
private void InitialTreeView() { TreeView2.Nodes.Clear(); List <MenuNode> RootNode = dbo_RolePermissionDataClass.GetMenuNode(-1); BindTree(RootNode, null); TreeView2.ExpandAll(); TreeView2.ShowLines = false; }
protected void bindtreeviewMaping() { try { this.TreeView2.Nodes.Clear(); HierarchyTree hierarchy = new HierarchyTree(); HierarchyTree.HGroup objhtree = null; string selgroup = "select distinct ITGroupPK,GroupName,ParentCode from IT_GroupMaster where CollegeCode='" + ddlcolload.SelectedItem.Value + "'"; ds.Clear(); ds = d2.select_method_wo_parameter(selgroup, "Text"); this.TreeView2.Nodes.Clear(); hierarchy.Clear(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { objhtree = new HierarchyTree.HGroup(); objhtree.group_code = int.Parse(ds.Tables[0].Rows[i]["ITGroupPK"].ToString()); objhtree.parent_code = int.Parse(ds.Tables[0].Rows[i]["ParentCode"].ToString()); objhtree.group_name = ds.Tables[0].Rows[i]["GroupName"].ToString(); hierarchy.Add(objhtree); } foreach (HierarchyTree.HGroup hTree in hierarchy) { HierarchyTree.HGroup parentNode = hierarchy.Find(delegate(HierarchyTree.HGroup emp) { return(emp.group_code == hTree.parent_code); }); if (parentNode != null) { foreach (TreeNode tn in TreeView2.Nodes) { if (tn.Value == parentNode.group_code.ToString()) { tn.ChildNodes.Add(new TreeNode(hTree.group_name.ToString(), hTree.group_code.ToString())); } if (tn.ChildNodes.Count > 0) { foreach (TreeNode ctn in tn.ChildNodes) { RecursiveChild(ctn, parentNode.group_code.ToString(), hTree); } } } } else { TreeView2.Nodes.Add(new TreeNode(hTree.group_name, hTree.group_code.ToString())); } TreeView2.ExpandAll(); //TreeView2.ExpandAll(); } } catch { } }
/// <summary> /// Загрузка дерева покупных изделий /// </summary> /// <param name="productType">Тип изделия (SELL - продукция, MAKE - внутреннее изделий, BUY - покупное изделие )</param> /// <param name="groupID">Идентификатор</param> private void LoadOuterProductGroupsTree(string productType, string groupID) { MainDataClassesDataContext dataContext = new MainDataClassesDataContext(); ISingleResult <ogk_SelectArticleGroupsResult> a = dataContext.ogk_SelectArticleGroups(0, 3); // 0 - корневой узел дерева, 3 - покупное изделие List <ogk_SelectArticleGroupsResult> b = a.ToList(); for (int i = 0; i < b.Count; i++) { TreeNode tn = new TreeNode(); tn.Value = b.ElementAt(i).ID.ToString(); tn.NavigateUrl = "javascript:AddNodeContent('" + productType + "','" + b.ElementAt(i).ID.ToString() + "')"; tn.Text = b.ElementAt(i).NAME; tn.ToolTip = b.ElementAt(i).NAME; TreeView2.Nodes.Add(tn); LoadChildrenTreeNodes(tn, Convert.ToInt32(tn.Value), 3); } TreeView2.CollapseAll(); CreateStartUpScript(productType, b.ElementAt(0).ID.ToString()); }
private void InitializeComponent() { DataTable dt = LoadTemplateFileDT(); string templateid = DNTRequest.GetString("templateid"); string templatename = DNTRequest.GetString("templatename").Replace(" ", "%20"); foreach (DataRow dr in dt.Rows) { string ext = dr["extension"].ToString().Substring(1); dr["filename"] = String.Format("<img src=../images/{0}.gif border=\"0\" style=\"position:relative;top:5 px;height:16 px\"> {1} " + "<a href=\"global_templatesedit.aspx?path={2}&filename={1}{3}&templateid={4}&templatename={5}\" title=\"编辑{1}.{0}模板文件\"><img src='../images/editfile.gif' border='0'/></a>", ext, dr["filename"].ToString().Trim(), dr["filepath"].ToString().Replace(" ", "%20"), dr["extension"].ToString().Trim(), templateid, templatename); } TreeView1.AddTableData(dt); for (int i = 0; i < TreeView1.Items.Count; i++) { TreeView1.Items[i].Attributes.Add("onclick", "checkedEnabledButton1(form,'TabControl1:tabPage22:CreateTemplate','TabControl1:tabPage22:DeleteTemplateFile')"); TreeView1.Items[i].Attributes.Add("value", TreeView1.Items[i].Value); } TreeView2.DataSource = LoadOtherFileDT(); TreeView2.DataBind(); }
private void toPopulateTreeview() { string dt_topics = ""; string dt_topics1 = ""; string subjectno = ddlsubject.SelectedValue.ToString(); if (!string.IsNullOrEmpty(subjectno)) { con.Close(); con.Open(); //this.TreeView1.Nodes.Clear(); HierarchyTrees hierarchyTrees = new HierarchyTrees(); HierarchyTrees.HTree objHTree = null; //start=======common tree load using (SqlCommand command = new SqlCommand("select topic_no,parent_code,unit_name from sub_unit_details where subject_no='" + subjectno + "' order by parent_code,topic_no ", con)) { //this.TreeView1.Nodes.Clear(); hierarchyTrees.Clear(); SqlDataReader reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection); while (reader.Read()) { objHTree = new HierarchyTrees.HTree(); objHTree.topic_no = int.Parse(reader["Topic_no"].ToString()); objHTree.parent_code = int.Parse(reader["parent_code"].ToString()); objHTree.unit_name = reader["unit_name"].ToString(); hierarchyTrees.Add(objHTree); } } foreach (HierarchyTrees.HTree hTree in hierarchyTrees) { HierarchyTrees.HTree parentNode = hierarchyTrees.Find(delegate(HierarchyTrees.HTree emp) { return(emp.topic_no == hTree.parent_code); } ); if (parentNode != null) { foreach (TreeNode tn in TreeView2.Nodes) { if (tn.Value == parentNode.topic_no.ToString()) { tn.ChildNodes.Add(new TreeNode(hTree.unit_name.ToString(), hTree.topic_no.ToString())); //Session["session_tnValue"] = tn; } if (tn.ChildNodes.Count > 0) { foreach (TreeNode ctn in tn.ChildNodes) { RecursiveChild(ctn, parentNode.topic_no.ToString(), hTree); } } } } else { TreeView2.Nodes.Add(new TreeNode(hTree.unit_name, hTree.topic_no.ToString())); } TreeView2.ExpandAll(); } TreeView2.ExpandAll(); if (TreeView2.Nodes.Count < 1) { } else { TreeView2.Visible = true; btnsave.Visible = true; } } }
private void Page_Load(object sender, System.EventArgs e) { if (StateManager.IsManualState()) { // If the StateManager doesn't exist in the session put it else get it. if (StateManager.GetStateManagerFromSession() == null) { //instanciate AppStateManager class AppStateManager myStateManager = new AppStateManager(); //put state manager to session StateManager.PutStateManagerInSession(myStateManager); //put current map alias to state manager dictionary myStateManager.ParamsDictionary[StateManager.ActiveMapAliasKey] = this.MapControl1.MapAlias; } // Now Restore State StateManager.GetStateManagerFromSession().RestoreState(); } if (!Page.IsPostBack) { #region 加载节点地图数据 Map mainMap = GetMap(); FeatureLayer flStation = mainMap.Layers["Station"] as FeatureLayer; FeatureLayer flBaseStation = mainMap.Layers["BaseStation"] as FeatureLayer; FeatureLayer flSubMachine = mainMap.Layers["SubMachine"] as FeatureLayer; //加载主站 foreach (Feature fStation in (flStation.Table as MapInfo.Data.ITableFeatureCollection)) { TreeNode tn = new TreeNode(fStation["NAME"].ToString()); tn.Target = fStation["ID"].ToString(); tn.ImageUrl = Request.MapPath("~/images/1.gif"); tn.CollapseAll(); TreeView2.Nodes.Add(tn); } //加载基站 foreach (Feature fBaseStation in (flBaseStation.Table as MapInfo.Data.ITableFeatureCollection)) { TreeNode pNode = GetParentStation(fBaseStation["PID"].ToString()); if (pNode == null) { continue; } TreeNode tn = new TreeNode(fBaseStation["NAME"].ToString()); tn.Target = fBaseStation["ID"].ToString(); tn.ImageUrl = Request.MapPath("~/images/2.gif"); tn.CollapseAll(); pNode.ChildNodes.Add(tn); } //加载子机 foreach (Feature fSubMachine in (flSubMachine.Table as MapInfo.Data.ITableFeatureCollection)) { TreeNode pNode = GetBaseStation(fSubMachine["PID"].ToString()); if (pNode == null) { continue; } TreeNode tn = new TreeNode(fSubMachine["NAME"].ToString()); tn.Target = fSubMachine["ID"].ToString(); tn.ImageUrl = Request.MapPath("~/images/3.gif"); tn.CollapseAll(); pNode.ChildNodes.Add(tn); } TreeView2.ExpandAll(); #endregion } }
/// <summary> /// Met à jour la liste de fichiers empaquetés dans le BNK spécifié /// </summary> /// <param name="keepSelection">true to ensure current selected item will be kept after refresh</param> private void _RefreshContentLists(bool keepSelection) { // Stores selected item if needed if (keepSelection) { ListView2.StoreSelectedIndex(contentListView); TreeView2.StoreSelectedIndex(contentTreeView); } // Lists clearing contentListView.Items.Clear(); contentTreeView.Nodes.Clear(); if (_CurrentBnkFile != null) { try { Cursor = Cursors.WaitCursor; // 1. ListView (flat) foreach (string filePath in _CurrentBnkFile.GetPackedFilesPaths(null)) { // File name string fileName = _CurrentBnkFile.GetPackedFileName(filePath); if (fileName == null) { throw new Exception(_ERROR_INVALID_DATA); } // Récupération des données fichier ListViewItem anotherItem = new ListViewItem(fileName) { Tag = filePath, ImageIndex = _GetImageIndexFromFilename(fileName), ToolTipText = _GetPackedToolTip(filePath, false) }; // Tag // Image... // EVO_42 : nouvelles icônes // EVO_10 : Tooltip (type de fichier - taille) contentListView.Items.Add(anotherItem); } // Applying filter, if any fileSearchToolStripTextBox_TextChanged(this, new EventArgs()); // 2. TreeView (hierarchical) BNK.FileInfoNode rootNode = _CurrentBnkFile.FileInfoHierarchyRoot; TreeNode rootTreeNode = new TreeNode(_TREENODE_ROOT) { ImageIndex = (int)ItemPictures.ClosedPackedFolder, SelectedImageIndex = (int)ItemPictures.OpenedPackedFolder }; contentTreeView.Nodes.Add(rootTreeNode); _AddPackedNodeToTreeView(rootNode, rootTreeNode); contentTreeView.ExpandAll(); // Restoring selected item, if needed if (keepSelection) { ListView2.RestoreSelectedIndex(contentListView); TreeView2.RestoreSelectedIndex(contentTreeView); } // Mise à jour statut string countSizeInfo = string.Format(_STATUS_COUNT_SIZE_CONTENTS, _CurrentBnkFile.PackedFilesCount, _CurrentBnkFile.Size); string message = string.Format(_STATUS_BNK_CONTENTS, _CurrentBnkFile.FileName, countSizeInfo); StatusBarLogManager.ShowEvent(this, message); Cursor = Cursors.Default; } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } } }
private void getData(Int32 EvaluateType) //ด้าน { string strSql = @" Select Education21SideID, StudyYear, 'ด้านที่ ' + Cast(Sort As nVarChar) + '. ' + Education21SideName As Education21SideName, Sort From Education21Side Where StudyYear = '{0}' And DelFlag = 0 And EvaluateType = " + EvaluateType + " Order By Sort "; DataView dv5 = Conn.Select(string.Format(strSql, ddlYearB.SelectedValue)); BindMainDataView(); decimal SideScore = 0; decimal SideFullScore = 0; for (int m = 0; m < dv5.Count; m++) { decimal sdScore = 0; decimal sdFullScore = 0; dvChildStandard.RowFilter = " Education21SideID = '" + dv5[m]["Education21SideID"].ToString() + "' "; for (int i = 0; i < dvChildStandard.Count; i++) { decimal stdScore = 0; decimal stdFullScore = 0; dvChildIndicator.RowFilter = " Education21StandardID = '" + dvChildStandard[i]["Education21StandardID"].ToString() + "' "; if (dvChildIndicator.Count != 0) { for (int j = 0; j < dvChildIndicator.Count; j++) { string Criterion = "-"; decimal Score = 0; decimal FullScore = 0; if (Convert.ToInt32(dvChildStandard[i]["ckEvaluate"]).ToString() == "0") // ประเมินจากตัวชี้วัด { dvEducation21Evaluate.RowFilter = " Education21IndicatorID = '" + dvChildIndicator[j]["Education21IndicatorID"].ToString() + "' "; if (dvEducation21Evaluate.Count != 0) { Criterion = dvEducation21Evaluate[0]["EESort"].ToString(); Score = Convert.ToDecimal(dvEducation21Evaluate[0]["Score"].ToString()); stdScore += Score; } dvMaxScore.RowFilter = " Education21IndicatorID = '" + dvChildIndicator[j]["Education21IndicatorID"].ToString() + "' "; if (dvMaxScore.Count != 0) { FullScore = Convert.ToDecimal(dvMaxScore[0]["MaxScore"].ToString()); stdFullScore += FullScore; } } if (Convert.ToInt32(dvChildStandard[i]["ckEvaluate"]).ToString() == "1") // ประเมินจากมาตรฐาน { dvEducation21Evaluate.RowFilter = " Education21StandardID = '" + dvChildIndicator[j]["Education21StandardID"].ToString() + "' "; if (dvEducation21Evaluate.Count != 0) { Criterion = dvEducation21Evaluate[0]["EESort"].ToString(); Score = Convert.ToDecimal(dvEducation21Evaluate[0]["Score"].ToString()); stdScore += Score; } dvMaxScore.RowFilter = " Education21IndicatorID = '" + dvChildIndicator[j]["Education21IndicatorID"].ToString() + "' "; if (dvMaxScore.Count != 0) { FullScore = Convert.ToDecimal(dvMaxScore[0]["MaxScore"].ToString()); stdFullScore += FullScore; } } } if (Convert.ToInt32(dvChildStandard[i]["ckEvaluate"]).ToString() == "0") // ประเมินจากตัวชี้วัด { } if (Convert.ToInt32(dvChildStandard[i]["ckEvaluate"]).ToString() == "1") // ประเมินจากมาตรฐาน หาคะแนนเต็ม { if (dvEducation21Evaluate.Count != 0) { stdScore = stdScore / dvEducation21Evaluate.Count; } stdFullScore = stdFullScore / dvChildIndicator.Count; } } sdScore += stdScore; sdFullScore += stdFullScore; } SideScore += sdScore; SideFullScore += sdFullScore; TreeNode tNodeSide = new TreeNode(); tNodeSide.Text = string.Format("<img src=\"../Image/MenuStlye/S3.png\" style=\"float:left;border:none;padding:0 0 0 20px;\"/> <span style=\"color:black;font-size:20px;font-weight:bold;width:500px;overflow:hidden;\" title=\"{1}\">{0}</span><span style=\"float:right;margin-right:25px;color:black;font-size:20px;font-weight:bold;width:50px;overflow:hidden;text-align:right;\">{3}</span><span style=\"float:right;margin-right:70px;color:black;font-size:20px;font-weight:bold;width:70px;overflow:hidden;text-align:right;\">{2}</span><span style=\"float:right;padding-right:10px;color:black;font-size:large;font-weight:bold;width:140px;overflow:hidden;\">{4}</span>", (dv5[m]["Education21SideName"].ToString().Length > 60 ? dv5[m]["Education21SideName"].ToString().Substring(0, 60) + "..." : dv5[m]["Education21SideName"]), dv5[m]["Education21SideName"].ToString(), sdFullScore.ToString("#,##0.00"), sdScore.ToString("#,##0.00"), ""); //tNode.Text = dv[i]["StandardName"].ToString(); tNodeSide.Value = dv5[m]["Education21SideID"].ToString(); AddChildStandard(tNodeSide); if (EvaluateType == 0) { TreeView1.Nodes.Add(tNodeSide); } if (EvaluateType == 1) { TreeView2.Nodes.Add(tNodeSide); } } if (EvaluateType == 0) { TreeView1.CollapseAll(); TreeView1.NodeStyle.Width = new Unit("100%"); lblSumSide1.Text = string.Format("<img src=\"../Image/MenuStlye/M7.png\" style=\"float:left;border:none;width:25px;height:28px;\"/> <span style=\"color:black;font-size:x-large;font-weight:bold;width:600px;overflow:hidden;\" title=\"รวม\">{0}</span><span style=\"width:80px; text-align:right; float:right; margin:0 25px 0 0; color:black; font-size:24px; font-weight:bold;text-align:right;\">{2}</span><span style=\"width:80px; text-align:right;float:Right; margin:0 40px 0 0; color:black; font-size:24px; font-weight:bold;text-align:right;\">{1}</span><span style=\"float:right; padding:0 125px 0 0; color:#000000; font-size:x-large; font-weight:bold;\"></span><p style=\"clear:both; float:none;\"></p><hr /><br />", "รวมประเมินวิธีการทั้ง " + dv5.Count.ToString("0") + " ด้าน", SideFullScore.ToString("#,##0.00"), SideScore.ToString("#,##0.00")); } if (EvaluateType == 1) { TreeView2.CollapseAll(); TreeView2.NodeStyle.Width = new Unit("100%"); lblSumSide2.Text = string.Format("<img src=\"../Image/MenuStlye/M7.png\" style=\"float:left;border:none;width:25px;height:28px;\"/> <span style=\"color:black;font-size:x-large;font-weight:bold;width:600px;overflow:hidden;\" title=\"รวม\">{0}</span><span style=\"width:80px; text-align:right; float:right; margin:0 25px 0 0; color:black; font-size:24px; font-weight:bold;text-align:right;\">{2}</span><span style=\"width:80px; text-align:right;float:Right; margin:0 40px 0 0; color:black; font-size:24px; font-weight:bold;text-align:right;\">{1}</span><span style=\"float:right; padding:0 125px 0 0; color:#000000; font-size:x-large; font-weight:bold;\"></span><p style=\"clear:both; float:none;\"></p><hr /><br />", "รวมประเมินผลงานทั้ง " + dv5.Count.ToString("0") + " ด้าน", SideFullScore.ToString("#,##0.00"), SideScore.ToString("#,##0.00")); } TotalScore += SideScore; TotalFullScore += SideFullScore; }