Exemplo n.º 1
0
 /// <summary>
 /// プロセスモデルを1次元にて取得する
 /// </summary>
 /// <returns></returns>
 public List <ProcessModel> GetOneDimensionProcessModelList()
 {
     try
     {
         List <ProcessModel> list = new List <ProcessModel>();
         foreach (var id in NodeIdList)
         {
             var proc = ProcessModelList.FirstOrDefault(a => a.ProcessId == id);
             if (proc != null)
             {
                 list.Add(proc);
             }
             else
             {
                 var macro = MacroModelList.FirstOrDefault(a => a.ProjectId == id);
                 if (macro != null)
                 {
                     foreach (var macroId in macro.NodeIdList)
                     {
                         var proc2 = macro.ProcessModelList.FirstOrDefault(a => a.ProcessId == macroId);
                         if (proc2 != null)
                         {
                             list.Add(proc2);
                         }
                     }
                 }
             }
         }
         return(list);
     }
     catch (Exception ex)
     {
         throw Program.ThrowException(ex);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// ツリーノードを再帰的に作成する
 /// </summary>
 /// <param name="node"></param>
 /// <param name="procList"></param>
 public void CreateChildNode(TreeNode node)
 {
     try
     {
         for (int i = 0; i < NodeIdList.Count; i++)
         {
             string       id        = NodeIdList[i];
             ProcessModel procModel = ProcessModelList.FirstOrDefault(a => a.ProcessId == id);
             if (procModel != null)
             {
                 TreeNode newNode = new TreeNode(procModel.Name);
                 newNode.Tag                = procModel;
                 newNode.ImageIndex         = GetImageIndex(procModel.ProcessType);
                 newNode.SelectedImageIndex = newNode.ImageIndex;
                 node.Nodes.Add(newNode);
                 continue;
             }
             ProjectModel projModel = MacroModelList.FirstOrDefault(a => a.ProjectId == id);
             if (projModel != null)
             {
                 TreeNode newNode = new TreeNode(projModel.Name);
                 newNode.Tag                = projModel;
                 newNode.ImageIndex         = 1;
                 newNode.SelectedImageIndex = 1;
                 node.Nodes.Add(newNode);
                 projModel.CreateChildNode(newNode);
                 continue;
             }
             //該当しない場合は削除する
             NodeIdList.RemoveAt(i);
             i--;
         }
     }
     catch (Exception ex)
     {
         throw Program.ThrowException(ex);
     }
 }