예제 #1
0
        public IEncodedString PropertyValue(GroupCategoryData groupCategopryData, String fieldname)
        {
            var strOut = "";

            try
            {
                var objCInfo = groupCategopryData;
                if (objCInfo != null)
                {
                    switch (fieldname.ToLower())
                    {
                    case "propertydesc":
                        strOut = objCInfo.categorydesc;
                        break;

                    case "message":
                        strOut = System.Web.HttpUtility.HtmlDecode(objCInfo.message);
                        break;

                    case "archived":
                        strOut = objCInfo.archived.ToString(CultureInfo.InvariantCulture);
                        break;

                    case "breadcrumb":
                        strOut = objCInfo.breadcrumb;
                        break;

                    case "propertyid":
                        strOut = objCInfo.categoryid.ToString("");
                        break;

                    case "propertyname":
                        strOut = objCInfo.categoryname;
                        break;

                    case "propertyref":
                        strOut = objCInfo.categoryref;
                        break;

                    case "depth":
                        strOut = objCInfo.depth.ToString("");
                        break;

                    case "disabled":
                        strOut = objCInfo.disabled.ToString(CultureInfo.InvariantCulture);
                        break;

                    case "entrycount":
                        strOut = objCInfo.entrycount.ToString("");
                        break;

                    case "grouptyperef":
                        strOut = objCInfo.grouptyperef;
                        break;

                    case "imageurl":
                        strOut = objCInfo.imageurl;
                        break;

                    case "ishidden":
                        strOut = objCInfo.ishidden.ToString(CultureInfo.InvariantCulture);
                        break;

                    case "isvisible":
                        strOut = objCInfo.isvisible.ToString(CultureInfo.InvariantCulture);
                        break;

                    case "metadescription":
                        strOut = objCInfo.metadescription;
                        break;

                    case "metakeywords":
                        strOut = objCInfo.metakeywords;
                        break;

                    case "parentcatid":
                        strOut = objCInfo.parentcatid.ToString("");
                        break;

                    case "recordsortorder":
                        strOut = objCInfo.recordsortorder.ToString("");
                        break;

                    case "seoname":
                        strOut = objCInfo.seoname;
                        if (strOut == "")
                        {
                            strOut = objCInfo.categoryname;
                        }
                        break;

                    case "seopagetitle":
                        strOut = objCInfo.seopagetitle;
                        break;

                    case "url":
                        strOut = objCInfo.url;
                        break;
                    }
                }
            }
            catch
            (Exception ex)
            {
                strOut = ex.ToString();
            }

            return(new RawString(strOut));
        }
예제 #2
0
        private void PageLoad()
        {
            var catid = 0;

            if (Utils.IsNumeric(_catid))
            {
                catid = Convert.ToInt32(_catid);
            }

            #region "Get default category into list for displaying header and footer templates on product (breadcrumb)"

            // if we have a product displaying, get the deault category for the category
            var obj = new GroupCategoryData();
            if (Utils.IsNumeric(_entryid))
            {
                if (catid == 0)
                {
                    catid = _catGrpCtrl.GetDefaultCatId(Convert.ToInt32(_entryid));
                }
            }
            else
            {
                if (catid != 0)
                {
                    obj = _catGrpCtrl.GetCategory(catid);
                }
            }
            var catl = new List <object> {
                obj
            };

            if (Utils.IsNumeric(catid) && ModSettings.Get("injectseo") == "True")
            {
                var eid       = Utils.RequestQueryStringParam(Context, "eid");
                var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catid), "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 = 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;
                    }
                }
            }


            #endregion

            #region "Data Repeater"


            if (_templD.Trim() != "")     // if we don;t have a template, don't do anything
            {
                var menutype = ModSettings.Get("ddlmenutype").ToLower();

                #region "Drill Down"

                if (menutype == "drilldown")
                {
                    var l = _catGrpCtrl.GetVisibleCategoriesWithUrl(catid, TabId);
                    if (l.Count == 0 && (ModSettings.Get("alwaysshow") == "True"))
                    {
                        // if we have no categories, it could be the end of branch or product view, so load the root menu
                        var catid2 = 0;
                        _catid = ModSettings.Get("defaultcatid");
                        if (Utils.IsNumeric(_catid))
                        {
                            catid2 = Convert.ToInt32(_catid);
                        }
                        l = _catGrpCtrl.GetVisibleCategoriesWithUrl(catid2, TabId);
                    }
                    rpData.DataSource = l;
                    rpData.DataBind();
                }

                #endregion

                #region "treeview"

                if (menutype == "treeview")
                {
                    var catidtree = 0;
                    if (Utils.IsNumeric(ModSettings.Get("defaultcatid")))
                    {
                        catidtree = Convert.ToInt32(ModSettings.Get("defaultcatid"));
                    }

                    var cachekey = "CatMenu*" + ModuleId.ToString("") + "*" + catid + "*" + catidtree.ToString() + "*" + Utils.GetCurrentCulture();
                    var strOut   = (String)NBrightBuyUtils.GetModCache(cachekey);
                    if (strOut == null)
                    {
                        rpData.Visible = false;
                        var catBuiler = new CatMenuBuilder(_templD, ModSettings, catid, DebugMode);
                        strOut = catBuiler.GetTreeCatList(50, catidtree, Convert.ToInt32(_tabid), ModSettings.Get("treeidentclass"), ModSettings.Get("treerootclass"));

                        // if debug , output the html used.
                        if (StoreSettings.Current.DebugModeFileOut)
                        {
                            Utils.SaveFile(PortalSettings.HomeDirectoryMapPath + "debug_treemenu.html", strOut);
                        }
                        NBrightBuyUtils.SetModCache(ModuleId, cachekey, strOut);
                    }
                    var l = new Literal {
                        Text = strOut
                    };
                    phData.Controls.Add(l);
                }

                #endregion

                #region "Accordian"

                if (menutype == "accordian")
                {
                }

                #endregion

                #region "megamenu"

                if (menutype == "megamenu")
                {
                }

                #endregion
            }

            // display header
            rpDataH.DataSource = catl;
            rpDataH.DataBind();

            // display footer
            rpDataF.DataSource = catl;
            rpDataF.DataBind();

            #endregion
        }