protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e) { var cArg = e.CommandArgument.ToString(); var param = new string[3]; var pluginData = new PluginData(PortalId); switch (e.CommandName.ToLower()) { case "entrydetail": param[0] = "eid=" + cArg; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "move": MoveRecord(cArg); Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "save": if (Utils.IsNumeric(cArg)) { pluginData.UpdatePlugin(rpData,Convert.ToInt32(cArg)); pluginData.Save(); } Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "add": pluginData.AddNewPlugin(); pluginData.Save(); param[0] = ""; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "delete": // NOTE: The delete button cannot work at portal level. Each plugin must be entered at system level, therefore deleting at portal level has no effect // the plugin is re-entered back into the portal from the system level. (This is CORRECT, pluging needs to be uninstalled to be removed, at portal level we simply hide them) if (Utils.IsNumeric(cArg)) { pluginData.RemovePlugin(Convert.ToInt32(cArg)); pluginData.Save(); } param[0] = ""; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "resetportal": pluginData.RemovePortalLevel(); param[0] = ""; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "reload": param[0] = ""; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; case "return": param[0] = ""; Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true); break; } }
protected override void OnLoad(EventArgs e) { try { base.OnLoad(e); if (Page.IsPostBack == false) { #region "Check for plugins" var pluginData = new PluginData(PortalId, true); pluginData.UpdateSystemPlugins(); _systemPlugins = pluginData.GetPluginList(); pluginData = new PluginData(PortalId); var portalPlugins = pluginData.GetPluginList(); Boolean upd = false; foreach (var p in _systemPlugins) { var ctrllist = from i in portalPlugins where i.GetXmlProperty("genxml/textbox/ctrl") == p.GetXmlProperty("genxml/textbox/ctrl") select i; var nBrightInfos = ctrllist as IList<NBrightInfo> ?? ctrllist.ToList(); if (!nBrightInfos.Any()) { pluginData.AddPlugin(p); upd = true; } } if (upd) pluginData.Save(); #endregion PageLoad(); } } catch (Exception exc) //Module failed to load { //display the error on the template (don;t want to log it here, prefer to deal with errors directly.) var l = new Literal(); l.Text = exc.ToString(); phData.Controls.Add(l); } }