/// <summary> /// Get card manager list /// </summary> /// <param name="nodeName"></param> /// <returns></returns> public void LoadTreeData() { //if (tvProcessPlanningModule.InvokeRequired) //{ // LoadTreeEventHandler loadtreeEventHandler = new LoadTreeEventHandler(() => // { try { List <Model.ProcessPlanningModule> processPlanningModuleList = ProcessPlanningModuleBLL.GetProcesPlanningModuleList(0); //if (processPlanningModuleList.Count <= 0) return; //如果数据库内没有工艺规程模版记录,则默认增加一条root记录 if (processPlanningModuleList.Count <= 0) { processPlanningModuleList = new List <ProcessPlanningModule>(); ProcessPlanningModule planningModule = new ProcessPlanningModule(); planningModule.BusinessId = Guid.NewGuid(); planningModule.Name = "工艺规程模板"; planningModule.BType = 0; planningModule.ParentNode = 0; planningModule.Sort = 1; int currentNode = ProcessPlanningModuleBLL.AddProcessPlanningModule(planningModule); planningModule.CurrentNode = currentNode; processPlanningModuleList.Add(planningModule); } Model.ProcessPlanningModule processPlanningModule = processPlanningModuleList[0]; TreeNode root = new TreeNode(); root.Text = processPlanningModule.Name; root.Tag = processPlanningModule.BusinessId + "@" + processPlanningModule.CurrentNode.ToString(); root.ImageKey = "folder"; root.Name = processPlanningModule.Sort.ToString(); //processPlanningModule.CurrentNode.ToString(); root.Expand(); ShowChildNode(root); tvProcessPlanningModule.Nodes.Add(root); } catch (Exception ex) { MessageBox.Show(ex.Message); } //}); //tvProcessPlanningModule.BeginInvoke(loadtreeEventHandler, new object[] { }); //} }
/// <summary> /// 加载规程模版卡片 /// </summary> private void LoadPlanningTreeData() { try { List <Model.ProcessPlanningModule> processPlanningModuleList = ProcessPlanningModuleBLL.GetProcesPlanningModuleList(0); //if (processPlanningModuleList.Count <= 0) return; //如果数据库内没有工艺规程模版记录,则默认增加一条root记录 if (processPlanningModuleList.Count <= 0) { processPlanningModuleList = new List <Model.ProcessPlanningModule>(); Model.ProcessPlanningModule planningModule = new Model.ProcessPlanningModule(); planningModule.BusinessId = Guid.NewGuid(); planningModule.Name = "工艺规程模板"; planningModule.BType = 0; planningModule.ParentNode = 0; planningModule.Sort = 1; int currentNode = ProcessPlanningModuleBLL.AddProcessPlanningModule(planningModule); planningModule.CurrentNode = currentNode; processPlanningModuleList.Add(planningModule); } Model.ProcessPlanningModule processPlanningModule = processPlanningModuleList[0]; TreeNode root = new TreeNode(); root.Text = processPlanningModule.Name; root.Tag = processPlanningModule.BusinessId; root.ImageKey = "folder"; root.Name = processPlanningModule.CurrentNode.ToString(); root.Expand(); ShowPlanningChildNode(root); tvProcessPlanningModule.Nodes.Add(root); } catch (Exception ex) { MessageBox.Show(ex.Message); } }