Beispiel #1
0
        private void FrmTree_Load(object sender, EventArgs e)
        {
            var sw = new Stopwatch();

            sw.Start();

            SelectOptionsFromRegistry();

            taxonomyTree.LoadProject();

            //Text = string.Format("Tree View - {0}", AryaTools.Instance.InstanceData.CurrentProject.ProjectDescription);
            // Use Publish Version on Deployed Applications
            Text = string.Format("Tree - {0} {1}{2}", Assembly.GetExecutingAssembly().GetName().Name,
                                 ApplicationDeployment.IsNetworkDeployed
                    ? ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
                    : "Not Deployed",
                                 AryaTools.Instance.InstanceData.CurrentUser.IsAryaReadOnly ? " - Read Only" : string.Empty);

            SnapToLeftInNewScreen();

            //taxonomyTree.OnTaxonomySelected = UpdateCurrentVocabularyContext;
            taxonomyTree.OnTaxonomyOpen = OpenTaxonomyNodeForAttributeNormalization;

            taxonomyTree.OnTaxonomyMove  = MoveTaxonomyNode;
            taxonomyTree.OnCrossListNode = CrossListHere;

            if (taxonomyTree.SelectedTaxonomy == null)
            {
                var taxId = WindowsRegistry.GetFromRegistry(WindowsRegistry.RegistryKeyCurrentTaxonomy);
                if (taxId != null)
                {
                    try
                    {
                        var taxonomyId = new Guid(taxId);
                        //previous selected Taxonomy
                        taxonomyTree.SelectedTaxonomy =
                            taxonomyTree.Taxonomies.Select(tax => tax.Key)
                            .FirstOrDefault(tax => tax.ID.Equals(taxonomyId));
                    }
                    catch
                    {
                    }
                }
            }

            autoSaveToolStripMenuItem.Checked = AryaTools.Instance.AutoSave;

            taxonomyTree.updateNodeTimer.Start();

            sw.Stop();
            Diagnostics.WriteMessage("*Loading Project Tree", "FrmTree - taxonomyTree.LoadProject()", sw.Elapsed);
            sw.Reset();
            Show();
            BringToFront();
            if (!AryaTools.Instance.InstanceData.CurrentUser.IsProjectAdmin)
            {
                projectMetaAttributesToolStripMenuItem.Enabled   = false;
                projectCustomDictionaryToolStripMenuItem.Enabled = false;
            }
        }
Beispiel #2
0
        private static void DoLaundry()
        {
            // Easter Egg - Time to do your laundry - once every 7 days
            DateTime now    = DateTime.Now;
            var      quotes = new[]
            {
                "It's our fundamental guiding principle: provide elegant product data solutions for our clients. Our expertise in data management, data quality, search and navigation drive online revenue and create a customer experience that is intuitive, efficient and rewarding.",
                "Some might call us Data Geeks. And we are. But our team of architects and analysts are also journalists, librarians, linguists, IT ninjas, usability experts, MRO aficionados and more. We love data and it shows in our work habits, culture and success with our clients.",
                "Nobody will tell you that your website is dysfunctional (they'll just shop somewhere else).",
                "Customers don't buy products when they think they have found the right item. They buy when they know they have.",
                "Fixing data problems can be a bit like plugging a hole in a leaky bucket; as soon as you cover one issue, another emerges to take its place."
            };
            DateTime     dtLastLaundry;
            const string lastLaundryDateRegistryKey = "LastLaundry";
            string       lastLaundryDate            = WindowsRegistry.GetFromRegistry(lastLaundryDateRegistryKey);

            try
            {
                dtLastLaundry = DateTime.Parse(lastLaundryDate);
            }
            catch
            {
                dtLastLaundry = now.Subtract(TimeSpan.FromDays(8));
            }
            if (now - dtLastLaundry > TimeSpan.FromDays(7))
            {
                var randomQuote = quotes[new Random(now.Millisecond).Next(quotes.Length)];
                var result      = MessageBox.Show(randomQuote, @"Arya quote");
                WindowsRegistry.SaveToRegistry(lastLaundryDateRegistryKey, now.ToString());
            }
        }
Beispiel #3
0
        private void SelectOptionsFromRegistry()
        {
            var includeChildrenTaxnNorm = WindowsRegistry.GetFromRegistry(RegistryKeyIncludeChildren);

            if (!string.IsNullOrEmpty(includeChildrenTaxnNorm) && includeChildrenTaxnNorm.Equals(true.ToString()))
            {
                IncludeChildren = true;
            }

            var selectMultipleTaxnNorm = WindowsRegistry.GetFromRegistry(RegistryKeyLoadMultiple);

            if (!string.IsNullOrEmpty(selectMultipleTaxnNorm) && selectMultipleTaxnNorm.Equals(true.ToString()))
            {
                LoadToOneTab = true;
            }
        }
Beispiel #4
0
        private void reloadTaxonomyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            taxonomyTree.ResetSkuCount(null);

            taxonomyTree.updateNodeTimer.Stop();

            _pnlSpecialButtons.SuspendLayout();
            _tableSpecialButtons.SuspendLayout();
            taxonomyMenuStrip.SuspendLayout();
            SuspendLayout();

            Controls.Remove(taxonomyTree);
            Controls.Remove(_pnlSpecialButtons);
            Controls.Remove(taxonomyMenuStrip);
            taxonomyTree = null;

            taxonomyTree = new TaxonomyTreeView
            {
                AutoSize              = true,
                AutoSizeMode          = AutoSizeMode.GrowAndShrink,
                Dock                  = DockStyle.Fill,
                Font                  = new Font("Microsoft Sans Serif", 8.75F),
                Location              = new Point(0, 24),
                Name                  = "taxonomyTree",
                OpenNodeOptionEnabled = true,
                ShowEnrichments       = showEnrichmentsToolStripMenuItem.Checked,
                Padding               = new Padding(3),
                Size                  = new Size(312, 390),
                TabIndex              = 0
            };

            Controls.Add(taxonomyTree);
            Controls.Add(_pnlSpecialButtons);
            Controls.Add(taxonomyMenuStrip);

            _pnlSpecialButtons.ResumeLayout(false);
            _tableSpecialButtons.ResumeLayout(false);
            _tableSpecialButtons.PerformLayout();
            taxonomyMenuStrip.ResumeLayout(false);
            taxonomyMenuStrip.PerformLayout();
            ResumeLayout(false);
            PerformLayout();

            taxonomyTree.LoadProject();

            taxonomyTree.OnTaxonomyOpen = OpenTaxonomyNodeForAttributeNormalization;

            taxonomyTree.OnTaxonomyMove  = MoveTaxonomyNode;
            taxonomyTree.OnCrossListNode = CrossListHere;

            if (taxonomyTree.SelectedTaxonomy == null)
            {
                var taxId = WindowsRegistry.GetFromRegistry(WindowsRegistry.RegistryKeyCurrentTaxonomy);
                if (taxId != null)
                {
                    try
                    {
                        var taxonomyId = new Guid(taxId);
                        //previous selected Taxonomy
                        taxonomyTree.SelectedTaxonomy =
                            taxonomyTree.Taxonomies.Select(tax => tax.Key)
                            .FirstOrDefault(tax => tax.ID.Equals(taxonomyId));
                    }
                    catch
                    {
                    }
                }
            }

            taxonomyTree.updateNodeTimer.Start();
        }
Beispiel #5
0
        private void GetProjects()
        {
            if (AryaTools.Instance.InstanceData.CurrentUser == null)
            {
                MessageBox.Show(@"Cannot choose a project without logging in!");
                Close();
                return;
            }

            var allUserGroups =
                AryaTools.Instance.InstanceData.CurrentUser.UserProjects.Select(p => p.GroupID).Distinct().ToList();

            lnkAdminView.Visible = AryaTools.Instance.InstanceData.CurrentUser.IsAdmin ||
                                   allUserGroups.Contains(Group.RoleManagerGroup) ||
                                   allUserGroups.Contains(Group.PermissionsManagerGroup);

            //this will be ovverwritten when project is selected with Project specific groups
            AryaTools.Instance.InstanceData.CurrentUser.UserGroups = allUserGroups;

            var availableProjects =
                AryaTools.Instance.InstanceData.Dc.ExecuteQuery <Project>(
                    @"SELECT *
                    FROM Project
                    WHERE ID IN (
                        SELECT DISTINCT p.ID
                        FROM UserProject up
                        INNER JOIN Project p ON up.ProjectID = p.ID
                        WHERE up.UserID = {0}
                        AND EXISTS (
                            SELECT database_id FROM sys.databases sd WHERE sd.Name = p.DatabaseName
                        )
                    ) ORDER BY ClientDescription + ' ' + SetName
                   ", AryaTools.Instance.InstanceData.CurrentUser.ID).ToList();

            switch (availableProjects.Count)
            {
            case 0:
                MessageBox.Show(@"There are no projects configured for you.", "Arya");
                break;

            //case 1:
            //    AryaTools.Instance.InstanceData.CurrentProject = availableProjects.First();
            //    if (_firstTime)
            //    {
            //        DialogResult = DialogResult.OK;

            //        ddlSelectProject.DataSource = availableProjects;
            //        ddlSelectProject.DisplayMember = "ProjectDescription";
            //        //SelectProject();
            //    }
            //    else
            //    {
            //        MessageBox.Show(
            //            string.Format(
            //                "You have access to only one project: {0} {1}",
            //                AryaTools.Instance.InstanceData.CurrentProject.ClientDescription,
            //                AryaTools.Instance.InstanceData.CurrentProject.SetName));
            //        DialogResult = DialogResult.Cancel;
            //    }
            //    //Close();
            //    break;

            default:
                ddlSelectProject.DataSource    = availableProjects;
                ddlSelectProject.DisplayMember = "ProjectDescription";
                break;
            }

            if (WindowsRegistry.GetFromRegistry(WindowsRegistry.RegistryKeyProject) != null &&
                availableProjects.Exists(
                    prj => prj.ProjectName.Equals(WindowsRegistry.GetFromRegistry(WindowsRegistry.RegistryKeyProject))))
            {
                ddlSelectProject.SelectedItem =
                    availableProjects.First(
                        prj =>
                        prj.ProjectName.Equals(WindowsRegistry.GetFromRegistry(WindowsRegistry.RegistryKeyProject)));
                //if (AryaTools.Instance.AutoLogin)
                //    SelectProject();
            }
        }