Esempio n. 1
0
        private void MakeVisibleInWsusConsole(IUpdate PublishedUpdate)
        {
            Logger.EnteringMethod();
            SqlHelper sqlHelper       = SqlHelper.GetInstance();
            string    sqlServerName   = _wsus.GetSqlServerName();
            string    sqlDataBaseName = _wsus.GetSqlDataBaseName();

            System.Version wsusVersion = _wsus.GetServerVersion();

            if (PublishedUpdate == null)
            {
                return;
            }

            if (sqlServerName.Contains("MICROSOFT##SSEE") || sqlServerName.Contains("MICROSOFT##WID"))
            {
                if (wsusVersion.Major == 3)
                {
                    sqlHelper.ServerName = @"\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query";
                }
                if (wsusVersion.Major == 6)
                {
                    sqlHelper.ServerName = @"\\.\pipe\Microsoft##WID\tsql\query";
                }
                sqlHelper.DataBaseName = "SUSDB";
            }
            else
            {
                sqlHelper.ServerName   = _wsus.GetSqlServerName();
                sqlHelper.DataBaseName = _wsus.GetSqlDataBaseName();
            }
            Logger.Write(sqlHelper.ServerName);
            Logger.Write(sqlHelper.DataBaseName);
            if (sqlHelper.Connect(string.Empty, string.Empty))
            {
                Logger.Write("Connected to SQL.");
                List <Guid> updateIDs = new List <Guid>();

                updateIDs.Add(PublishedUpdate.Id.UpdateId);
                UpdateCategoryCollection categories = PublishedUpdate.GetUpdateCategories();
                foreach (IUpdateCategory category in categories)
                {
                    if (!updateIDs.Contains(category.Id))
                    {
                        updateIDs.Add(category.Id);
                    }
                    if (category.ProhibitsSubcategories && !category.ProhibitsUpdates)
                    {
                        IUpdateCategory parentCategory = category.GetParentUpdateCategory();
                        if (!updateIDs.Contains(parentCategory.Id))
                        {
                            updateIDs.Add(parentCategory.Id);
                        }
                    }
                }

                sqlHelper.ShowUpdatesInConsole(updateIDs);
                sqlHelper.Disconnect();
            }
        }
Esempio n. 2
0
        internal FrmUpdateWizard(Dictionary <Guid, Company> Companies, IUpdate updateToRevise)
        {
            Logger.EnteringMethod("FrmUpdateWizard");
            InitializeComponent();
            WsusWrapper _wsus = WsusWrapper.GetInstance();

            Revising       = true;
            this.Sdp       = _wsus.GetMetaData(updateToRevise);
            this.Companies = Companies;
            IUpdateCategory productCategory = updateToRevise.GetUpdateCategories()[0];
            IUpdateCategory companyCategory = productCategory.GetParentUpdateCategory();

            InitializeComponent(this.Companies, Companies[companyCategory.Id], Companies[companyCategory.Id].Products[productCategory.Id], Sdp);
        }