Example #1
0
        public void updateStageProject()
        {
            TreeModel model = new TreeModel();

            treeProject.Model = model;

            treeProject.BeginUpdate();
            InvestProjectDAO     daoProject   = new InvestProjectDAO();
            StageProjectDAO      dao          = new StageProjectDAO();
            List <InvestProject> listProject  = daoProject.getAll();
            List <StageProject>  listStage    = null;
            List <StageProject>  listSubStage = null;

            foreach (InvestProject project in listProject)
            {
                listStage    = dao.getByProject(project.idProject);
                listSubStage = dao.getSubStageProject(project.idProject);
                Node nodeProject = new StageProjectNode(project.nameProject, "", project.dateBegin.ToShortDateString(), project.dateEnd.ToShortDateString(), project.dateBeginProg.ToShortDateString(), project.dateEndProg.ToShortDateString(), "", "", "", "", null);
                foreach (StageProject stage in listStage)
                {
                    Node node = new StageProjectNode(stage.NameStage, stage.CommentUser, stage.DateBeginPlan.ToShortDateString(), stage.DateEndPlan.ToShortDateString(), stage.DateBeginProg.ToShortDateString(), stage.DateEndProg.ToShortDateString(), stage.DateBeginUser.ToShortDateString(), stage.DateEndUser.ToShortDateString(), stage.User.FullName, stage.StatusStage.ToString(), stage);
                    nodeProject.Nodes.Add(node);
                    foreach (StageProject child in stage.SubStage)
                    {
                        Node childNode = new StageProjectNode(child.NameStage, child.CommentUser, child.DateBeginPlan.ToShortDateString(), child.DateEndPlan.ToShortDateString(), child.DateBeginProg.ToShortDateString(), child.DateEndProg.ToShortDateString(), child.DateBeginUser.ToShortDateString(), child.DateEndUser.ToShortDateString(), child.User.FullName, child.StatusStage.ToString(), child);
                        node.Nodes.Add(childNode);
                    }
                    model.Nodes.Add(nodeProject);
                }
            }

            treeProject.EndUpdate();
        }
 public void updateStageProject()
 {
     if (dataGridInvestProject.CurrentRow.DataBoundItem != null)
     {
         InvestProject       ip           = (InvestProject)((BindingSource)dataGridInvestProject.DataSource).Current;
         StageProjectDAO     dao          = new StageProjectDAO();
         List <StageProject> listProject  = dao.getByProject(ip.idProject);
         List <StageProject> listSubStage = dao.getSubStageProject(ip.idProject);
         TreeModel           model        = new TreeModel();
         treeViewAdv1.Model = model;
         treeViewAdv1.BeginUpdate();
         foreach (StageProject stage in listProject)
         {
             Node node = new StageProjectNode(stage.NameStage, stage.CommentUser, stage.DateBeginPlan.ToShortDateString(), stage.DateEndPlan.ToShortDateString(), stage.DateBeginProg.ToShortDateString(), stage.DateEndProg.ToShortDateString(), stage.DateBeginUser.ToShortDateString(), stage.DateEndUser.ToShortDateString(), stage.User.FullName, stage.StatusStage.ToString(), stage);
             foreach (StageProject child in stage.SubStage)
             {
                 Node childNode = new StageProjectNode(child.NameStage, child.CommentUser, child.DateBeginPlan.ToShortDateString(), child.DateEndPlan.ToShortDateString(), child.DateBeginProg.ToShortDateString(), child.DateEndProg.ToShortDateString(), child.DateBeginUser.ToShortDateString(), child.DateEndUser.ToShortDateString(), child.User.FullName, child.StatusStage.ToString(), child);
                 node.Nodes.Add(childNode);
             }
             model.Nodes.Add(node);
         }
         treeViewAdv1.EndUpdate();
     }
 }