Ejemplo n.º 1
0
        private void Init()
        {
            this.tvRevisions.Nodes.Clear();
            foreach (DrawingRev r in revSet)
            {
                TreeNode tnList = new TreeNode(propertySet.CutlistData.GetAuthorFullName(r.List.Value));
                TreeNode tnDate = new TreeNode(r.Date.Value);
                TreeNode tnECO  = new TreeNode(r.Eco.Value);
                TreeNode tnC    = new TreeNode(r.Revision.Value);
                int      test   = 0;
                eco      e      = new eco();
                e = cd.GetECOData(r.Eco.Value);

                if (int.TryParse(r.Eco.Value, out test) && test > cd.GetLastLegacyECR())
                {
                    TreeNode tnD  = new TreeNode("Error Description: " + e.ErrDescription, 0, 0);
                    TreeNode tnRB = new TreeNode("Requested by: " + e.RequestedBy, 0, 0);
                    TreeNode tnR  = new TreeNode("Revision Description:" + e.Revision, 0, 0);
                    TreeNode tnS  = new TreeNode("Status: " + e.Status, 0, 0);

                    if ((e.Changes != null) && e.Changes.Contains("\n"))
                    {
                        List <TreeNode> nodes       = new List <TreeNode>();
                        string[]        changeNodes = e.Changes.Split('\n');
                        foreach (string s in changeNodes)
                        {
                            nodes.Add(new TreeNode(s));
                        }
                        tnC = new TreeNode("Changes ", nodes.ToArray());
                    }
                    else
                    {
                        tnC = new TreeNode("Changes: " + e.Changes);
                    }
                    TreeNode[] ts     = { tnC, tnD, tnRB, tnR, tnS };
                    TreeNode   tnDesc = new TreeNode(r.Description.Value);
                    tnECO = new TreeNode(r.Eco.Value, ts);
                    TreeNode[] tt = { tnECO, tnDesc, tnList, tnDate };
                    TreeNode   tn = new TreeNode(r.Revision.Value, tt);
                    this.tvRevisions.Nodes.Add(tn);
                }
                else if (r.Eco.Value.Contains("NA") || r.Eco.Value.Trim().Equals(string.Empty))
                {
                    tnECO = new TreeNode(r.Eco.Value);
                    TreeNode   tnDesc = new TreeNode(r.Description.Value);
                    TreeNode[] tt     = { tnECO, tnDesc, tnList, tnDate };

                    TreeNode tn = new TreeNode(r.Revision.Value, tt);
                    this.tvRevisions.Nodes.Add(tn);
                }
                else
                {
                    if ((e.Changes != null) && e.Changes.Contains("\n"))
                    {
                        List <TreeNode> nodes       = new List <TreeNode>();
                        string[]        changeNodes = e.Changes.Split('\n');
                        foreach (string s in changeNodes)
                        {
                            nodes.Add(new TreeNode(s));
                        }
                        tnC = new TreeNode("Changes ", nodes.ToArray());
                    }
                    else
                    {
                        tnC = new TreeNode("Changes: " + e.Changes);

                        TreeNode tnRB          = new TreeNode("Finished by: " + e.RequestedBy, 0, 0);
                        string[] affectedParts = e.Revision.Split(',', '&');
                        TreeNode tnT           = new TreeNode("");

                        List <TreeNode> nodes = new List <TreeNode>();
                        foreach (string item in affectedParts)
                        {
                            nodes.Add(new TreeNode(item.Trim()));
                        }
                        TreeNode tnR = new TreeNode("Affected Parts:", nodes.ToArray());

                        TreeNode   tnS = new TreeNode("Status: " + e.Status, 0, 0);
                        TreeNode[] ts  = { tnC, tnRB, tnR, tnS };
                        tnECO = new TreeNode(r.Eco.Value, ts);

                        TreeNode   tnDesc = new TreeNode(r.Description.Value);
                        TreeNode[] tt     = { tnECO, tnDesc, tnList, tnDate };

                        TreeNode tn = new TreeNode(r.Revision.Value, tt);
                        this.tvRevisions.Nodes.Add(tn);
                    }
                }
            }
        }