internal EmptyProductDeleterResult DeleteProduct(Guid productID)
        {
            Logger.EnteringMethod(productID.ToString());
            IUpdate                   updateToDelete  = null;
            IUpdateCategory           productToDelete = wsus.GetUpdateCategory(productID);
            IUpdateCategory           vendorToDelete  = productToDelete.GetParentUpdateCategory();
            EmptyProductDeleterResult result          = new EmptyProductDeleterResult();

            result.DeletedProduct = null;
            result.DeletedVendor  = null;
            StartWaitingForm(resMan.GetString("DeletingProduct") + productToDelete.Title);
            updateToDelete = PublishUpdate(productToDelete, vendorToDelete);

            if (updateToDelete != null && MakeLocallyPublished(productToDelete, vendorToDelete))
            {
                DeclineUpdate(updateToDelete);
                CleanUpdateRevision();
                DeleteUpdate(updateToDelete);
                System.Threading.Thread.Sleep(500);
                try
                {
                    IUpdateCategory deletedCategory = wsus.GetUpdateCategory(productToDelete.Id);
                    Logger.Write("Failed to delete : " + productToDelete.Title);
                }
                catch (Exception)
                {
                    Logger.Write("Successfuly deleted : " + productToDelete.Title);
                    result.DeletedProduct = productToDelete;
                    if (vendorToDelete.GetSubcategories().Count == 0)
                    {
                        try
                        {
                            IUpdateCategory deletedCategory = wsus.GetUpdateCategory(vendorToDelete.Id);
                            Logger.Write("Failed to delete : " + vendorToDelete.Title);
                        }
                        catch (Exception)
                        {
                            Logger.Write("Succesfully deleted : " + vendorToDelete.Title);
                            result.DeletedVendor = vendorToDelete;
                            StopWaitingForm();
                            _waitingForm.TopLevel = false;
                            return(result);
                        }
                    }
                }
            }
            else
            {
                StopWaitingForm();
                _waitingForm.TopLevel = false;
                return(result);
            }

            StopWaitingForm();
            _waitingForm.TopLevel = false;
            return(result);
        }
Ejemplo 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);
        }