Exemplo n.º 1
0
        }//loadSecuritiesFromCollection

        public ICategoryItem getCatItemByID(enumCatType eType, int iId, ICategoryCollection cCollection)
        { // Retrieves category Item From given category ID
            ICategoryItem cCurrItem = cCollection.getItemByID(iId);

            if (cCurrItem == null) // new item
            {                      // Doesn't exist - create new
                cCurrItem = new cCategoryItem(eType, m_objCatHandler.getCategoryCol(eType).getCategoryVal(iId), iId, m_objErrorHandler, m_objPortfolio);
                cCollection.Add(cCurrItem);
            }
            return(cCurrItem);
        }//getCatItemByID
Exemplo n.º 2
0
 /// <summary>
 ///     Gets the work item type categories.
 /// </summary>
 /// <param name="projectName">Name of the project.</param>
 /// <returns>Task&lt;IReadOnlyList&lt;ICategory&gt;&gt;.</returns>
 public Task <IReadOnlyList <ICategory> > GetWorkItemTypeCategories(string projectName)
 {
     return(AsyncOperation(() =>
     {
         IWorkItemStore workItemStore = WorkItemStore();
         IProject project = workItemStore.Projects[projectName];
         ICategoryCollection workItemTypeCategoriess = project.Categories;
         var result = new List <ICategory>();
         foreach (ICategory item in workItemTypeCategoriess)
         {
             result.Add(item);
         }
         return (IReadOnlyList <ICategory>)result;
     }));
 }
Exemplo n.º 3
0
        static public string GetCategory(ICategoryCollection cats)
        {
            string classification = "";
            string product        = "";

            foreach (ICategory cat in cats)
            {
                if (cat.Type.Equals("UpdateClassification"))
                {
                    classification = cat.Name;
                }
                else if (cat.Type.Equals("Product"))
                {
                    product = cat.Name;
                }
            }
            return(product + "; " + classification);
        }
Exemplo n.º 4
0
 public BaseController(ICategoryCollection categoryCollection)
 {
     this._categoryCollection = categoryCollection;
 }
        private void Load()
        {
            List <string> categoriesToExclude = Properties.Settings.Default.update_categories_to_exclude.Cast <string>().ToList().ConvertAll(x => x.ToLower().Trim());

            UpdateSession   session  = new UpdateSession();
            IUpdateSearcher searcher = session.CreateUpdateSearcher();

            searcher.Online = false;

            //try
            //{
            //    ISearchResult result = searcher.Search("IsInstalled=1");

            //    foreach (IUpdate u in result.Updates)
            //    {
            //        var title = u.Title;
            //        var kb = u.KBArticleIDs.Cast<string>().ToList().Aggregate( (x,y) => $"{x},{y}");
            //        var date = u.LastDeploymentChangeTime;

            //        WindowsUpdatesData.Add(new WindowsUpdatesElement()
            //        {
            //            Date = date.ToString(),
            //            Kb = kb,
            //            Title = title
            //        });
            //    }
            //}
            //catch { }


            var count = searcher.GetTotalHistoryCount();

            if (count == 0)
            {
                return;
            }

            var history = searcher.QueryHistory(0, count);

            for (int i = 0; i < count; i++)
            {
                IUpdateHistoryEntry2 e = (IUpdateHistoryEntry2)history[i];

                var category = "n/a";

                ICategoryCollection categories = e.Categories;
                foreach (ICategory oc in categories)
                {
                    category = oc.Name;
                    break;
                }

                // check for excluded catgory
                if (categoriesToExclude.Contains(category.ToLower().Trim()))
                {
                    continue;
                }

                var title = history[i].Title;

                IUpdateIdentity ident = history[i].UpdateIdentity;

                var id = ident.UpdateID;

                WindowsUpdatesData.Add(new WindowsUpdatesElement()
                {
                    Kb       = id,
                    Title    = title,
                    Date     = history[i].Date.ToString(),
                    Result   = history[i].ResultCode.ToString().Replace("orc", string.Empty),
                    Category = category
                });
            }
        }
Exemplo n.º 6
0
 public HomeController(ILogger <HomeController> logger, ICategoryCollection categoryCollection) : base(categoryCollection)
 {
     _logger = logger;
     this._categoryCollection = categoryCollection;
 }
 partial void Categories_SetCondition(ref IProject instance, ref ICategoryCollection setValue);
Exemplo n.º 8
0
        }//constructor

        private void initCategoryCollections()
        { // Initializes the category collections (to empty lists)
            m_colSectors  = new cCategoryCollection(enumCatType.Sector, m_objErrorHandler);
            m_colSecTypes = new cCategoryCollection(enumCatType.SecurityType, m_objErrorHandler);
            m_colMarkets  = new cCategoryCollection(enumCatType.StockMarket, m_objErrorHandler);
        }//initCategoryCollections
Exemplo n.º 9
0
 public ProductController(IProductCollection productCollection, ICategoryCollection categoryCollection, IStorage storage) : base(categoryCollection)
 {
     this._productCollection  = productCollection;
     this._categoryCollection = categoryCollection;
     this._storage            = storage;
 }