private void InsertWebPanelListItems() { _webPanelList.Items.Clear(); var wpHelper = new WebPanelHelper(); var webpanels = wpHelper.GetAllWebPanels(); if (webpanels == null || webpanels.Length == 0) { _webPanelList.Items.Add(new ListItem { Text = "(No web panels found)", }); } else { foreach (var webpanel in webpanels) { _webPanelList.Items.Add(new ListItem { Text = webpanel.Name, Value = webpanel.WebPanelId.ToString() }); } } }
protected void UninstallButton_Click(object sender, EventArgs e) { SuperOfficeAuthHelper.Authorize(); var wpHelper = new WebPanelHelper(); wpHelper.DeleteAllWebPanels(); this.ProvideFeedbackToTheUser(); }
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 UninstallButton_Click(object sender, EventArgs e) { SuperOfficeAuthHelper.Authorize(); if (SoContext.CurrentPrincipal.HasFunctionRight("admin-all")) { var wpHelper = new WebPanelHelper(); wpHelper.DeleteAllWebPanels(); this.ProvideFeedbackToTheUser(); } }
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(); }
private void CreateWebPanelInUsersInstallation() { var helper = new WebPanelHelper(); helper.CreateAndSaveWebPanel(Global.AppName, ConfigurationManager.AppSettings["NewsProviderName"], ConfigurationManager.AppSettings["NewsProviderURL"], Navigation.ContactArchive); }
protected void Page_Load(object sender, EventArgs e) { SuperOfficeAuthHelper.Authorize(); var p = new Product(); _products = p.GetProductsDic(); // Is this the first time, or later? var helper = new WebPanelHelper(); var installedWebPanels = helper.GetAllWebPanels(); if (installedWebPanels != null && installedWebPanels.Length != 0) { _isAnUpdate = true; if (!IsPostBack) { // The system has been installed, now the user wants to change the configuration: foreach (var product in _products.Values) { var id = installedWebPanels.FirstOrDefault(w => w.Name == product.LinkName); if (id != null) { product.IsSelected = id.Name == product.LinkName && !id.Deleted; } else { product.IsSelected = false; } } } } Page.Title = "SuperOffice Maps example setup"; var masterPage = Master as MapsExample; if (masterPage != null) { masterPage.ExtraHeaderText = "Configure"; } if (!IsPostBack) { _repeater.DataSource = _products.Values; this.DataBind(); } if (IsPostBack) { //set checked on the data var checkboxes = _repeater.FindDescendants <CheckBox>().ToArray(); var buyAll = GetBuyAllCheckBox(checkboxes); foreach (var checkbox in checkboxes) { if (checkbox != buyAll) { GetProduct(checkbox).IsSelected = checkbox.Checked; } } } }