예제 #1
0
        private void ApplySettings(ProjectSize projectSize, IndexCreationInfo indexCreationInfo)
        {
            bool fetchPreview   = false;
            bool trackSelection = false;
            bool wantsMore      = false;

            switch (projectSize)
            {
            case ProjectSize.Small:
                wantsMore      = true;
                fetchPreview   = true;
                trackSelection = true;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    break;

                case IndexToCreateType.Default:
                case IndexToCreateType.Extended:
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;

            case ProjectSize.Medium:
                wantsMore      = true;
                fetchPreview   = true;
                trackSelection = false;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    break;

                case IndexToCreateType.Default:
                case IndexToCreateType.Extended:
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;

            case ProjectSize.Large:
                fetchPreview   = false;
                trackSelection = false;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    wantsMore = true;
                    break;

                case IndexToCreateType.Default:
                case IndexToCreateType.Extended:
                    wantsMore = false;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;
            }
            SetSettingsFromProjectSize(fetchPreview, trackSelection, wantsMore);
        }
예제 #2
0
        private void ApplySettings(ProjectSize projectSize, IndexCreationInfo indexCreationInfo)
        {
            SendEvent(SearchAnalytics.GenericEventType.SetupWizardExecute, projectSize.ToString(), indexCreationInfo.type.ToString(), indexCreationInfo.optionsToAdd.ToString());

            bool fetchPreview   = false;
            bool trackSelection = false;
            bool wantsMore      = indexCreationInfo.type == IndexToCreateType.Minimal;

            switch (projectSize)
            {
            case ProjectSize.Small:
                wantsMore      = true;
                fetchPreview   = true;
                trackSelection = true;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    break;

                case IndexToCreateType.Default:
                case IndexToCreateType.Extended:
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;

            case ProjectSize.Medium:
                fetchPreview   = true;
                trackSelection = false;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    break;

                case IndexToCreateType.Default:
                case IndexToCreateType.Extended:
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;

            case ProjectSize.Large:
                fetchPreview   = false;
                trackSelection = false;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    break;

                case IndexToCreateType.Default:
                case IndexToCreateType.Extended:
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;
            }
            SetSettingsFromProjectSize(fetchPreview, trackSelection, wantsMore);
        }
예제 #3
0
 public Project(string number, string name, ProjectType projectType, Projectstatus projectStatus, Client client,
                ProjectSize projectSize, float estimatedCost, float projectPayement, float estimadedEarning, float actualCost, float actualEarning,
                DateTime startingDate, List <Ressource> requirededRessources)
 {
     this.number               = number;
     this.name                 = name;
     this.projectType          = projectType;
     this.projectStatus        = projectStatus;
     this.client               = client;
     this.projectSize          = projectSize;
     this.estimatedCost        = estimatedCost;
     this.projectPayement      = projectPayement;
     this.estimadedEarning     = estimadedEarning;
     this.ActualCost           = actualCost;
     this.ActualEarning        = actualEarning;
     this.startingDate         = startingDate;
     this.requirededRessources = requirededRessources;
 }
 public ProjectSizeToggle(string title, string description, IEnumerable <ToggleWithTitleAndDescription> toggleGroup, ProjectSize projectSize, IndexToggle extendedIndexToggle) : base(title, description, toggleGroup)
 {
     this.m_ExtendedIndexToggle = extendedIndexToggle;
     this.projectSize           = projectSize;
 }
        private void ApplySettings(ProjectSize projectSize, IndexCreationInfo indexCreationInfo)
        {
            bool fetchPreview   = false;
            bool trackSelection = false;
            bool wantsMore      = false;
            SearchAssetIndexing assetIndexing = SearchAssetIndexing.NoIndexing;

            switch (projectSize)
            {
            case ProjectSize.Small:
                wantsMore      = true;
                fetchPreview   = true;
                trackSelection = true;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    assetIndexing = SearchAssetIndexing.NoIndexing;
                    break;

                case IndexToCreateType.Default:
                    assetIndexing = SearchAssetIndexing.FullIndexing;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;

                case IndexToCreateType.Extended:
                    assetIndexing = SearchAssetIndexing.FullIndexing;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;

            case ProjectSize.Medium:
                wantsMore      = true;
                fetchPreview   = true;
                trackSelection = false;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    assetIndexing = SearchAssetIndexing.BasicIndexing;
                    break;

                case IndexToCreateType.Default:
                    assetIndexing = SearchAssetIndexing.FullIndexing;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;

                case IndexToCreateType.Extended:
                    assetIndexing = SearchAssetIndexing.FullIndexing;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;

            case ProjectSize.Large:
                fetchPreview   = false;
                trackSelection = false;
                switch (indexCreationInfo.type)
                {
                case IndexToCreateType.Minimal:
                    wantsMore     = true;
                    assetIndexing = SearchAssetIndexing.BasicIndexing;
                    break;

                case IndexToCreateType.Default:
                    wantsMore     = false;
                    assetIndexing = SearchAssetIndexing.FullIndexing;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;

                case IndexToCreateType.Extended:
                    wantsMore     = false;
                    assetIndexing = SearchAssetIndexing.FullIndexing;
                    GenerateIndex(indexCreationInfo.optionsToAdd);
                    break;
                }
                break;
            }
            SearchSettings.SetSettingsFromProjectSize(fetchPreview, trackSelection, wantsMore, assetIndexing);
        }
예제 #6
0
        public Portfolio AddPortfolio(PortfolioContext context, string name, string shortName, string viewKey, string requiredRoles = null)
        {
            var portfolio = context.Portfolios
                            .Include(p => p.Configuration.Phases)
                            .Include(p => p.Configuration.OnHoldStatuses)
                            .Include(p => p.Configuration.RAGStatuses)
                            .Include(p => p.Configuration.Categories)
                            .Include(p => p.Configuration.ProjectSizes)
                            .Include(p => p.Configuration.BudgetTypes)
                            .Include(p => p.Configuration.LabelGroups)
                            .Include(p => p.Configuration.Labels)
                            .SingleOrDefault(p => p.ViewKey == viewKey);

            if (portfolio == null)
            {
                portfolio = new Portfolio()
                {
                    ViewKey       = viewKey,
                    Configuration = new PortfolioConfiguration()
                    {
                        Phases         = new List <ProjectPhase>(),
                        OnHoldStatuses = new List <ProjectOnHoldStatus>(),
                        RAGStatuses    = new List <ProjectRAGStatus>(),
                        Categories     = new List <ProjectCategory>(),
                        ProjectSizes   = new List <ProjectSize>(),
                        BudgetTypes    = new List <BudgetType>(),
                        LabelGroups    = new List <PortfolioLabelGroup>(),
                        Labels         = new List <PortfolioLabelConfig>(),
                        ArchiveAgeDays = PortfolioSettings.DefaultProjectArchiveAgeDays
                    },
                    RequiredRoleData = requiredRoles
                };
                context.Portfolios.Add(portfolio);
            }
            portfolio.Name      = name;
            portfolio.ShortName = shortName;
            portfolio.IDPrefix  = viewKey.ToUpper();

            Action <int> phaseFactory = (o) =>
            {
                string phaseName;
                string vk = $"{ViewKeyPrefix.Phase}{o}";
                if (!SyncMaps.phaseMap.TryGetValue(new Tuple <string, string>(viewKey, vk), out phaseName))
                {
                    phaseName = vk;
                }
                var phase = portfolio.Configuration.Phases.SingleOrDefault(p => p.ViewKey == vk);
                if (phase == null)
                {
                    phase = new ProjectPhase()
                    {
                        ViewKey = vk, Order = o
                    };
                    portfolio.Configuration.Phases.Add(phase);
                }
                phase.Name = phaseName;
            };
            Func <int, ProjectOnHoldStatus> onHoldFactory = (o) =>
            {
                string k      = $"{ViewKeyPrefix.Status}{o}";
                var    onhold = portfolio.Configuration.OnHoldStatuses.SingleOrDefault(p => p.ViewKey == k);
                if (onhold == null)
                {
                    onhold = new ProjectOnHoldStatus()
                    {
                        ViewKey = k, Order = o
                    };
                    portfolio.Configuration.OnHoldStatuses.Add(onhold);
                }
                onhold.Name = SyncMaps.onholdMap[k];
                return(onhold);
            };
            Func <string, ProjectRAGStatus> ragFactory = (k) =>
            {
                var rag = portfolio.Configuration.RAGStatuses.SingleOrDefault(p => p.ViewKey == k);
                if (rag == null)
                {
                    rag = new ProjectRAGStatus()
                    {
                        ViewKey = k
                    };
                    portfolio.Configuration.RAGStatuses.Add(rag);
                }
                rag.Name  = SyncMaps.ragMap[k].Item1;
                rag.Order = SyncMaps.ragMap[k].Item2;
                return(rag);
            };
            Action <int> categoryFactory = (o) =>
            {
                string k        = $"{ViewKeyPrefix.Category}{o}";
                var    category = portfolio.Configuration.Categories.SingleOrDefault(p => p.ViewKey == k);
                if (category == null)
                {
                    category = new ProjectCategory()
                    {
                        ViewKey = k
                    };
                    portfolio.Configuration.Categories.Add(category);
                }
                var tk = new Tuple <string, string>(viewKey, k);
                category.Name  = SyncMaps.categoryMap.ContainsKey(tk) ? SyncMaps.categoryMap[tk] : SyncMaps.categoryMap[new Tuple <string, string>("odd", k)];
                category.Order = o;
            };
            Func <int, BudgetType> budgetTypeFactory = (o) =>
            {
                string k          = $"{ViewKeyPrefix.BudgetType}{o}";
                var    budgetType = portfolio.Configuration.BudgetTypes.SingleOrDefault(p => p.ViewKey == k);
                if (budgetType == null)
                {
                    budgetType = new BudgetType()
                    {
                        ViewKey = k, Order = o
                    };
                    portfolio.Configuration.BudgetTypes.Add(budgetType);
                }
                var tk = new Tuple <string, string>(viewKey, k);
                budgetType.Name  = SyncMaps.budgetTypeMap.ContainsKey(tk) ? SyncMaps.budgetTypeMap[tk] : SyncMaps.budgetTypeMap[new Tuple <string, string>("odd", k)];
                budgetType.Order = o;
                return(budgetType);
            };

            Func <int, ProjectSize> sizeFactory = (o) =>
            {
                string k           = $"{ViewKeyPrefix.ProjectSize}{o}";
                var    projectSize = portfolio.Configuration.ProjectSizes.SingleOrDefault(p => p.ViewKey == k);
                if (projectSize == null)
                {
                    projectSize = new ProjectSize()
                    {
                        ViewKey = k, Order = o
                    };
                    portfolio.Configuration.ProjectSizes.Add(projectSize);
                }
                projectSize.Name = SyncMaps.sizeMap[k];
                return(projectSize);
            };
            Func <string, int, PortfolioLabelGroup> labelGroupFactory = (n, go) =>
            {
                var group = portfolio.Configuration.LabelGroups.SingleOrDefault(p => p.Name == n);
                if (group == null)
                {
                    group = new PortfolioLabelGroup()
                    {
                        Name = n
                    };
                    portfolio.Configuration.LabelGroups.Add(group);
                }
                group.Order = go;
                return(group);
            };

            phaseFactory(0);
            phaseFactory(1);
            phaseFactory(2);
            phaseFactory(3);
            phaseFactory(4);
            phaseFactory(5);
            ragFactory(RagConstants.RedViewKey);
            ragFactory(RagConstants.AmberViewKey);
            ragFactory(RagConstants.GreenViewKey);
            ragFactory(RagConstants.NoneViewKey);
            onHoldFactory(0);
            onHoldFactory(1);
            onHoldFactory(2);
            onHoldFactory(3);

            if (SyncMaps.categoryKeyMap.TryGetValue(viewKey, out var categoryLookup))
            {
                for (int i = 0; i < categoryLookup.Keys.Count; i++)
                {
                    categoryFactory(i);
                }
            }
            sizeFactory(0);
            sizeFactory(1);
            sizeFactory(2);
            sizeFactory(3);
            sizeFactory(4);

            // Need to lookup budgettypes based on portfolio view key
            if (SyncMaps.budgetTypeKeyMap.TryGetValue(viewKey, out var budgetTypeLookup))
            {
                for (int i = 0; i < budgetTypeLookup.Keys.Count; i++)
                {
                    budgetTypeFactory(i);
                }
            }
            labelGroupFactory(FieldGroupConstants.FieldGroupName_ProjectIDs, 0);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_AboutTheProject, 1);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_ProjectTeam, 2);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_ProjectPlan, 3);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_ProgressIndicators, 4);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_Updates, 5);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_Prioritisation, 6);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_Budget, 7);
            labelGroupFactory(FieldGroupConstants.FieldGroupName_FSAProcesses, 8);

            return(portfolio);
        }