protected void tvTrainTypeMoveCallBack_Callback(object sender, CallBackEventArgs e) { ComponentArt.Web.UI.TreeViewNode node = tvTrainType.FindNodeById(e.Parameters[0]); if (node != null && e.Parameters[1] == "CanMoveUp") { if (node.PreviousSibling != null) { hfCanMove.Value = "true"; hfCanMove.RenderControl(e.Output); } else { hfCanMove.Value = string.Empty; hfCanMove.RenderControl(e.Output); } } else if (node != null && e.Parameters[1] == "CanMoveDown") { if (node.NextSibling != null) { hfCanMove.Value = "true"; hfCanMove.RenderControl(e.Output); } else { hfCanMove.Value = string.Empty; hfCanMove.RenderControl(e.Output); } } }
private void GenerateInformationTree(ComponentArt.Web.UI.TreeViewNode parentNode) { string parentID = parentNode == null ? "0" : parentNode.ID; string sql = String.Format( "select information_system_id," + " parent_id," + " information_system_name" + " from INFORMATION_SYSTEM t" + " where (parent_id = {0})" + " order by order_index", parentID); OracleAccess ora = new OracleAccess(); DataSet ds = ora.RunSqlDataSet(sql); foreach (DataRow row in ds.Tables[0].Rows) { ComponentArt.Web.UI.TreeViewNode newNode = new TreeViewNode(); newNode.ID = Convert.ToString(row["information_system_id"]); newNode.Text = Convert.ToString(row["information_system_name"]); if (parentNode == null) { tvInformation.Nodes.Add(newNode); } else { parentNode.Nodes.Add(newNode); } GenerateInformationTree(newNode); } }
private void LoadProcesses() { IProcess engineProcess = new IProcess(HELPERS.NewOdbcConn()); returnListProcess[] allprocs = engineProcess.ListProcess(null, "", new string[] { }, "c_u_Name asc"); foreach (returnListProcess cur in allprocs) { if (cur.Name == "-") { continue; } if (cur.Name.ToLower() == "(internal use)") { continue; } ComponentArt.Web.UI.TreeViewNode rootNode = new ComponentArt.Web.UI.TreeViewNode(); rootNode.Text = cur.Name; rootNode.Expanded = false; rootNode.ImageUrl = "folder.gif"; rootNode.ShowCheckBox = false; MEGATREE.Nodes.Add(rootNode); LoadSubProcesses(cur.ID, rootNode); } }
private void PopulateChildNodes(CompArt.TreeViewNode parentNode, bool ImmediateChildrenOnly) { CompArt.TreeViewNode tvNode; switch (parentNode.Depth) { //Attendance type category case (int)DestinationLevel.AttendanceTypeCat: // 0 //Add attendance types if (!parentNode.Expanded) { foreach (Occurrence attType in GetAttendanceTypes(int.Parse(parentNode.Value))) { //Add attendance type tvNode = new CompArt.TreeViewNode() { Text = attType.AttendanceTypeName, Value = attType.AttendanceTypeId.ToString(), Selectable = true }; if (!ImmediateChildrenOnly) { //Add occurrences under attendance type foreach (Occurrence occurrence in GetOccurrences(attType.AttendanceTypeId)) { tvNode.Nodes.Add(new CompArt.TreeViewNode() { Text = occurrence.Name + " - " + occurrence.Location, Value = occurrence.Id.ToString(), Selectable = true }); } parentNode.Nodes.Add(tvNode); } } } break; //Attendance type case (int)DestinationLevel.AttendanceType: //1: break; //Occurrence case (int)DestinationLevel.Occurrence: //2: break; default: break; } }
private void LoadSubProcesses(int idProc, TreeViewNode nodeProc) { ISubProcess engineProcess = new ISubProcess(HELPERS.NewOdbcConn()); returnListSubProcessByProcess[] allprocs = engineProcess.ListSubProcessByProcess (null, "\"Status\" = ?", new string[] { "Active" }, "c_u_Name asc", idProc); foreach (returnListSubProcessByProcess cur in allprocs) { ComponentArt.Web.UI.TreeViewNode rootNode = new ComponentArt.Web.UI.TreeViewNode(); rootNode.Text = cur.Name; rootNode.Expanded = false; rootNode.ImageUrl = "folder.gif"; rootNode.ShowCheckBox = true; rootNode.ID = "SP/" + cur.ID; rootNode.ContentCallbackUrl = "XMLtree_RolesInSubprocess.ashx?subproc=" + cur.ID; nodeProc.Nodes.Add(rootNode); } }
public static void BuildComponentArtTreeView(ComponentArt.Web.UI.TreeView tvTargetTree, IList list, string strIdProperty, string strParentIdProperty, string strTextProperty, string strTooltipProperty, string strValueProperty, string strNavigateUrlProperty, string strImageUrlProperty, string strTarget) { ComponentArt.Web.UI.TreeViewNode node = null; if (list.Count > 0) { Type objType = list[0].GetType(); string strParentId = string.Empty; foreach (object o in list) { node = new TreeViewNode(); // ID if (string.IsNullOrEmpty(strIdProperty)) { throw new Exception("树节点ID属性不能为空!"); } node.ID = objType.GetProperty(strIdProperty).GetValue(o, null).ToString(); // ParentId if (string.IsNullOrEmpty(strParentIdProperty)) { throw new Exception("树节点父ID属性不能为空!"); } strParentId = objType.GetProperty(strParentIdProperty).GetValue(o, null).ToString(); // Text if (string.IsNullOrEmpty(strTextProperty)) { throw new Exception("树节点Text属性不能为空!"); } node.Text = objType.GetProperty(strTextProperty).GetValue(o, null).ToString(); // Tooltip if (!string.IsNullOrEmpty(strTooltipProperty)) { node.ToolTip = objType.GetProperty(strTooltipProperty).GetValue(o, null).ToString(); } // Value if (!string.IsNullOrEmpty(strValueProperty)) { node.Value = objType.GetProperty(strValueProperty).GetValue(o, null).ToString(); } else { node.Value = objType.GetProperty(strValueProperty).GetValue(o, null).ToString(); } // NavigateUrl if (!string.IsNullOrEmpty(strNavigateUrlProperty)) { node.NavigateUrl = objType.GetProperty(strNavigateUrlProperty).GetValue(o, null).ToString(); } // ImageUrl if (!string.IsNullOrEmpty(strImageUrlProperty)) { node.ImageUrl = objType.GetProperty(strImageUrlProperty).GetValue(o, null).ToString(); } // Target if (!string.IsNullOrEmpty(strTarget)) { node.Target = objType.GetProperty(strTarget).GetValue(o, null).ToString(); } // Append node if (strParentId == "0") {// Root node tvTargetTree.Nodes.Add(node); } else { tvTargetTree.FindNodeById(strParentId).Nodes.Add(node); } } } }