예제 #1
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))
            {
                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);
                }
                CacheUtils.ClearAllCache();
            }
            return("");
        }