private void CreateWebPanelsInUsersInstallation(IEnumerable <Product> selectedProducts)
        {
            SuperOfficeAuthHelper.Authorize();

            var helper = new WebPanelHelper();

            foreach (var selectedProduct in selectedProducts)
            {
                helper.CreateAndSaveWebPanel(Global.AppName, selectedProduct.LinkName, selectedProduct.Url,
                                             selectedProduct.GetNavigation());
            }
        }
        protected void Install_Click(object sender, EventArgs e)
        {
            SuperOfficeAuthHelper.Authorize();
            if (_isAnUpdate)
            {
                var helper             = new WebPanelHelper();
                var installedWebPanels = helper.GetAllWebPanels();

                // Four possibilities:
                // Installed	Selected	Result
                //		x		    x		Do nothing
                //		x					Delete
                //					x		Install
                //							Do nothing
                foreach (var product in _products.Values)
                {
                    var isInstalled = installedWebPanels.Any(wp => wp.Name == product.LinkName);
                    if (isInstalled)                      // or exists..
                    {
                        var webPanelId = installedWebPanels.Where(wp => wp.Name == product.LinkName).FirstOrDefault();

                        if (!product.IsSelected && webPanelId != null)                          // -> Delete
                        {
                            if (webPanelId.WebPanelId > 0)
                            {
                                helper.DeleteWebPanel(webPanelId.WebPanelId);
                            }
                        }
                        else                          // -> Undelete
                        {
                            _ = helper.CreateWebPanel(webPanelId.Name, webPanelId.Url, webPanelId.VisibleIn);
                        }
                    }
                    else
                    {
                        if (product.IsSelected)                          // -> Install
                        {
                            helper.CreateAndSaveWebPanel(Global.AppName, product.LinkName, product.Url, product.GetNavigation());
                        }
                    }
                }
            }
            else
            {
                CreateWebPanelsInUsersInstallation(_products.Values.Where(pr => pr.IsSelected));
            }

            ProvideFeedbackToTheUser();
        }
Beispiel #3
0
        private void CreateWebPanelInUsersInstallation()
        {
            var helper = new WebPanelHelper();

            helper.CreateAndSaveWebPanel(Global.AppName, ConfigurationManager.AppSettings["NewsProviderName"], ConfigurationManager.AppSettings["NewsProviderURL"], Navigation.ContactArchive);
        }