当前位置: 首页>>代码示例>>C#>>正文


C# NBrightBuyController.GetTemplateData方法代码示例

本文整理汇总了C#中Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController.GetTemplateData方法的典型用法代码示例。如果您正苦于以下问题:C# NBrightBuyController.GetTemplateData方法的具体用法?C# NBrightBuyController.GetTemplateData怎么用?C# NBrightBuyController.GetTemplateData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController的用法示例。


在下文中一共展示了NBrightBuyController.GetTemplateData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: XslInjectDataBind

 private void XslInjectDataBind(object sender, EventArgs e)
 {
     var lc = (Literal)sender;
     var container = (IDataItemContainer)lc.NamingContainer;
     lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
     if (lc.Visible && container.DataItem != null)
     {
         var param = lc.Text.Split('*');
         if (param.Count() == 2)
         {
             var argsList = new XsltArgumentList();
             var templName = param[0];
             foreach (var arg in param[1].Split(','))
             {
                 if (_settings != null && _settings.ContainsKey(arg)) argsList.AddParam(arg, "", _settings[arg]);
             }
             var buyCtrl = new NBrightBuyController();
             var xslTempl = buyCtrl.GetTemplateData(-1, templName, Utils.GetCurrentCulture(), _settings, StoreSettings.Current.DebugMode);
             var nbi = (NBrightInfo) container.DataItem;
             var strOut = XslUtils.XslTransInMemory(nbi.XMLData, xslTempl, argsList);
             lc.Text = strOut;
         }
     }
 }
开发者ID:Lewy-H,项目名称:NBrightBuy,代码行数:24,代码来源:GenXmlTemplateExt.cs

示例2: CartItemlistDataBind

        private void CartItemlistDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                var strOut = "";
                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
                if (lc.Visible)
                {

                    var id = Convert.ToString(DataBinder.Eval(container.DataItem, "ItemId"));
                    var lang = Convert.ToString(DataBinder.Eval(container.DataItem, "lang"));
                    if (lang == "") lang = Utils.GetCurrentCulture();
                    var groupresults = false;
                    if (lc.Text.EndsWith(":GROUPBY"))
                    {
                        groupresults = true;
                        lc.Text = lc.Text.Replace(":GROUPBY", "");
                    }
                    var templName = lc.Text;
                    if (Utils.IsNumeric(id) && (templName != ""))
                    {
                        var buyCtrl = new NBrightBuyController();
                        var rpTempl = buyCtrl.GetTemplateData(-1, templName, lang, _settings, StoreSettings.Current.DebugMode);

                        //remove templName from template, so we don't get a loop.
                        if (rpTempl.Contains(templName)) rpTempl = rpTempl.Replace(templName, "");
                        //build models list

                        var objInfo = (NBrightInfo)container.DataItem;
                        var cartData = new CartData(objInfo.PortalId);
                        // render repeater
                        try
                        {
                            var itemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpTempl, _settings, PortalSettings.Current.HomeDirectory, visibleStatus);
                            strOut = GenXmlFunctions.RenderRepeater(cartData.GetCartItemList(groupresults), itemTemplate);
                        }
                        catch (Exception exc)
                        {
                            strOut = "ERROR: NOTE: sub rendered templates CANNOT contain postback controls.<br/>" + exc;
                        }
                    }
                }
                lc.Text = strOut;

            }
            catch (Exception)
            {
                lc.Text = "";
            }
        }
开发者ID:Lewy-H,项目名称:NBrightBuy,代码行数:52,代码来源:GenXmlTemplateExt.cs

示例3: RelatedlistDataBind

        private void RelatedlistDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                var strOut = "";
                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
                if (lc.Visible)
                {

                    var id = Convert.ToString(DataBinder.Eval(container.DataItem, "ItemId"));
                    var templName = lc.Text;
                    if (Utils.IsNumeric(id) && (templName != ""))
                    {
                        var modCtrl = new NBrightBuyController();
                        var rpTempl = modCtrl.GetTemplateData(-1, templName, Utils.GetCurrentCulture(), _settings, StoreSettings.Current.DebugMode);

                        //remove templName from template, so we don't get a loop.
                        if (rpTempl.Contains('"' + templName + '"')) rpTempl = rpTempl.Replace(templName, "");
                        //build list
                        var objInfo = (NBrightInfo)container.DataItem;

                        List<NBrightInfo> objL = null;
                        var strCacheKey = Utils.GetCurrentCulture() + "RelatedList*" + objInfo.ItemID;
                        if (!StoreSettings.Current.DebugMode) objL = (List<NBrightInfo>)Utils.GetCache(strCacheKey);
                        if (objL == null)
                        {
                            var prodData = ProductUtils.GetProductData(objInfo.ItemID, Utils.GetCurrentCulture());
                            objL = prodData.GetRelatedProducts();
                            if (!StoreSettings.Current.DebugMode) NBrightBuyUtils.SetModCache(-1, strCacheKey, objL);
                        }
                        // render repeater
                        try
                        {
                            var itemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpTempl, _settings, PortalSettings.Current.HomeDirectory, visibleStatus);
                            strOut = GenXmlFunctions.RenderRepeater(objL, itemTemplate);
                        }
                        catch (Exception exc)
                        {
                            strOut = "ERROR: NOTE: sub rendered templates CANNOT contain postback controls.<br/>" + exc;
                        }
                    }
                }
                lc.Text = strOut;

            }
            catch (Exception)
            {
                lc.Text = "";
            }
        }
开发者ID:Lewy-H,项目名称:NBrightBuy,代码行数:52,代码来源:GenXmlTemplateExt.cs

示例4: ProductlistDataBind

        private void ProductlistDataBind(object sender, EventArgs e)
        {
            var lc = (Literal)sender;
            var container = (IDataItemContainer)lc.NamingContainer;
            try
            {
                var strOut = "";
                lc.Visible = visibleStatus.DefaultIfEmpty(true).First();
                if (lc.Visible)
                {

                    var param = lc.Text.Split(':');
                    if (param.Count() == 4)
                    {
                        try
                        {

                            var strFilter = "";
                            var templName = param[0];
                            var cascade = param[1];
                            var strOrder = param[2];
                            var filter = param[3];

                            if ((templName != ""))
                            {

                                var nbi = (GroupCategoryData)container.DataItem;
                                var lang = Utils.GetCurrentCulture();

                                var strCacheKey = lang + "*" + nbi.categoryid + "*" + lc.Text;
                                if (!StoreSettings.Current.DebugMode) strOut = (String)Utils.GetCache(strCacheKey);

                                if (String.IsNullOrEmpty(strOut))
                                {
                                    var buyCtrl = new NBrightBuyController();
                                    var rpTempl = buyCtrl.GetTemplateData(-1, templName, lang, _settings, StoreSettings.Current.DebugMode);

                                    //remove templName from template, so we don't get a loop.
                                    if (rpTempl.Contains(templName)) rpTempl = rpTempl.Replace(templName, "");
                                    //build models list

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

                                    if (strOrder == "{bycategoryproduct}") strOrder += nbi.categoryid.ToString(""); // do special custom sort in each cateogry

                                    if (filter != "") strFilter += " AND " + filter;

                                    var objL = buyCtrl.GetDataList(PortalSettings.Current.PortalId, -1, "PRD", "PRDLANG", Utils.GetCurrentCulture(), strFilter, strOrder);

                                    // inject the categoryid into the data, so the entryurl can have the correct catid
                                    foreach (var i in objL)
                                    {
                                        i.SetXmlProperty("genxml/categoryid", nbi.categoryid.ToString(""));
                                    }

                                    var itemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpTempl, _settings, PortalSettings.Current.HomeDirectory,visibleStatus);
                                    strOut = GenXmlFunctions.RenderRepeater(objL, itemTemplate);
                                    if (!StoreSettings.Current.DebugMode) NBrightBuyUtils.SetModCache(-1, strCacheKey, strOut);
                                }

                            }
                        }
                        catch (Exception exc)
                        {
                            strOut = "ERROR: <br/>" + exc;
                        }

                    }

                }
                lc.Text = strOut;

            }
            catch (Exception)
            {
                lc.Text = "";
            }
        }
开发者ID:Lewy-H,项目名称:NBrightBuy,代码行数:85,代码来源:GenXmlTemplateExt.cs

示例5: Createmodelslist

        private void Createmodelslist(Control container, XmlNode xmlNod)
        {
            if (xmlNod.Attributes != null && (xmlNod.Attributes["template"] != null))
            {
                var templName = xmlNod.Attributes["template"].Value;
                var buyCtrl = new NBrightBuyController();
                var rpTempl = buyCtrl.GetTemplateData(-1, templName, Utils.GetCurrentCulture(), _settings, StoreSettings.Current.DebugMode);

                //remove templName from template, so we don't get a loop.
                if (rpTempl.Contains(templName)) rpTempl = rpTempl.Replace(templName, "");
                var rpt = new Repeater { ItemTemplate = new GenXmlTemplate(rpTempl, _settings,visibleStatus) };
                rpt.Init += ModelslistInit; // databind causes infinate loop
                container.Controls.Add(rpt);
            }
        }
开发者ID:Lewy-H,项目名称:NBrightBuy,代码行数:15,代码来源:GenXmlTemplateExt.cs

示例6: SendEmail

        public static void SendEmail(String toEmail, String templateName, NBrightInfo dataObj, String emailsubjectresxkey, String fromEmail,String lang)
        {
            dataObj = ProcessEventProvider(EventActions.BeforeSendEmail, dataObj, templateName);

            if (!dataObj.GetXmlPropertyBool("genxml/stopprocess"))
            {

                if (lang == "") lang = Utils.GetCurrentCulture();
                var emaillist = toEmail;
                if (emaillist != "")
                {
                    var emailsubject = "";
                    if (emailsubjectresxkey != "")
                    {
                        var resxpath = StoreSettings.NBrightBuyPath() + "/App_LocalResources/Notification.ascx.resx";
                        emailsubject = DnnUtils.GetLocalizedString(emailsubjectresxkey, resxpath, lang);
                        if (emailsubject == null) emailsubject = emailsubjectresxkey;
                    }

                    // we can't use StoreSettings.Current.Settings(), becuase of external calls from providers to this function, so load in the settings directly
                    var modCtrl = new NBrightBuyController();
                    var storeSettings = modCtrl.GetStoreSettings(dataObj.PortalId);

                    var strTempl = modCtrl.GetTemplateData(-1, templateName, lang, storeSettings.Settings(), storeSettings.DebugMode);

                    var emailbody = GenXmlFunctions.RenderRepeater(dataObj, strTempl, "", "XMLData", lang, storeSettings.Settings());
                    if (templateName.EndsWith(".xsl")) emailbody = XslUtils.XslTransInMemory(dataObj.XMLData, emailbody);
                    if (fromEmail == "") fromEmail = storeSettings.AdminEmail;
                    var emailarray = emaillist.Split(',');
                    emailsubject = storeSettings.Get("storename") + " : " + emailsubject;
                    foreach (var email in emailarray)
                    {
                        if (!string.IsNullOrEmpty(email.Trim()) && Utils.IsEmail(fromEmail.Trim()) && Utils.IsEmail(email.Trim()))
                        {
                            // multiple attachments as csv with "|" seperator
                            DotNetNuke.Services.Mail.Mail.SendMail(fromEmail.Trim(), email.Trim(), "", emailsubject, emailbody, dataObj.GetXmlProperty("genxml/emailattachment"), "HTML", "", "", "", "");
                        }
                    }
                }
            }

            ProcessEventProvider(EventActions.AfterSendEmail, dataObj, templateName);
        }
开发者ID:fujinguyen,项目名称:NBrightBuy,代码行数:43,代码来源:NBrightBuyUtils.cs

示例7: IncludePageHeaders

        /// <summary>
        /// Include and template data into header, if specified in meta tag token (includeinheader).  
        /// </summary>
        /// <param name="modCtrl"></param>
        /// <param name="moduleId"></param>
        /// <param name="page"></param>
        /// <param name="template"></param>
        /// <param name="settings"></param>
        /// <param name="objInfo"></param>
        /// <param name="debugMode"></param>
        /// <returns></returns>
        public static string IncludePageHeaders(NBrightBuyController modCtrl, int moduleId, Page page, GenXmlTemplate template, Dictionary<String, String> settings, NBrightInfo objInfo = null, bool debugMode = false)
        {
            foreach (var mt in template.MetaTags)
            {
                var id = GenXmlFunctions.GetGenXmlValue(mt, "tag/@id");
                if (id == "includeinheader")
                {
                    var templ = GenXmlFunctions.GetGenXmlValue(mt, "tag/@value");
                    if (templ != "")
                    {

                        var includetext = modCtrl.GetTemplateData(moduleId, templ, Utils.GetCurrentCulture(), settings, debugMode);
                        if (objInfo == null) objInfo = new NBrightInfo(); //create a object so we process the tag values (resourcekey)
                        includetext = GenXmlFunctions.RenderRepeater(objInfo, includetext);
                        if (includetext != "")
                        {
                            if (!page.Items.Contains("nbrightbuyinject")) page.Items.Add("nbrightbuyinject", "");
                            if (templ != "" && !page.Items["nbrightbuyinject"].ToString().Contains(templ + ","))
                            {
                                PageIncludes.IncludeTextInHeader(page, includetext);
                                page.Items["nbrightbuyinject"] = page.Items["nbrightbuyinject"] + templ + ",";
                            }
                        }
                    }
                }
            }
            return "";
        }
开发者ID:fujinguyen,项目名称:NBrightBuy,代码行数:39,代码来源:NBrightBuyUtils.cs


注:本文中的Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController.GetTemplateData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。