Пример #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            StagingEntities stagingEntities = new StagingEntities();

            foreach (UserAccount userAccount in stagingEntities.UserAccounts)
            {
                if (this.uxCollectionTreeView.Nodes.Find(userAccount.Region.Name, false).Count() == 0)
                {
                    TreeNode regionNode = new TreeNode(userAccount.Region.Name);
                    regionNode.Name = userAccount.Region.Name;

                    this.uxCollectionTreeView.Nodes.Add(regionNode);
                }

                TreeNode usersRegionNode = this.uxCollectionTreeView.Nodes.Find(userAccount.Region.Name, false)[0];

                if (usersRegionNode.Nodes.Find(userAccount.SBU.Name, false).Count() == 0)
                {
                    TreeNode sbuNode = new TreeNode(userAccount.SBU.Name);
                    sbuNode.Name = userAccount.SBU.Name;

                    usersRegionNode.Nodes.Add(sbuNode);
                }

                TreeNode usersSBUNode = usersRegionNode.Nodes.Find(userAccount.SBU.Name, false)[0];

                if (usersSBUNode.Nodes.Find(userAccount.Username, false).Count() == 0)
                {
                    TreeNode userAccountNode = new TreeNode(userAccount.Username);
                    userAccountNode.Name = userAccount.Username;
                    userAccountNode.Tag = userAccount;

                    usersSBUNode.Nodes.Add(userAccountNode);
                }

                TreeNode usersUserAccountNode = usersSBUNode.Nodes.Find(userAccount.Username, false)[0];

                usersUserAccountNode.Nodes.Add("");
            }
        }
Пример #2
0
        private void testMethodToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StagingEntities stagingEntities = new StagingEntities();

            int totalFormulationCount = stagingEntities.Formulations.Count();
            int formulationCounter = 0;

            Console.WriteLine("Formulation Count: " + totalFormulationCount);

            if (Directory.Exists(_xmlDirectory))
                Directory.Delete(_xmlDirectory, true);

            foreach (Formulation formulation in stagingEntities.Formulations.Where(w => w.CreatedBy == "STRAITKM").Take(100))
            {
                string a = formulation.RequestedByUserAccount.Region.Name;
                a = formulation.RequestedByUserAccount.SBU.Name;

                XDocument formulationDocument = GetFormulationDocument(formulation);
                if (!Directory.Exists(_xmlDirectory + formulation.CreatedBy))
                {
                    Directory.CreateDirectory(_xmlDirectory + formulation.CreatedBy);
                }
                formulationDocument.Save(_xmlDirectory + formulation.CreatedBy + @"\" + formulation.MaterialName + @".xml");

                formulationCounter++;

                Console.WriteLine(formulationCounter + " out of " + totalFormulationCount + " exported. " + ((float)formulationCounter/totalFormulationCount) + "% complete.");
            }
        }