Ejemplo n.º 1
0
        private String AddNew()
        {
            var prodData = ProductUtils.GetProductData(-1, StoreSettings.Current.EditLanguage);

            return(prodData.Info.ItemID.ToString(""));
        }
Ejemplo n.º 2
0
        public override NBrightInfo AfterProductSave(NBrightInfo nbrightInfo)
        {
            var promoid = nbrightInfo.GetXmlPropertyInt("genxml/hidden/promoid"); // legacy promo flag

            if (nbrightInfo.GetXmlPropertyBool("genxml/hidden/promoflag") || promoid > 0)
            {
                var prdData = ProductUtils.GetProductData(nbrightInfo.ItemID, nbrightInfo.Lang);
                // loop on models to get all promoid at model level.
                var modelpromoids = new List <int>();
                if (promoid > 0)
                {
                    modelpromoids.Add(promoid);
                }
                var lp = 1;
                foreach (var m in prdData.Models)
                {
                    var modelPromoId = prdData.Info.GetXmlPropertyInt("genxml/promo/salepriceid" + lp);
                    if (modelPromoId > 0 && !modelpromoids.Contains(modelPromoId))
                    {
                        modelpromoids.Add(modelPromoId);
                    }
                    modelPromoId = prdData.Info.GetXmlPropertyInt("genxml/promo/dealercostid" + lp);
                    if (modelPromoId > 0 && !modelpromoids.Contains(modelPromoId))
                    {
                        modelpromoids.Add(modelPromoId);
                    }
                    modelPromoId = prdData.Info.GetXmlPropertyInt("genxml/promo/dealersaleid" + lp);
                    if (modelPromoId > 0 && !modelpromoids.Contains(modelPromoId))
                    {
                        modelpromoids.Add(modelPromoId);
                    }
                    lp += 1;
                }

                // multiple promotions, remove from each model.
                foreach (var mpid in modelpromoids)
                {
                    var objCtrl   = new NBrightBuyController();
                    var promoData = objCtrl.GetData(mpid);

                    var catgroupid       = promoData.GetXmlPropertyInt("genxml/dropdownlist/catgroupid");
                    var propgroupid      = promoData.GetXmlPropertyInt("genxml/dropdownlist/propgroupid");
                    var propbuygroupid   = promoData.GetXmlPropertyInt("genxml/dropdownlist/propbuy");
                    var propapplygroupid = promoData.GetXmlPropertyInt("genxml/dropdownlist/propapply");

                    var removepromo = true;
                    foreach (var c in prdData.GetCategories())
                    {
                        if (c.categoryid == catgroupid)
                        {
                            removepromo = false;
                        }
                        if (c.categoryid == propgroupid)
                        {
                            removepromo = false;
                        }
                        if (c.categoryid == propbuygroupid)
                        {
                            removepromo = false;
                        }
                        if (c.categoryid == propapplygroupid)
                        {
                            removepromo = false;
                        }
                    }

                    if (removepromo)
                    {
                        PromoUtils.RemoveProductPromoData(nbrightInfo.PortalId, nbrightInfo.ItemID, mpid);
                        ProductUtils.RemoveProductDataCache(nbrightInfo.PortalId, nbrightInfo.ItemID);
                    }
                }
            }

            return(nbrightInfo);
        }
Ejemplo n.º 3
0
        override protected void OnInit(EventArgs e)
        {
            _eid           = Utils.RequestQueryStringParam(Context, "eid");
            _print         = Utils.RequestParam(Context, "print");
            _printtemplate = Utils.RequestParam(Context, "template");
            _controlPath   = ControlPath;

            EnablePaging = true;

            base.OnInit(e);

            if (ModSettings != null)
            {
                // check if we're using a typcode for the data.
                var modentitytypecode = ModSettings.Get("entitytypecode");
                if (modentitytypecode != "")
                {
                    EntityTypeCode     = modentitytypecode;
                    EntityTypeCodeLang = modentitytypecode + "LANG";
                }
                // check if we're using a provider controlpath for the templates.
                var providercontrolpath = ModSettings.Get("providercontrolpath");
                if (providercontrolpath != "")
                {
                    _controlPath = "/DesktopModules/NBright/" + providercontrolpath + "/";
                }
            }


            // if guidkey entered instead of eid, find it using the guid and assign to _eid
            _guidkey = Utils.RequestQueryStringParam(Context, "guidkey");
            if (_guidkey == "")
            {
                _guidkey = Utils.RequestQueryStringParam(Context, "ref");
            }

            Logging.Info($"ProductRazorView requested with: eid={_eid}, guidkey={_guidkey}.");

            if (_eid == "" && _guidkey != "")
            {
                var guidData = ModCtrl.GetByGuidKey(PortalId, -1, EntityTypeCode, _guidkey);
                if (guidData != null)
                {
                    _eid = guidData.ItemID.ToString("D");
                }
                else
                {
                    _eid = "0";
                }
            }

            // if we want to print we need to open the browser with a startup script, this points to a Printview.aspx. (Must go after the ModSettings has been init.)
            if (_print != "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "printproduct", "window.open('" + StoreSettings.NBrightBuyPath() + "/PrintView.aspx?itemid=" + _eid + "&printcode=" + _print + "&template=" + _printtemplate + "&theme=" + ModSettings.Get("themefolder") + "','_blank');", true);
            }

            if (ModuleKey == "")  // if we don't have module setting jump out
            {
                var lit = new Literal();
                lit.Text = "NO MODULE SETTINGS";
                phData.Controls.Add(lit);
                return;
            }

            _navigationdata = new NavigationData(PortalId, ModuleKey);

            // Pass in a template specifying the token to create a friendly url for paging.
            // (NOTE: we need this in NBS becuase the edit product from list return url will copy the page number and hence paging will not work after editing if we don;t do this)
            CtrlPaging.HrefLinkTemplate = "[<tag type='valueof' databind='PreText' />][<tag type='if' databind='Text' testvalue='' display='{OFF}' />][<tag type='hrefpagelink' moduleid='" + ModuleId.ToString("") + "' />][<tag type='endif' />][<tag type='valueof' databind='PostText' />]";
            CtrlPaging.UseListDisplay   = true;
            try
            {
                _catid   = Utils.RequestQueryStringParam(Context, "catid");
                _catname = Utils.RequestQueryStringParam(Context, "catref");

                #region "set templates based on entry id (eid) from url"

                _ename        = Utils.RequestQueryStringParam(Context, "entry");
                _modkey       = Utils.RequestQueryStringParam(Context, "modkey");
                _pagemid      = Utils.RequestQueryStringParam(Context, "pagemid");
                _pagenum      = Utils.RequestQueryStringParam(Context, "page");
                _pagesize     = Utils.RequestQueryStringParam(Context, "pagesize");
                _orderbyindex = Utils.RequestQueryStringParam(Context, "orderby");

                // see if we need to display the entry page.
                if ((_modkey == ModuleKey | _modkey == "") && (_eid != "" | _ename != ""))
                {
                    _displayentrypage = true;
                }

                // if we have entry detail display, but no catd, get the default one.
                if (_displayentrypage && _catid == "" && Utils.IsNumeric(_eid))
                {
                    var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode);
                    var defcat  = prdData.GetDefaultCategory();
                    if (defcat != null)
                    {
                        _catid = defcat.categoryid.ToString("");
                    }
                }

                if (ModSettings.Get("listonly").ToLower() == "true")
                {
                    _displayentrypage = false;
                }

                // get template codes
                if (_displayentrypage)
                {
                    _templD = ModSettings.Get("razordetailtemplate");
                    if (_templD == "")
                    {
                        _templD = ModSettings.Get("txtdisplayentrybody");                // legacy name
                    }
                }
                else
                {
                    _templD = ModSettings.Get("razorlisttemplate");
                    if (_templD == "")
                    {
                        _templD = ModSettings.Get("txtdisplaybody");                // legacy name
                    }
                }

                #endregion
            }
            catch (Exception exc)
            {
                // remove any cookie which might store SQL in error.
                _navigationdata.Delete();
                DisplayProductError(exc.ToString());
            }
        }
Ejemplo n.º 4
0
        private void RazorDisplayDataEntry(String entryId)
        {
            var productData = new ProductData();

            if (Utils.IsNumeric(entryId))
            {
                productData = ProductUtils.GetProductData(Convert.ToInt32(entryId), Utils.GetCurrentCulture(), true, EntityTypeCode);
            }

            if (productData.Exists && (productData.Info.PortalId == -1 || productData.Info.PortalId == PortalId))
            {
                if (PortalSettings.HomeTabId == TabId)
                {
                    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                }
                else
                {
                    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetEntryUrl(PortalId, _eid, "", productData.SEOName, TabId.ToString("")));
                }

                // overwrite SEO data
                if (productData.SEOName != "")
                {
                    BasePage.Title = productData.SEOTitle;
                }
                else
                {
                    BasePage.Title = productData.ProductName;
                }

                if (productData.SEODescription != "")
                {
                    BasePage.Description = productData.SEODescription;
                }

                // if debug , output the xml used.
                if (DebugMode)
                {
                    productData.Info.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_entry.xml");
                }
                // insert page header text
                NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, Path.GetFileNameWithoutExtension(_templD) + "_seohead" + Path.GetExtension(_templD), _controlPath, ModSettings.ThemeFolder, ModSettings.Settings(), productData);

                #region "do razor template"

                var strOut = NBrightBuyUtils.RazorTemplRender(_templD, ModuleId, "productdetailrazor" + ModuleId.ToString() + "*" + entryId, productData, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                var lit    = new Literal();
                lit.Text = strOut;
                phData.Controls.Add(lit);

                #endregion
            }
            else
            {
                _404code = true;

                // insert page header text
                NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, "ProductNotFound_head.cshtml", _controlPath, ModSettings.ThemeFolder, ModSettings.Settings(), productData);

                var strOut = NBrightBuyUtils.RazorTemplRender("ProductNotFound.cshtml", ModuleId, "", productData, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                var lit    = new Literal();
                lit.Text = strOut;
                phData.Controls.Add(lit);
            }
        }
Ejemplo n.º 5
0
        public static string CalcMultiBuyPromoItem(NBrightInfo p)
        {
            var objCtrl        = new NBrightBuyController();
            var propgroupid    = p.GetXmlPropertyInt("genxml/dropdownlist/propbuy");
            var promoname      = p.GetXmlProperty("genxml/textbox/name");
            var validfrom      = p.GetXmlProperty("genxml/textbox/validfrom");
            var validuntil     = p.GetXmlProperty("genxml/textbox/validuntil");
            var disabled       = p.GetXmlPropertyBool("genxml/checkbox/disabled");
            var lastcalculated = p.GetXmlProperty("genxml/hidden/lastcalculated");

            if (!disabled)
            {
                var portalsettings = NBrightDNN.DnnUtils.GetPortalSettings(p.PortalId);
                var lang           = portalsettings.DefaultLanguage;

                var runcalc = true;
                if (Utils.IsDate(lastcalculated))
                {
                    if (Convert.ToDateTime(lastcalculated) >= p.ModifiedDate)
                    {
                        runcalc = false;                                                        // only run if changed
                    }
                    if (DateTime.Now.Date > Convert.ToDateTime(lastcalculated).Date.AddDays(1))
                    {
                        runcalc = true;                                                                         // every day just after midnight. (for site performace)
                    }
                }
                if (Utils.IsDate(validuntil))
                {
                    if (DateTime.Now.Date > Convert.ToDateTime(validuntil))
                    {
                        runcalc = true;                                                     // need to disable the promo if passed date
                    }
                }
                if ((runcalc) && Utils.IsDate(validfrom) && Utils.IsDate(validuntil))
                {
                    var          dteF = Convert.ToDateTime(validfrom).Date;
                    var          dteU = Convert.ToDateTime(validuntil).Date;
                    CategoryData gCat;

                    gCat = CategoryUtils.GetCategoryData(propgroupid, lang);
                    var prdList = gCat.GetAllArticles();

                    foreach (var prd in prdList)
                    {
                        if (DateTime.Now.Date >= dteF && DateTime.Now.Date <= dteU)
                        {
                            // CALC Promo
                            FlagProductMultiBuy(p.PortalId, prd.ParentItemId, promoname, p.ItemID, "PROMOMULTIBUY", dteF, dteU);
                        }
                        if (DateTime.Now.Date > dteU)
                        {
                            // END Promo
                            RemoveProductPromoData(p.PortalId, prd.ParentItemId, p.ItemID);
                            p.SetXmlProperty("genxml/checkbox/disabled", "True");
                            objCtrl.Update(p);
                        }
                        ProductUtils.RemoveProductDataCache(p.PortalId, prd.ParentItemId);
                        var productData = ProductUtils.GetProductData(prd.ParentItemId, lang);
                        productData.Save(); // recalc any new prices.
                    }

                    p.SetXmlProperty("genxml/hidden/lastcalculated", DateTime.Now.AddSeconds(10).ToString("O")); // Add 10 sec to time so we don't get exact clash with update time.
                    objCtrl.Update(p);
                }
            }
            return("OK");
        }
Ejemplo n.º 6
0
        private void RazorPageLoad()
        {
            NBrightInfo objCat = null;

            if (_templD.Trim() != "")  // if we don;t have a template, don't do anything
            {
                if (_displayentrypage)
                {
                    // get correct itemid, based on eid given
                    _eid = GetEntryIdFromName(_eid);
                    RazorDisplayDataEntry(_eid);
                }
                else
                {
                    // Get meta data from template

                    var metaTokens = NBrightBuyUtils.RazorPreProcessTempl(_templD, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings(), ModuleId.ToString());

                    #region "Order BY"

                    ////////////////////////////////////////////
                    // get ORDERBY SORT
                    ////////////////////////////////////////////
                    if (_orderbyindex != "") // if we have orderby set in url, find the meta tags
                    {
                        if (metaTokens.ContainsKey("orderby" + _orderbyindex))
                        {
                            if (metaTokens["orderby" + _orderbyindex].Contains("{") || metaTokens["orderby" + _orderbyindex].ToLower().Contains("order by"))
                            {
                                _navigationdata.OrderBy    = metaTokens["orderby" + _orderbyindex];
                                _navigationdata.OrderByIdx = _orderbyindex;
                            }
                            else
                            {
                                _navigationdata.OrderBy    = " Order by " + metaTokens["orderby" + _orderbyindex];
                                _navigationdata.OrderByIdx = _orderbyindex;
                            }
                            _navigationdata.Save();
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(_navigationdata.OrderBy) && metaTokens.ContainsKey("orderby"))
                        {
                            if (metaTokens["orderby"].Contains("{") || metaTokens["orderby"].ToLower().Contains("order by"))
                            {
                                _navigationdata.OrderBy = metaTokens["orderby"];
                            }
                            else
                            {
                                _navigationdata.OrderBy = " Order by " + metaTokens["orderby"];
                            }
                            _navigationdata.OrderByIdx = "";
                            _navigationdata.Save();
                        }
                    }


                    #endregion

                    #region "Get Paging setup"

                    //See if we have a pagesize, uses the "searchpagesize" tag token.
                    // : This can be overwritten by the cookie value if we need user selection of pagesize.
                    CtrlPaging.Visible = false;

                    #region "Get pagesize, from best place"

                    var pageSize = 0;
                    if (Utils.IsNumeric(ModSettings.Get("pagesize")))
                    {
                        pageSize = Convert.ToInt32(ModSettings.Get("pagesize"));
                    }
                    // overwrite default module pagesize , if we have a pagesize control in the template
                    if (metaTokens.ContainsKey("selectpagesize") && Utils.IsNumeric(_navigationdata.PageSize))
                    {
                        pageSize = Convert.ToInt32(_navigationdata.PageSize);
                    }
                    //check for url param page size
                    if (Utils.IsNumeric(_pagesize) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageSize = Convert.ToInt32(_pagesize);
                    }
                    if (pageSize == 0)
                    {
                        var strPgSize = "";
                        if (metaTokens.ContainsKey("searchpagesize"))
                        {
                            strPgSize = metaTokens["searchpagesize"];
                        }
                        if (metaTokens.ContainsKey("pagesize") && strPgSize == "")
                        {
                            strPgSize = metaTokens["pagesize"];
                        }
                        if (Utils.IsNumeric(strPgSize))
                        {
                            pageSize = Convert.ToInt32(strPgSize);
                        }
                    }
                    if (pageSize > 0)
                    {
                        CtrlPaging.Visible = true;
                    }
                    _navigationdata.PageSize = pageSize.ToString("");

                    #endregion

                    var pageNumber = 1;
                    //check for url param paging
                    if (Utils.IsNumeric(_pagenum) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageNumber = Convert.ToInt32(_pagenum);
                    }

                    //Get returnlimt from module settings
                    var returnlimit    = 0;
                    var strreturnlimit = ModSettings.Get("returnlimit");
                    if (Utils.IsNumeric(strreturnlimit))
                    {
                        returnlimit = Convert.ToInt32(strreturnlimit);
                    }

                    #endregion

                    #region "Get filter setup"

                    // check the display header to see if we have a sqlfilter defined.
                    var strFilter         = "";
                    var sqlTemplateFilter = "";
                    if (metaTokens.ContainsKey("sqlfilter"))
                    {
                        sqlTemplateFilter = GenXmlFunctions.StripSqlCommands(metaTokens["sqlfilter"]);
                    }

                    if (_navigationdata.HasCriteria)
                    {
                        var paramcatid = Utils.RequestQueryStringParam(Context, "catid");
                        if (Utils.IsNumeric(paramcatid))
                        {
                            if (_navigationdata.CategoryId != Convert.ToInt32(paramcatid)) // filter mode DOES NOT persist catid (stop confusion when user selects a category)
                            {
                                _navigationdata.ResetSearch();
                            }
                        }

                        // if navdata is not deleted then get filter from navdata, created by productsearch module.
                        strFilter = _navigationdata.Criteria;
                        if (!strFilter.Contains(sqlTemplateFilter))
                        {
                            strFilter += " " + sqlTemplateFilter;
                        }

                        if (_navigationdata.Mode.ToLower() == "s")
                        {
                            _navigationdata.ResetSearch();                                        // single search so clear after
                        }
                    }
                    else
                    {
                        // reset search if category selected
                        // NOTE: keeping search across categories is VERY confusing for cleint, although it works logically.
                        _navigationdata.ResetSearch();
                        strFilter = sqlTemplateFilter;
                    }

                    #endregion

                    #region "Get Category select setup"

                    var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier;
                    var dbOwner = DataProvider.Instance().DatabaseOwner;

                    //get default catid.
                    var catseo   = _catid;
                    var defcatid = ModSettings.Get("defaultcatid");
                    if (defcatid == "")
                    {
                        defcatid = "0";
                    }
                    if (Utils.IsNumeric(defcatid) && Convert.ToInt32(defcatid) > 0)
                    {
                        // if we have no filter use the default category
                        if (_catid == "" && strFilter.Trim() == "")
                        {
                            _catid = defcatid;
                        }
                    }
                    else
                    {
                        defcatid = ModSettings.Get("defaultpropertyid");
                        if (defcatid == "")
                        {
                            defcatid = "0";
                        }
                        if (Utils.IsNumeric(defcatid))
                        {
                            // if we have no filter use the default category
                            if (_catid == "" && strFilter.Trim() == "")
                            {
                                _catid = defcatid;
                            }
                        }
                    }

                    // If we have a static list,then always display the default category
                    if (ModSettings.Get("staticlist") == "True")
                    {
                        if (catseo == "")
                        {
                            catseo = _catid;
                        }
                        _catid = defcatid;
                        if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                        }
                        else
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                        }

                        if (ModSettings.Get("caturlfilter") == "True" && catseo != "" && catseo != _catid)
                        {
                            // add aditional filter for catid filter on url (catseo holds catid from url)
                            if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + catseo + ") ";
                            }
                            else
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + catseo + ") ";
                            }
                        }
                        // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq.
                        if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                        {
                            _navigationdata.OrderBy = "{bycategoryproduct}" + _catid;
                        }
                    }
                    else
                    {
                        #region "use url to get category to display"

                        //check if we are display categories
                        // get category list data
                        if (_catname != "") // if catname passed in url, calculate what the catid is
                        {
                            objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORYLANG", _catname);
                            if (objCat == null)
                            {
                                // check it's not just a single language
                                objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORY", _catname);
                                if (objCat != null)
                                {
                                    _catid = objCat.ItemID.ToString("");
                                }
                            }
                            else
                            {
                                _catid = objCat.ParentItemId.ToString("");
                                if (!String.IsNullOrEmpty(objCat.GUIDKey) && Utils.IsNumeric(_catid) && objCat.Lang != Utils.GetCurrentCulture())
                                {
                                    // do a 301 redirect to correct url for the langauge (If the langauge is changed on the product list, we need to make sure we have the correct catref for the langauge)
                                    var catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());
                                    var activeCat  = catGrpCtrl.GetCategory(Convert.ToInt32(_catid));
                                    if (activeCat != null)
                                    {
                                        var redirecturl = "";
                                        if (Utils.IsNumeric(_eid))
                                        {
                                            var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode);
                                            redirecturl = NBrightBuyUtils.GetEntryUrl(PortalId, _eid, _modkey, prdData.SEOName, TabId.ToString(), "", activeCat.categoryrefGUIDKey);
                                        }
                                        else
                                        {
                                            redirecturl = catGrpCtrl.GetCategoryUrl(activeCat, TabId, Utils.GetCurrentCulture());
                                        }

                                        try
                                        {
                                            if (redirecturl != "")
                                            {
                                                Response.Redirect(redirecturl, false);
                                                Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
                                                Response.End();
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            // catch err
                                        }
                                    }
                                }
                            }
                            // We have a category selected (in url), so overwrite categoryid navigationdata.
                            // This allows the return to the same category after a returning from a entry view.
                            if (Utils.IsNumeric(_catid))
                            {
                                _navigationdata.CategoryId = Convert.ToInt32(_catid);
                            }
                            catseo = _catid;
                            _navigationdata.ResetSearch();
                            strFilter = "";
                        }

                        if (Utils.IsNumeric(_catid))
                        {
                            if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                            }
                            else
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                            }

                            if (Utils.IsNumeric(catseo))
                            {
                                var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catseo), "CATEGORYLANG", Utils.GetCurrentCulture());
                                if (objSEOCat != null && _eid == "") // we may have a detail page and listonly module, in which can we need the product detail as page title
                                {
                                    //Page Title
                                    var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                    if (seoname == "")
                                    {
                                        seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                    }

                                    var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle");
                                    if (newBaseTitle == "")
                                    {
                                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                    }
                                    if (newBaseTitle == "")
                                    {
                                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                    }
                                    if (newBaseTitle != "")
                                    {
                                        BasePage.Title = newBaseTitle;
                                    }
                                    //Page KeyWords
                                    var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords");
                                    if (newBaseKeyWords != "")
                                    {
                                        BasePage.KeyWords = newBaseKeyWords;
                                    }
                                    //Page Description
                                    var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription");
                                    if (newBaseDescription == "")
                                    {
                                        newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc");
                                    }
                                    if (newBaseDescription != "")
                                    {
                                        BasePage.Description = newBaseDescription;
                                    }


                                    // Remove canonical link for list.  The Open URL Rewriter (OUR) will create a url that is different to the default SEO url in NBS.
                                    // So to stop clashes it's been disable by default.  The requirment for a canonical link on a category list is more ticking the box than of being any SEO help (might even be causing confusion to Search Engines).
                                    // ** If your a SEO nutcases (or SEO companies pushing for it) then you can uncomment the code below, and you can implement the Open URL Rewriter and canonical link.

                                    //if (PortalSettings.HomeTabId == TabId)
                                    //    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                                    //else
                                    //{
                                    //    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, seoname, Utils.GetCurrentCulture()));
                                    //    // Code required for OUR (if used, test to ensure it works correctly!!)
                                    //    //PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, "", Utils.GetCurrentCulture()));
                                    //}
                                }
                            }

                            // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq.
                            if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                            {
                                _navigationdata.OrderBy = "{bycategoryproduct}" + _catid;
                            }
                        }
                        else
                        {
                            if (!_navigationdata.FilterMode)
                            {
                                _navigationdata.CategoryId = 0;                              // filter mode persist catid
                            }
                            if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                            {
                                _navigationdata.OrderBy = " Order by ModifiedDate DESC  ";
                            }
                        }

                        #endregion
                    }

                    // This allows the return to the same category after a returning from a entry view. + Gives support for current category in razor tokens
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.CategoryId = Convert.ToInt32(_catid);
                    }

                    #endregion

                    #region "Apply provider product filter"

                    // Special filtering can be done, by using the ProductFilter interface.
                    var productfilterkey = "";
                    if (metaTokens.ContainsKey("providerfilterkey"))
                    {
                        productfilterkey = metaTokens["providerfilterkey"];
                    }
                    if (productfilterkey != "")
                    {
                        var provfilter = FilterInterface.Instance(productfilterkey);
                        if (provfilter != null)
                        {
                            strFilter = provfilter.GetFilter(strFilter, _navigationdata, ModSettings, Context);
                        }
                    }

                    #endregion

                    #region "itemlists (wishlist)"

                    // if we have a itemListName field then get the itemlist cookie.
                    if (ModSettings.Get("displaytype") == "2") // displaytype 2 = "selected list"
                    {
                        var cw = new ItemListData(PortalId, UserController.Instance.GetCurrentUserInfo().UserID);
                        if (cw.Exists && cw.ItemCount > 0)
                        {
                            strFilter = " and (";
                            foreach (var i in cw.GetItemList())
                            {
                                strFilter += " NB1.itemid = '" + i + "' or";
                            }
                            strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") ";
                            // remove the last "or"
                        }
                        else
                        {
                            //no data in list so select false itemid to stop anything displaying
                            strFilter += " and (NB1.itemid = '-1') ";
                        }
                    }

                    #endregion

                    // insert page header text
                    NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, Path.GetFileNameWithoutExtension(_templD) + "_head" + Path.GetExtension(_templD), _controlPath, ModSettings.ThemeFolder, ModSettings.Settings());

                    // save navigation data
                    _navigationdata.PageModuleId = Utils.RequestParam(Context, "pagemid");
                    _navigationdata.PageNumber   = Utils.RequestParam(Context, "page");
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.PageName = NBrightBuyUtils.GetCurrentPageName(Convert.ToInt32(_catid));
                    }

                    // save the last active modulekey to a cookie, so it can be used by the "NBrightBuyUtils.GetReturnUrl" function
                    NBrightCore.common.Cookie.SetCookieValue(PortalId, "NBrigthBuyLastActive", "ModuleKey", ModuleKey, 1);


                    if (strFilter.Trim() == "")
                    {
                        // if at this point we have no filter, then assume we're using urlrewriter and a 404 url has been entered.
                        // rather than display all visible products in a list with no default.
                        // redirect to the product display function, so we can display a 404 and product not found.
                        RazorDisplayDataEntry(_eid);
                    }
                    else
                    {
                        strFilter += " and (NB3.Visible = 1) "; // get only visible products

                        var recordCount = ModCtrl.GetDataListCount(PortalId, ModuleId, EntityTypeCode, strFilter, EntityTypeCodeLang, Utils.GetCurrentCulture(), DebugMode);

                        _navigationdata.RecordCount = recordCount.ToString("");
                        _navigationdata.Save();

                        if (returnlimit > 0 && returnlimit < recordCount)
                        {
                            recordCount = returnlimit;
                        }

                        // **** check if we already have the template cached, if so no need for DB call or razor call ****
                        // get same cachekey used for DB return, and use for razor.
                        var razorcachekey = ModCtrl.GetDataListCacheKey(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                        var cachekey      = "NBrightBuyRazorOutput" + _templD + "*" + razorcachekey + PortalId.ToString();
                        var strOut        = (String)NBrightBuyUtils.GetModCache(cachekey);
                        if (strOut == null || StoreSettings.Current.DebugMode)
                        {
                            var l = ModCtrl.GetDataList(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                            strOut = NBrightBuyUtils.RazorTemplRenderList(_templD, ModuleId, razorcachekey, l, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                        }

                        var lit = new Literal();
                        lit.Text = strOut;
                        phData.Controls.Add(lit);

                        if (_navigationdata.SingleSearchMode)
                        {
                            _navigationdata.ResetSearch();
                        }

                        if (pageSize > 0)
                        {
                            CtrlPaging.PageSize     = pageSize;
                            CtrlPaging.CurrentPage  = pageNumber;
                            CtrlPaging.TotalRecords = recordCount;
                            CtrlPaging.BindPageLinks();
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public static string CalcGroupPromoItem(NBrightInfo p)
        {
            var objCtrl        = new NBrightBuyController();
            var typeselect     = p.GetXmlProperty("genxml/radiobuttonlist/typeselect");
            var catgroupid     = p.GetXmlProperty("genxml/dropdownlist/catgroupid");
            var propgroupid    = p.GetXmlProperty("genxml/dropdownlist/propgroupid");
            var promoname      = p.GetXmlProperty("genxml/textbox/name");
            var amounttype     = p.GetXmlProperty("genxml/radiobuttonlist/amounttype");
            var amount         = p.GetXmlPropertyDouble("genxml/textbox/amount");
            var validfrom      = p.GetXmlProperty("genxml/textbox/validfrom");
            var validuntil     = p.GetXmlProperty("genxml/textbox/validuntil");
            var overwrite      = p.GetXmlPropertyBool("genxml/checkbox/overwrite");
            var disabled       = p.GetXmlPropertyBool("genxml/checkbox/disabled");
            var lastcalculated = p.GetXmlProperty("genxml/hidden/lastcalculated");

            if (!disabled)
            {
                var runcalc = true;
                if (Utils.IsDate(lastcalculated))
                {
                    if (Convert.ToDateTime(lastcalculated) >= p.ModifiedDate)
                    {
                        runcalc = false;                                                           // only run if changed
                    }
                    if (DateTime.Now.Date > Convert.ToDateTime(lastcalculated).Date.AddDays(1))
                    {
                        runcalc = true;                                                                             // every day just after midnight. (for site performace)
                    }
                }
                if (Utils.IsDate(validuntil))
                {
                    if (DateTime.Now.Date > Convert.ToDateTime(validuntil))
                    {
                        runcalc = true;                                                         // need to disable the promo if passed date
                    }
                }
                if ((runcalc) && Utils.IsDate(validfrom) && Utils.IsDate(validuntil))
                {
                    var          dteF = Convert.ToDateTime(validfrom).Date;
                    var          dteU = Convert.ToDateTime(validuntil).Date;
                    CategoryData gCat;
                    var          groupid = catgroupid;
                    if (typeselect != "cat")
                    {
                        groupid = propgroupid;
                    }

                    gCat = CategoryUtils.GetCategoryData(groupid, Utils.GetCurrentCulture());
                    var prdList = gCat.GetAllArticles();

                    foreach (var prd in prdList)
                    {
                        if (DateTime.Now.Date >= dteF && DateTime.Now.Date <= dteU)
                        {
                            // CALC Promo
                            CalcProductSalePrice(p.PortalId, prd.ParentItemId, amounttype, amount, promoname, p.ItemID, overwrite, dteF, dteU);
                        }
                        if (DateTime.Now.Date > dteU)
                        {
                            // END Promo
                            RemoveProductPromoData(p.PortalId, prd.ParentItemId, p.ItemID);
                            p.SetXmlProperty("genxml/checkbox/disabled", "True");
                            objCtrl.Update(p);
                        }
                        ProductUtils.RemoveProductDataCache(p.PortalId, prd.ParentItemId);
                    }

                    p.SetXmlProperty("genxml/hidden/lastcalculated", DateTime.Now.AddSeconds(10).ToString("O"));     // Add 10 sec to time so we don't get exact clash with update time.
                    objCtrl.Update(p);
                }
            }
            return("OK");
        }
Ejemplo n.º 8
0
        public static string CalcGroupPromoItem(NBrightInfo p)
        {
            var objCtrl        = new NBrightBuyController();
            var typeselect     = p.GetXmlProperty("genxml/radiobuttonlist/typeselect");
            var catgroupid     = p.GetXmlProperty("genxml/dropdownlist/catgroupid");
            var propgroupid    = p.GetXmlProperty("genxml/dropdownlist/propgroupid");
            var promoname      = p.GetXmlProperty("genxml/textbox/name");
            var amounttype     = p.GetXmlProperty("genxml/radiobuttonlist/amounttype");
            var amount         = p.GetXmlPropertyDouble("genxml/textbox/amount");
            var validfrom      = p.GetXmlProperty("genxml/textbox/validfrom");
            var validuntil     = p.GetXmlProperty("genxml/textbox/validuntil");
            var overwrite      = p.GetXmlPropertyBool("genxml/checkbox/overwrite");
            var disabled       = p.GetXmlPropertyBool("genxml/checkbox/disabled");
            var lastcalculated = p.GetXmlProperty("genxml/hidden/lastcalculated");
            var whichprice     = p.GetXmlPropertyInt("genxml/radiobuttonlist/whichprice");
            var runfreq        = p.GetXmlPropertyInt("genxml/radiobuttonlist/runfreq");

            if (!disabled)
            {
                var portalsettings = NBrightDNN.DnnUtils.GetPortalSettings(p.PortalId);
                var lang           = portalsettings.DefaultLanguage;

                var prdList = new List <NBrightInfo>();
                if (typeselect == "all")
                {
                    prdList = objCtrl.GetList(p.PortalId, -1, "PRD");
                }
                else
                {
                    CategoryData gCat;
                    var          groupid = catgroupid;
                    if (typeselect != "cat")
                    {
                        groupid = propgroupid;
                    }
                    gCat = CategoryUtils.GetCategoryData(groupid, lang);
                    if (gCat != null)
                    {
                        prdList = gCat.GetAllArticles();
                    }
                }

                var runcalc = true;
                if (runfreq == 1 || runfreq == 3) // run freq is date range
                {
                    if (runfreq == 3)
                    {
                        // run constantly, set end date to +100 year
                        validfrom  = DateTime.Now.AddYears(-1).ToString("s");
                        validuntil = DateTime.Now.AddYears(100).ToString("s");
                    }
                    // run date range
                    if (Utils.IsDate(lastcalculated))
                    {
                        if (Convert.ToDateTime(lastcalculated) >= p.ModifiedDate)
                        {
                            runcalc = false;                                                       // only run if changed
                        }
                        if (DateTime.Now.Date > Convert.ToDateTime(lastcalculated).Date.AddDays(1))
                        {
                            runcalc = true;                                                                         // every day just after midnight. (for site performace)
                        }
                    }
                    if (Utils.IsDate(validuntil))
                    {
                        if (DateTime.Now.Date > Convert.ToDateTime(validuntil))
                        {
                            runcalc = true;                                                     // need to disable the promo if passed date
                        }
                    }
                    if ((runcalc) && Utils.IsDate(validfrom) && Utils.IsDate(validuntil))
                    {
                        var dteF = Convert.ToDateTime(validfrom).Date;
                        var dteU = Convert.ToDateTime(validuntil).Date;

                        foreach (var prd in prdList)
                        {
                            var productid = prd.ParentItemId;
                            if (typeselect == "all")
                            {
                                productid = prd.ItemID;
                            }

                            if (DateTime.Now.Date >= dteF && DateTime.Now.Date <= dteU)
                            {
                                // CALC Promo
                                CalcProductSalePrice(p.PortalId, productid, amounttype, amount, p.ItemID, whichprice, overwrite);
                            }
                            if (DateTime.Now.Date > dteU)
                            {
                                // END Promo
                                RemoveProductPromoData(p.PortalId, productid, p.ItemID);
                            }
                            ProductUtils.RemoveProductDataCache(p.PortalId, productid);
                            var productData = ProductUtils.GetProductData(productid, lang);
                            productData.Save(); // recalc any new prices.
                        }
                        if (DateTime.Now.Date > dteU)
                        {
                            // END Promo
                            p.SetXmlProperty("genxml/checkbox/disabled", "True");
                        }
                    }
                }
                if (runfreq == 2) // run Once, do update and disable promo.
                {
                    foreach (var prd in prdList)
                    {
                        var productid = prd.ParentItemId;
                        if (typeselect == "all")
                        {
                            productid = prd.ItemID;
                        }
                        // CALC Promo
                        CalcProductSalePrice(p.PortalId, productid, amounttype, amount, p.ItemID, whichprice, overwrite);
                        ProductUtils.RemoveProductDataCache(p.PortalId, productid);
                        var productData = ProductUtils.GetProductData(productid, lang);
                        productData.Save(); // recalc any new prices.
                    }
                    p.SetXmlProperty("genxml/checkbox/disabled", "True");
                }
                if (runfreq == 4) // remove
                {
                    foreach (var prd in prdList)
                    {
                        var productid = prd.ParentItemId;
                        if (typeselect == "all")
                        {
                            productid = prd.ItemID;
                        }
                        RemoveProductPromoData(p.PortalId, productid, p.ItemID);
                        ProductUtils.RemoveProductDataCache(p.PortalId, productid);
                        var productData = ProductUtils.GetProductData(productid, lang);
                        productData.Save(); // recalc any new prices.
                    }

                    p.SetXmlProperty("genxml/checkbox/disabled", "True");
                }
                p.SetXmlProperty("genxml/hidden/lastcalculated", DateTime.Now.AddSeconds(10).ToString("O")); // Add 10 sec to time so we don't get exact clash with update time.
                objCtrl.Update(p);
            }
            return("OK");
        }
Ejemplo n.º 9
0
        override protected void OnInit(EventArgs e)
        {
            _eid           = Utils.RequestQueryStringParam(Context, "eid");
            _print         = Utils.RequestParam(Context, "print");
            _printtemplate = Utils.RequestParam(Context, "template");

            EnablePaging = true;

            base.OnInit(e);

            // if guidkey entered instead of eid, find it using the guid and assign to _eid
            _guidkey = Utils.RequestQueryStringParam(Context, "guidkey");
            if (_guidkey == "")
            {
                _guidkey = Utils.RequestQueryStringParam(Context, "ref");
            }
            if (_eid == "" && _guidkey != "")
            {
                var guidData = ModCtrl.GetByGuidKey(PortalId, -1, "PRD", _guidkey);
                if (guidData != null)
                {
                    _eid = guidData.ItemID.ToString("D");
                }
                else
                {
                    _eid = "0";
                }
            }

            // if we want to print we need to open the browser with a startup script, this points to a Printview.aspx. (Must go after the ModSettings has been init.)
            if (_print != "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "printproduct", "window.open('" + StoreSettings.NBrightBuyPath() + "/PrintView.aspx?itemid=" + _eid + "&printcode=" + _print + "&template=" + _printtemplate + "&theme=" + ModSettings.Get("themefolder") + "','_blank');", true);
            }

            if (ModuleKey == "")  // if we don't have module setting jump out
            {
                rpDataH.ItemTemplate = new GenXmlTemplate("NO MODULE SETTINGS");
                return;
            }

            _navigationdata = new NavigationData(PortalId, ModuleKey);

            // Pass in a template specifying the token to create a friendly url for paging.
            // (NOTE: we need this in NBS becuase the edit product from list return url will copy the page number and hence paging will not work after editing if we don;t do this)
            CtrlPaging.HrefLinkTemplate = "[<tag type='valueof' databind='PreText' />][<tag type='if' databind='Text' testvalue='' display='{OFF}' />][<tag type='hrefpagelink' moduleid='" + ModuleId.ToString("") + "' />][<tag type='endif' />][<tag type='valueof' databind='PostText' />]";
            CtrlPaging.UseListDisplay   = true;
            try
            {
                _catid   = Utils.RequestQueryStringParam(Context, "catid");
                _catname = Utils.RequestQueryStringParam(Context, "catref");

                #region "set templates based on entry id (eid) from url"

                _ename        = Utils.RequestQueryStringParam(Context, "entry");
                _modkey       = Utils.RequestQueryStringParam(Context, "modkey");
                _pagemid      = Utils.RequestQueryStringParam(Context, "pagemid");
                _pagenum      = Utils.RequestQueryStringParam(Context, "page");
                _pagesize     = Utils.RequestQueryStringParam(Context, "pagesize");
                _orderbyindex = Utils.RequestQueryStringParam(Context, "orderby");


                // see if we need to display the entry page.
                if ((_modkey == ModuleKey | _modkey == "") && (_eid != "" | _ename != ""))
                {
                    _displayentrypage = true;
                }

                // if we have entry detail display, but no catd, get the default one.
                if (_displayentrypage && _catid == "" && Utils.IsNumeric(_eid))
                {
                    var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture());
                    var defcat  = prdData.GetDefaultCategory();
                    if (defcat != null)
                    {
                        _catid = defcat.categoryid.ToString("");
                    }
                }

                if (ModSettings.Get("listonly").ToLower() == "true")
                {
                    _displayentrypage = false;
                }

                // get template codes
                if (_displayentrypage)
                {
                    _templH = ModSettings.Get("txtdisplayentryheader");
                    _templD = ModSettings.Get("txtdisplayentrybody");
                    _templF = ModSettings.Get("txtdisplayentryfooter");
                }
                else
                {
                    _templH = ModSettings.Get("txtdisplayheader");
                    _templD = ModSettings.Get("txtdisplaybody");
                    _templF = ModSettings.Get("txtdisplayfooter");
                }


                #endregion


                // Get Display Header
                var rpDataHTempl = ModCtrl.GetTemplateData(ModSettings, _templH, Utils.GetCurrentCulture(), DebugMode);

                //-------------------------------------------------------------------------
                //Get default sort order and filter from the displayheader template.  Use template data, becuase repeater is not fully initialized yet.
                _strOrder = _navigationdata.OrderBy;
                if (String.IsNullOrEmpty(_strOrder))
                {
                    _strOrder = GenXmlFunctions.GetSqlOrderBy(rpDataHTempl); // get default
                }
                if (_orderbyindex != "")                                     // if we have orderby set in url, find the meta tags
                {
                    _strOrder = GenXmlFunctions.GetSqlOrderBy(rpDataHTempl, _orderbyindex);
                    // save the selected orderby to the cookie, so we can page with it.
                    _navigationdata.OrderBy = _strOrder;
                }
                //-------------------------------------------------------------------------

                var cachekey = "GenXmlTemplate*rpDataH" + _templH + "*" + ModuleId.ToString();
                _templateHeader = (GenXmlTemplate)Utils.GetCache(cachekey);
                if (_templateHeader == null || StoreSettings.Current.DebugMode)
                {
                    _templateHeader = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                }
                rpDataH.ItemTemplate = _templateHeader;

                // insert page header text
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, _templateHeader, ModSettings.Settings(), null, DebugMode);

                // Get Display Body
                var rpDataTempl = ModCtrl.GetTemplateData(ModSettings, _templD, Utils.GetCurrentCulture(), DebugMode);
                //if body template doesn't contain a default moduleid add it.
                if (!rpDataTempl.ToLower().Contains("nbs:modeldefault"))
                {
                    rpDataTempl = "[<tag type='nbs:modeldefault' />]" + rpDataTempl;
                }
                // always add a productid hidden field to the data template (for add to cart)
                rpDataTempl = "[<tag type='hidden' id='productid' value='databind:itemid' />]" + rpDataTempl;

                cachekey = "GenXmlTemplate*rpData" + _templD + "*" + ModuleId.ToString();
                var gXml = (GenXmlTemplate)Utils.GetCache(cachekey);
                if (gXml == null || StoreSettings.Current.DebugMode)
                {
                    gXml = NBrightBuyUtils.GetGenXmlTemplate(rpDataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                }
                rpData.ItemTemplate = gXml;

                // Get Display Footer
                var rpDataFTempl = ModCtrl.GetTemplateData(ModSettings, _templF, Utils.GetCurrentCulture(), DebugMode);

                cachekey = "GenXmlTemplate*rpDataF" + _templF + "*" + ModuleId.ToString();
                gXml     = (GenXmlTemplate)Utils.GetCache(cachekey);
                if (gXml == null || StoreSettings.Current.DebugMode)
                {
                    gXml = NBrightBuyUtils.GetGenXmlTemplate(rpDataFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                }
                rpDataF.ItemTemplate = gXml;
            }
            catch (Exception exc)
            {
                // remove any cookie which might store SQL in error.
                _navigationdata.Delete();
                DisplayProductError(exc.ToString());
            }
        }
Ejemplo n.º 10
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg     = e.CommandArgument.ToString();
            var rtnTabId = TabId;
            var param    = new string[4];


            if (_guidkey != "")
            {
                param[0] = "ref=" + _guidkey; //using ref is url
            }
            else
            if (_eid != "")
            {
                param[0] = "eid=" + _eid;                 // using id in url
            }
            if (_modkey != "")
            {
                param[1] = "modkey=" + _modkey;
            }

            if (_catname != "")
            {
                param[2] = "catref=" + _catname; //using ref is url
            }
            else
            if (_catid != "")
            {
                param[2] = "catid=" + _catid;                   //using id is url
            }
            // redirect to cart after add to basket is arg is redirect
            if (cArg.ToLower() == "redirect" && Utils.IsNumeric(StoreSettings.Current.CartTabId))
            {
                rtnTabId = StoreSettings.Current.CartTabId;
            }
            if (cArg.ToLower() == "redirectnoparam" && Utils.IsNumeric(StoreSettings.Current.CartTabId))
            {
                rtnTabId = StoreSettings.Current.CartTabId;
                param[0] = "";
                param[1] = "";
                param[2] = "";
            }

            switch (e.CommandName.ToLower())
            {
            case "addtobasket":
                var currentcart = new CartData(PortalId);
                currentcart.AddItem(rpData, StoreSettings.Current.SettingsInfo, e.Item.ItemIndex, DebugMode);
                currentcart.Save(StoreSettings.Current.DebugMode);
                param[3] = "addcart=1";
                Response.Redirect(Globals.NavigateURL(rtnTabId, "", param), true);
                break;

            case "addalltobasket":
                var currentcart2 = new CartData(PortalId);
                foreach (RepeaterItem ri in rpData.Items)
                {
                    currentcart2.AddItem(rpData, StoreSettings.Current.SettingsInfo, ri.ItemIndex, DebugMode);
                }
                currentcart2.Save(StoreSettings.Current.DebugMode);
                param[3] = "addcart=1";
                Response.Redirect(Globals.NavigateURL(rtnTabId, "", param), true);
                break;

            case "addcookietobasket":
                var currentcart3 = new CartData(PortalId);
                currentcart3.AddCookieToCart();
                currentcart3.Save(StoreSettings.Current.DebugMode);
                param[3] = "addcart=1";
                Response.Redirect(Globals.NavigateURL(rtnTabId, "", param), true);
                break;

            case "docdownload":
                var s = cArg.Split(':');
                if (s.Length == 2)
                {
                    var itemid = s[0];
                    var idx    = s[1];
                    if (Utils.IsNumeric(idx) && Utils.IsNumeric(itemid))
                    {
                        var index   = Convert.ToInt32(idx);
                        var prdData = ProductUtils.GetProductData(Convert.ToInt32(itemid), Utils.GetCurrentCulture());
                        if (prdData.Docs.Count >= index)
                        {
                            var docInfo     = prdData.Docs[index - 1];
                            var docFilePath = docInfo.GetXmlProperty("genxml/hidden/filepath");
                            var fileName    = docInfo.GetXmlProperty("genxml/textbox/txtfilename");;
                            var fileExt     = docInfo.GetXmlProperty("genxml/hidden/fileext");
                            var purchase    = docInfo.GetXmlProperty("genxml/checkbox/chkpurchase");

                            if (fileName == "")
                            {
                                fileName = "filename";
                            }
                            if (!fileName.EndsWith(fileExt))
                            {
                                fileName += fileExt;
                            }

                            if (purchase == "True")
                            {
                                //[TODO: check if the document has been purchased]
                                Utils.ForceDocDownload(docFilePath, fileName, Response);
                            }
                            else
                            {
                                Utils.ForceDocDownload(docFilePath, fileName, Response);
                            }
                        }
                    }
                }
                break;

            case "printproduct":
                param[0] = "eid=" + _eid;
                param[1] = "print=printproduct";
                param[2] = "template=printproduct.html";
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            default:
                //check for any command providers.
                var providerList = NBrightCore.providers.GenXProviderManager.ProviderList;
                if (providerList != null)
                {
                    foreach (var prov in providerList)
                    {
                        prov.Value.CtrlItemCommand(source, e);
                    }
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;
            }
        }
Ejemplo n.º 11
0
        private void PageLoad()
        {
            NBrightInfo objCat = null;

            #region "Data Repeater"
            if (_templD.Trim() != "")  // if we don;t have a template, don't do anything
            {
                if (_displayentrypage)
                {
                    // get correct itemid, based on eid given
                    if (_ename != "")
                    {
                        var o = ModCtrl.GetByGuidKey(PortalId, ModuleId, EntityTypeCodeLang, _ename);
                        if (o == null)
                        {
                            o = ModCtrl.GetByGuidKey(PortalId, ModuleId, EntityTypeCode, _ename);
                            if (o != null)
                            {
                                _eid = o.ItemID.ToString("");
                            }
                        }
                        else
                        {
                            _eid = o.ParentItemId.ToString("");
                        }
                    }

                    DisplayDataEntryRepeater(_eid);
                }
                else
                {
                    #region "Order BY"
                    // get orderby from header if it's there
                    var cachekey = "GetSqlOrderBy*rpDataH" + _templH + "*" + ModuleId.ToString();
                    _strOrder = (String)Utils.GetCache(cachekey);
                    if (_strOrder == null || StoreSettings.Current.DebugMode)
                    {
                        _strOrder = GenXmlFunctions.GetSqlOrderBy(rpDataH);
                    }

                    //Default orderby if not set
                    if (String.IsNullOrEmpty(_strOrder))
                    {
                        _strOrder = " Order by ModifiedDate DESC  ";
                    }
                    // NOTE: This setting may be overwritten by the navigatedata class in the filter setup
                    #endregion

                    #region "Get Paging setup"
                    //See if we have a pagesize, uses the "searchpagesize" tag token.
                    // : This can be overwritten by the cookie value if we need user selection of pagesize.
                    CtrlPaging.Visible = false;

                    #region "Get pagesize, from best place"
                    var pageSize = 0;
                    if (Utils.IsNumeric(_navigationdata.PageSize))
                    {
                        pageSize = Convert.ToInt32(_navigationdata.PageSize);
                    }
                    if (!Utils.IsNumeric(pageSize) && Utils.IsNumeric(ModSettings.Get("pagesize")))
                    {
                        pageSize = Convert.ToInt32(ModSettings.Get("pagesize"));
                    }
                    //check for url param page size
                    if (Utils.IsNumeric(_pagesize) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageSize = Convert.ToInt32(_pagesize);
                    }
                    if (pageSize == 0)
                    {
                        var strPgSize = "";
                        if (_templateHeader != null)
                        {
                            strPgSize = _templateHeader.GetHiddenFieldValue("searchpagesize");
                        }
                        if (_templateHeader != null && strPgSize == "")
                        {
                            strPgSize = _templateHeader.GetHiddenFieldValue("pagesize");
                        }
                        if (Utils.IsNumeric(strPgSize))
                        {
                            pageSize = Convert.ToInt32(strPgSize);
                        }
                    }
                    if (pageSize > 0)
                    {
                        CtrlPaging.Visible = true;
                    }
                    _navigationdata.PageSize = pageSize.ToString("");
                    #endregion

                    var pageNumber = 1;
                    //check for url param paging
                    if (Utils.IsNumeric(_pagenum) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageNumber = Convert.ToInt32(_pagenum);
                    }

                    //Get returnlimt from module settings
                    var returnlimit    = 0;
                    var strreturnlimit = ModSettings.Get("returnlimit");
                    if (Utils.IsNumeric(strreturnlimit))
                    {
                        returnlimit = Convert.ToInt32(strreturnlimit);
                    }

                    #endregion

                    #region "Get filter setup"

                    // check the display header to see if we have a sqlfilter defined.
                    var strFilter = "";
                    cachekey = "GetSqlSearchFilters*rpDataH" + _templH + "*" + ModuleId.ToString();
                    var strHeaderFilter = (String)Utils.GetCache(cachekey);
                    if (strHeaderFilter == null || StoreSettings.Current.DebugMode)
                    {
                        strHeaderFilter = GenXmlFunctions.GetSqlSearchFilters(rpDataH);
                    }

                    // filter mode and will persist past category selection.
                    if ((_catid == "" && _catname == ""))
                    {
                        if (!_navigationdata.FilterMode)
                        {
                            _navigationdata.CategoryId = 0;                              // filter mode persist catid
                        }
                        // if navdata is not deleted then get filter from navdata, created by productsearch module.
                        strFilter = _navigationdata.Criteria;
                        if (!strFilter.Contains(strHeaderFilter))
                        {
                            strFilter += " " + strHeaderFilter;
                        }
                        if (!String.IsNullOrEmpty(_navigationdata.OrderBy))
                        {
                            _strOrder = _navigationdata.OrderBy;
                        }

                        if (_navigationdata.Mode.ToLower() == "s")
                        {
                            _navigationdata.ResetSearch();                                        // single search so clear after
                        }
                    }
                    else
                    {
                        _navigationdata.ResetSearch();

                        // We have a category selected (in url), so overwrite categoryid navigationdata.
                        // This allows the return to the same category after a returning from a entry view.
                        if (Utils.IsNumeric(_catid))
                        {
                            _navigationdata.CategoryId = Convert.ToInt32(_catid);
                        }
                        strFilter = strHeaderFilter;
                    }

                    #endregion

                    #region "Get Category select setup"

                    //get default catid.
                    var catseo   = _catid;
                    var defcatid = ModSettings.Get("defaultcatid");
                    if (Utils.IsNumeric(defcatid))
                    {
                        // if we have no filter use the default category
                        if (_catid == "" && strFilter.Trim() == "")
                        {
                            _catid = defcatid;
                        }

                        // If we have a static list,then always display the default category
                        if (ModSettings.Get("staticlist") == "True")
                        {
                            _catid = defcatid;
                        }
                    }
                    else
                    {
                        defcatid = ModSettings.Get("defaultpropertyid");
                        if (Utils.IsNumeric(defcatid))
                        {
                            // if we have no filter use the default category
                            if (_catid == "" && strFilter.Trim() == "")
                            {
                                _catid = defcatid;
                            }

                            // If we have a static list,then always display the default category
                            if (ModSettings.Get("staticlist") == "True")
                            {
                                _catid = defcatid;
                            }
                        }
                    }

                    //check if we are display categories
                    // get category list data
                    if (_catname != "") // if catname passed in url, calculate what the catid is
                    {
                        objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORYLANG", _catname);
                        if (objCat == null)
                        {
                            // check it's not just a single language
                            objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORY", _catname);
                            if (objCat != null)
                            {
                                _catid = objCat.ItemID.ToString("");
                            }
                        }
                        else
                        {
                            _catid = objCat.ParentItemId.ToString("");
                            if (!String.IsNullOrEmpty(objCat.GUIDKey) && Utils.IsNumeric(_catid) && objCat.Lang != Utils.GetCurrentCulture())
                            {
                                // do a 301 redirect to correct url for the langauge (If the langauge is changed on the product list, we need to make sure we have the correct catref for the langauge)
                                var catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());
                                var activeCat  = catGrpCtrl.GetCategory(Convert.ToInt32(_catid));
                                if (activeCat != null && (activeCat.categoryrefGUIDKey == _catname))
                                {
                                    var redirecturl = "";
                                    if (Utils.IsNumeric(_eid))
                                    {
                                        var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture());
                                        redirecturl = NBrightBuyUtils.GetEntryUrl(PortalId, _eid, _modkey, prdData.SEOName, TabId.ToString(), "", activeCat.categoryrefGUIDKey);
                                    }
                                    else
                                    {
                                        redirecturl = catGrpCtrl.GetCategoryUrl(activeCat, TabId, objCat.Lang);
                                    }

                                    try
                                    {
                                        if (redirecturl != "")
                                        {
                                            Response.Redirect(redirecturl, false);
                                            Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
                                            Response.End();
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        // catch err
                                    }
                                }
                            }
                        }
                        // We have a category selected (in url), so overwrite categoryid navigationdata.
                        // This allows the return to the same category after a returning from a entry view.
                        if (Utils.IsNumeric(_catid))
                        {
                            _navigationdata.CategoryId = Convert.ToInt32(_catid);
                        }
                        catseo = _catid;
                    }

                    if (Utils.IsNumeric(_catid))
                    {
                        var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier;
                        var dbOwner = DataProvider.Instance().DatabaseOwner;
                        if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                        }
                        else
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                        }

                        if (Utils.IsNumeric(catseo))
                        {
                            var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catseo), "CATEGORYLANG", Utils.GetCurrentCulture());
                            if (objSEOCat != null && _eid == "") // we may have a detail page and listonly module, in which can we need the product detail as page title
                            {
                                //Page Title
                                var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                if (seoname == "")
                                {
                                    seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                }

                                var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle");
                                if (newBaseTitle == "")
                                {
                                    newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                }
                                if (newBaseTitle == "")
                                {
                                    newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                }
                                if (newBaseTitle != "")
                                {
                                    BasePage.Title = newBaseTitle;
                                }
                                //Page KeyWords
                                var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords");
                                if (newBaseKeyWords != "")
                                {
                                    BasePage.KeyWords = newBaseKeyWords;
                                }
                                //Page Description
                                var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription");
                                if (newBaseDescription == "")
                                {
                                    newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc");
                                }
                                if (newBaseDescription != "")
                                {
                                    BasePage.Description = newBaseDescription;
                                }

                                if (PortalSettings.HomeTabId == TabId)
                                {
                                    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                                }
                                else
                                {
                                    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, seoname, Utils.GetCurrentCulture()));
                                }
                            }
                        }

                        if (_strOrder == "{bycategoryproduct}")
                        {
                            _strOrder += _catid;                                     // do special custom sort in each cateogry
                        }
                    }
                    else
                    {
                        if (!_navigationdata.FilterMode)
                        {
                            _navigationdata.CategoryId = 0;                              // filter mode persist catid
                        }
                        if (_strOrder == "{bycategoryproduct}")
                        {
                            _strOrder = " Order by ModifiedDate DESC  ";
                        }
                    }

                    #endregion

                    #region "Apply provider product filter"
                    // Special filtering can be done, by using the ProductFilter interface.
                    var productfilterkey = "";
                    if (_templateHeader != null)
                    {
                        productfilterkey = _templateHeader.GetHiddenFieldValue("providerfilterkey");
                    }
                    if (productfilterkey != "")
                    {
                        var provfilter = FilterInterface.Instance(productfilterkey);
                        if (provfilter != null)
                        {
                            strFilter = provfilter.GetFilter(strFilter, _navigationdata, ModSettings, Context);
                        }
                    }
                    #endregion

                    #region "itemlists (wishlist)"

                    // if we have a itemListName field then get the itemlist cookie.
                    if (_templateHeader != null)
                    {
                        _itemListName = _templateHeader.GetHiddenFieldValue("itemlistname");
                    }
                    if (_itemListName != "")
                    {
                        var cw = new ItemListData(_itemListName);
                        if (cw.Exists && cw.ItemCount > 0)
                        {
                            strFilter = " and (";
                            foreach (var i in cw.GetItemList())
                            {
                                strFilter += " NB1.itemid = '" + i + "' or";
                            }
                            strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") ";     // remove the last "or"
                        }
                        else
                        {
                            //no data in list so select false itemid to stop anything displaying
                            strFilter += " and (NB1.itemid = '-1') ";
                        }
                    }

                    #endregion


                    // save navigation data
                    _navigationdata.PageModuleId = Utils.RequestParam(Context, "pagemid");
                    _navigationdata.PageNumber   = Utils.RequestParam(Context, "page");
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.PageName = NBrightBuyUtils.GetCurrentPageName(Convert.ToInt32(_catid));
                    }

                    // save the last active modulekey to a cookie, so it can be used by the "NBrightBuyUtils.GetReturnUrl" function
                    NBrightCore.common.Cookie.SetCookieValue(PortalId, "NBrigthBuyLastActive", "ModuleKey", ModuleKey, 1);

                    strFilter += " and (NB3.Visible = 1) "; // get only visible products

                    var recordCount = ModCtrl.GetDataListCount(PortalId, ModuleId, "PRD", strFilter, "PRDLANG", Utils.GetCurrentCulture(), DebugMode);

                    _navigationdata.RecordCount = recordCount.ToString("");
                    _navigationdata.Save();

                    if (returnlimit > 0 && returnlimit < recordCount)
                    {
                        recordCount = returnlimit;
                    }

                    var l = ModCtrl.GetDataList(PortalId, ModuleId, "PRD", "PRDLANG", Utils.GetCurrentCulture(), strFilter, _strOrder, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                    rpData.DataSource = l;
                    rpData.DataBind();

                    if (_navigationdata.SingleSearchMode)
                    {
                        _navigationdata.ResetSearch();
                    }

                    if (pageSize > 0)
                    {
                        CtrlPaging.PageSize     = pageSize;
                        CtrlPaging.CurrentPage  = pageNumber;
                        CtrlPaging.TotalRecords = recordCount;
                        CtrlPaging.BindPageLinks();
                    }

                    // display header (Do header after the data return so the productcount works)
                    if (objCat == null)
                    {
                        base.DoDetail(rpDataH, ModuleId);
                    }
                    else
                    {
                        if (StoreSettings.Current.DebugModeFileOut)
                        {
                            objCat.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_categoryproductheader.xml");
                        }
                        DoDetail(rpDataH, objCat);
                    }
                }
            }

            #endregion


            // display footer
            base.DoDetail(rpDataF);
        }
Ejemplo n.º 12
0
 public override IEnumerable <OrderLine> FilterOrderLines(Order order, IEnumerable <OrderLine> orderLines)
 {
     return(NodeId == null ? orderLines : ProductUtils.OrderLinesThatMatchProductOrProductCategory(_productService, NodeId.Value, orderLines));
 }
 public IEnumerable <OrderLine> IsFulfilledBy(Order order, IEnumerable <OrderLine> previouslyFulfilledOrderLines)
 {
     return(NodeId != null?ProductUtils.OrderLinesThatMatchProductOrProductCategory(_productService, NodeId.Value, previouslyFulfilledOrderLines) : new List <OrderLine>());
 }
Ejemplo n.º 14
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            _catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());

            if (ModSettings.Get("themefolder") == "")  // if we don't have module setting jump out
            {
                rpDataH.ItemTemplate = new GenXmlTemplate("NO MODULE SETTINGS");
                return;
            }

            try
            {
                _targetModuleKey = "";
                _targetModuleKey = ModSettings.Get("targetmodulekey");

                _entryid = Utils.RequestQueryStringParam(Context, "eid");
                _catid   = Utils.RequestQueryStringParam(Context, "catid");
                _catname = Utils.RequestQueryStringParam(Context, "catref");
                if (_catid == "" && _catname != "")
                {
                    _catid = CategoryUtils.GetCatIdFromName(_catname);
                }

                var navigationdata = new NavigationData(PortalId, _targetModuleKey);
                if (Utils.IsNumeric(_catid))
                {
                    navigationdata.Delete();                          // if a category button has been clicked (in url) then clear search;
                }
                if (Utils.IsNumeric(navigationdata.CategoryId) && navigationdata.FilterMode)
                {
                    _catid = navigationdata.CategoryId.ToString("D");
                }
                if (Utils.IsNumeric(_entryid))
                {
                    // Get catid from product
                    var prodData = ProductUtils.GetProductData(Convert.ToInt32(_entryid), Utils.GetCurrentCulture());
                    var catDef   = prodData.GetDefaultCategory();
                    if (catDef != null)
                    {
                        _catid = catDef.categoryid.ToString("");
                    }
                }
                if (_catid == "")
                {
                    _catid = ModSettings.Get("defaultcatid");
                }

                _templH     = ModSettings.Get("txtdisplayheader");
                _templD     = ModSettings.Get("txtdisplaybody");
                _templDfoot = ModSettings.Get("txtdisplaybodyfoot");
                _templF     = ModSettings.Get("txtdisplayfooter");

                _tabid = ModSettings.Get("ddllisttabid");
                if (!Utils.IsNumeric(_tabid))
                {
                    _tabid = TabId.ToString("");
                }

                // Get Display Header
                var rpDataHTempl = ModCtrl.GetTemplateData(ModSettings, _templH, Utils.GetCurrentCulture(), DebugMode);


                rpDataH.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                _templateHeader      = (GenXmlTemplate)rpDataH.ItemTemplate;

                // insert page header text
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, _templateHeader, ModSettings.Settings(), null, DebugMode);

                // Get Display Body
                var rpDataTempl = ModCtrl.GetTemplateData(ModSettings, _templD, Utils.GetCurrentCulture(), DebugMode);
                rpData.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                // Get Display Footer
                var rpDataFTempl = ModCtrl.GetTemplateData(ModSettings, _templF, Utils.GetCurrentCulture(), DebugMode);
                rpDataF.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
            }
            catch (Exception exc)
            {
                if (UserInfo.IsSuperUser)
                {
                    rpDataF.ItemTemplate = new GenXmlTemplate(exc.Message, ModSettings.Settings());
                }
                // catch any error and allow processing to continue, output error as footer template.
            }
        }
Ejemplo n.º 15
0
        public ActionResult Index()
        {
            List <ProductInfo> list = ProductUtils.getProductHome();

            return(View(list));
        }