Exemplo n.º 1
0
        private void AddTemplateBtn_OnClick(object sender, RoutedEventArgs e)
        {
            NewTemplate addingNewTemplate = new NewTemplate();

            addingNewTemplate.ShowDialog();

            if (!string.IsNullOrWhiteSpace(addingNewTemplate.NewTemplateName))
            {
                TemplateObj newTemplate = new TemplateObj(addingNewTemplate.NewTemplateName);
                newTemplate.Add(new TemplateContentObj("verification"));
                newTemplate.Add(new TemplateContentObj("Plan", "verification"));
                newTemplate.Add(new TemplateContentObj("Report", "verification"));
                newTemplate.Add(new TemplateContentObj("SAP"));
                newTemplate.Add(new TemplateContentObj("Approvals", "SAP"));
                newTemplate.Add(new TemplateContentObj("Documentation"));


                allTemplates.Add(newTemplate);

                TemplateList.ItemsSource = allTemplates;
                TemplateList.Items.Refresh();
            }



            //CreateProject(allTemplates.First(item => item.TemplateName == title));
        }
Exemplo n.º 2
0
        public void UpdateTreeView(TemplateObj updateWith)
        {
            List <TreeViewItem> bindingtoTree = new List <TreeViewItem>();

            foreach (var contentobj in updateWith)
            {
                if (contentobj.ContentInGroupOf == "")
                {
                    TreeViewItem group = new TreeViewItem();
                    group.Header = contentobj.ContentName;
                    bindingtoTree.Add(group);
                }
                else
                {
                    var subItemIs = new TreeViewItem {
                        Header = contentobj.ContentName
                    };

                    var groupSubItemWillAddTo = bindingtoTree.First(item => (string)item.Header == contentobj.ContentInGroupOf);
                    groupSubItemWillAddTo.Items.Add(subItemIs);
                }
            }

            TemplateContentView.ItemsSource = bindingtoTree;
            TemplateContentView.Items.Refresh();
        }
Exemplo n.º 3
0
        private void CreateProject(TemplateObj projectTemp)
        {
            try
            {
                var ecoNum = GetEcoNumber();

                if (isEcoValid(ecoNum))
                {
                    var topLevelProjectFolder = Path.Combine(projectFolderPathTest, ecoNum);


                    if (!System.IO.Directory.Exists(topLevelProjectFolder))
                    {
                        System.IO.Directory.CreateDirectory(topLevelProjectFolder);

                        var ecoFolders = projectTemp.EcoNumUpdate(ecoNum);

                        foreach (var folder in ecoFolders)
                        {
                            if (folder.ContentInGroupOf == "")
                            {
                                System.IO.Directory.CreateDirectory(Path.Combine(topLevelProjectFolder, folder.ContentName));
                            }
                            else
                            {
                                var newPath = Path.Combine(topLevelProjectFolder, folder.ContentInGroupOf);
                                newPath = Path.Combine(newPath, folder.ContentName);

                                Directory.CreateDirectory(newPath);
                            }
                        }

                        MessageBox.Show($"Created Project for ECO {ecoNum}");
                    }
                    else
                    {
                        MessageBox.Show($"Project {ecoNum} folders already exist");
                    }
                }
                else
                {
                    MessageBox.Show("No ECO number Provided");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        public TemplateObj EcoNumUpdate(string ecoNumber)
        {
            var newName         = $"{ecoNumber} {TemplateName}";
            var templateWithECO = new TemplateObj(newName);

            foreach (var content in _templateList)
            {
                if (content.ContentInGroupOf == "")
                {
                    templateWithECO.Add(new TemplateContentObj($"{ecoNumber} {content.ContentName}", $""));
                }
                else
                {
                    templateWithECO.Add(new TemplateContentObj($"{ecoNumber} {content.ContentName}", $"{ecoNumber} {content.ContentInGroupOf}"));
                }
            }

            return(templateWithECO);
        }