private String DeleteData(HttpContext context)
        {
            var objCtrl = new NBrightBuyController();

            //get uploaded params
            var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
            var itemid   = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");

            if (Utils.IsNumeric(itemid))
            {
                var nbi = objCtrl.Get(Convert.ToInt32(itemid));
                if (nbi != null)
                {
                    var typecode = nbi.TypeCode;

                    // run the promo before delete, so we remove any promo data that may exist.
                    if (typecode == "CATEGORYPROMO")
                    {
                        PromoUtils.RemoveGroupProductPromo(PortalSettings.Current.PortalId, nbi.ItemID);
                    }
                    if (typecode == "MULTIBUYPROMO")
                    {
                        PromoUtils.RemoveMultiBuyProductPromo(PortalSettings.Current.PortalId, nbi.ItemID);
                    }

                    // delete DB record
                    objCtrl.Delete(nbi.ItemID);
                }

                NBrightBuyUtils.RemoveModCache(-2);
            }
            return("");
        }
示例#2
0
        private String DeleteData(HttpContext context)
        {
            var objCtrl = new NBrightBuyController();

            //get uploaded params
            var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
            var itemid   = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");

            if (Utils.IsNumeric(itemid))
            {
                // delete DB record
                objCtrl.Delete(Convert.ToInt32(itemid));

                NBrightBuyUtils.RemoveModCache(-2);
            }
            return("");
        }
        public static void PluginDelete(HttpContext context)
        {
            if (NBrightBuyUtils.CheckRights())
            {
                var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
                var itemid   = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");
                if (Utils.IsNumeric(itemid))
                {
                    var objCtrl = new NBrightBuyController();
                    objCtrl.Delete(Convert.ToInt32(itemid));

                    PluginUtils.CopySystemPluginsToPortal();

                    // remove save GetData cache
                    DataCache.ClearCache();
                }
            }
        }
        private String DeleteReport(HttpContext context)

        {
            var settings = GetAjaxFields(context);

            if (settings.ContainsKey("itemid") && Utils.IsNumeric(settings["itemid"]))
            {
                var objCtrl = new NBrightBuyController();
                objCtrl.Delete(Convert.ToInt32(settings["itemid"]));

                var cachekey = "GetReportListData*" + PortalSettings.Current.PortalId.ToString("");
                Utils.RemoveCache(cachekey);

                return(GetData(context));
            }

            return("Error!! - Invalid ItemId on SaveReport");
        }
        public override string ProcessCommand(string paramCmd, HttpContext context, string editlang = "")
        {
            if (!LocalUtils.CheckRights())
            {
                return("Security Error.");
            }

            var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
            var lang     = NBrightBuyUtils.SetContextLangauge(ajaxInfo); // Ajax breaks context with DNN, so reset the context language to match the client.
            var objCtrl  = new NBrightBuyController();

            var strOut = "OS_PurchaseNotification Ajax Error";

            // NOTE: The paramCmd MUST start with the plugin ref. in lowercase. (links ajax provider to cmd)
            switch (paramCmd)
            {
            case "os_purchasenotification_getdata":
                strOut = LocalUtils.GetData(editlang, "datafields.cshtml");
                break;

            case "os_purchasenotification_deleterecord":
                var infoDel = objCtrl.GetPluginSinglePageData("OS_PurchaseNotificationDATA", "OS_PurchaseNotificationDATA", Utils.GetCurrentCulture());
                objCtrl.Delete(infoDel.ItemID);
                break;

            case "os_purchasenotification_savedata":
                strOut = objCtrl.SavePluginSinglePageData(context);
                break;

            case "os_purchasenotification_selectlang":
                objCtrl.SavePluginSinglePageData(context);
                strOut = "";
                break;

            case "os_purchasenotification_testemail":
                LocalUtils.OutputTestEmail();
                strOut = LocalUtils.GetData(editlang, "datafields.cshtml");
                break;
            }

            return(strOut);
        }