本文整理汇总了C#中Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController类的典型用法代码示例。如果您正苦于以下问题:C# NBrightBuyController类的具体用法?C# NBrightBuyController怎么用?C# NBrightBuyController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NBrightBuyController类属于Nevoweb.DNN.NBrightBuy.Components命名空间,在下文中一共展示了NBrightBuyController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnInit
protected override void OnInit(EventArgs e)
{
ModCtrl = new NBrightBuyController();
DebugMode = StoreSettings.Current.DebugMode;
base.OnInit(e);
#region "Get all Settings for module"
//get Model Level Settings
ModSettings = new ModSettings(ModuleId, Settings);
ModuleKey = ModSettings.Get("modulekey");
#endregion
if (EnablePaging)
{
CtrlPaging = new NBrightCore.controls.PagingCtrl();
this.Controls.Add(CtrlPaging);
CtrlPaging.PageChanged += new RepeaterCommandEventHandler(PagingClick);
}
//add template provider to NBright Templating
NBrightCore.providers.GenXProviderManager.AddProvider("NBrightBuy,Nevoweb.DNN.NBrightBuy.render.GenXmlTemplateExt");
// search for any other NBright Tenmplating providers that might have been added.
var pluginData = new PluginData(PortalSettings.Current.PortalId);
var l = pluginData.GetTemplateExtProviders();
foreach (var p in l)
{
var prov = p.Value;
NBrightCore.providers.GenXProviderManager.AddProvider(prov.GetXmlProperty("genxml/textbox/assembly") + "," + prov.GetXmlProperty("genxml/textbox/namespaceclass"));
}
}
示例2: ValidateLangaugeRef
public static Boolean ValidateLangaugeRef(int portalId, int categoryId)
{
var updaterequired = false;
foreach (var lang in DnnUtils.GetCultureCodeList(portalId))
{
var objCtrl = new NBrightBuyController();
var parentCatData = GetCategoryData(categoryId, lang);
var grpCatCtrl = new GrpCatController(lang);
var newGuidKey = grpCatCtrl.GetBreadCrumb(categoryId, 0, "-", false);
if (newGuidKey != "") newGuidKey = GetUniqueGuidKey(portalId, categoryId, Utils.UrlFriendly(newGuidKey)).ToLower();
if (parentCatData.DataLangRecord.GUIDKey != newGuidKey)
{
parentCatData.DataLangRecord.SetXmlProperty("genxml/textbox/txtcategoryref", newGuidKey);
parentCatData.DataLangRecord.GUIDKey = newGuidKey;
objCtrl.Update(parentCatData.DataLangRecord);
updaterequired = true;
// need to update all children, so call validate recursive.
foreach (var ch in parentCatData.GetDirectChildren())
{
if (ch.ItemID != categoryId) ValidateLangaugeRef(portalId, ch.ItemID);
}
}
}
return updaterequired;
}
示例3: DeleteUserData
public void DeleteUserData()
{
//remove DB record
var modCtrl = new NBrightBuyController();
modCtrl.Delete(Info.ItemID);
Exists = false;
}
示例4: CatMenuBuilder
public CatMenuBuilder(String templateBody, ModSettings modSettings, int currentCatId, Boolean debugMode)
{
_catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());
_ctrlObj = new NBrightBuyController();
_modSettings = modSettings;
_debugMode = debugMode;
_templateBody = GetMenuTemplates(templateBody);
_currentCatId = currentCatId;
}
示例5: CalcGroupPromo
public static string CalcGroupPromo(int portalId)
{
var objCtrl = new NBrightBuyController();
var l = objCtrl.GetList(portalId, -1, "CATEGORYPROMO", "", "", 0, 0, 0, 0, Utils.GetCurrentCulture());
foreach (var p in l)
{
CalcGroupPromoItem(p);
}
return "OK";
}
示例6: DoWork
/// <summary>
///
/// </summary>
/// <param name="portalfinfo"></param>
/// <returns></returns>
public override string DoWork()
{
try
{
var objCtrl = new NBrightBuyController();
// the sceduler runs at host level, we therefore need to loop through ALL portals to process data at a portal level.
var portalList = NBrightDNN.DnnUtils.GetAllPortals();
foreach (var portal in portalList)
{
// check if we have NBS in this portal by looking for default settings.
var nbssetting = objCtrl.GetByGuidKey(portal.PortalID, -1, "SETTINGS", "NBrightBuySettings");
if (nbssetting != null)
{
var storeSettings = new StoreSettings(portal.PortalID);
var pluginData = new PluginData(portal.PortalID); // get plugin data to see if this scheduler is active on this portal
var plugin = pluginData.GetPluginByCtrl("dnnsearchindex");
if (plugin != null && plugin.GetXmlPropertyBool("genxml/checkbox/active"))
{
// The NBS scheduler is normally set to run hourly, therefore if we only want a process to run daily we need the logic this function.
// To to this we keep a last run flag on the sceduler settings
var setting = objCtrl.GetByGuidKey(portal.PortalID, -1, "DNNIDXSCHEDULER", "DNNIDXSCHEDULER");
if (setting == null)
{
setting = new NBrightInfo(true);
setting.ItemID = -1;
setting.PortalId = portal.PortalID;
setting.TypeCode = "DNNIDXSCHEDULER";
setting.GUIDKey = "DNNIDXSCHEDULER";
setting.ModuleId = -1;
setting.XMLData = "<genxml></genxml>";
}
var lastrun = setting.GetXmlPropertyRaw("genxml/lastrun");
var lastrundate = DateTime.Now.AddYears(-99);
if (Utils.IsDate(lastrun)) lastrundate = Convert.ToDateTime(lastrun);
var rtnmsg = DoProductIdx(portal, lastrundate, storeSettings.DebugMode);
setting.SetXmlProperty("genxml/lastrun", DateTime.Now.ToString("s"), TypeCode.DateTime);
objCtrl.Update(setting);
if (rtnmsg != "") return rtnmsg;
}
}
}
return " - NBS-DNNIDX scheduler OK ";
}
catch (Exception ex)
{
return " - NBS-DNNIDX scheduler FAIL: " + ex.ToString() + " : ";
}
}
示例7: GetCatIdFromName
public static String GetCatIdFromName(String catname)
{
var catid = "";
if (catname != "")
{
var objCtrl = new NBrightBuyController();
var objCat = objCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "CATEGORYLANG", catname);
if (objCat == null)
{
// check it's not just a single language
objCat = objCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "CATEGORY", catname);
if (objCat != null) catid = objCat.ItemID.ToString("");
}
else
{
catid = objCat.ParentItemId.ToString("");
}
}
return catid;
}
示例8: GetUniqueGuidKey
public static string GetUniqueGuidKey(int portalId, int categoryId, string newGUIDKey)
{
// make sure we have a unique guidkey
var objCtrl = new NBrightBuyController();
var doloop = true;
var lp = 1;
var testGUIDKey = newGUIDKey.ToLower();
while (doloop)
{
var obj = objCtrl.GetByGuidKey(portalId, -1, "CATEGORY", testGUIDKey);
if (obj != null && obj.ItemID != categoryId)
{
testGUIDKey = newGUIDKey + lp;
}
else
doloop = false;
lp += 1;
if (lp > 999) doloop = false; // make sure we never get a infinate loop
}
return testGUIDKey;
}
示例9: GetProviderSettings
public static NBrightInfo GetProviderSettings(String ctrlkey)
{
var info = (NBrightInfo)Utils.GetCache("NBrightPayPalPaymentProvider" + PortalSettings.Current.PortalId.ToString(""));
if (info == null)
{
var modCtrl = new NBrightBuyController();
info = modCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "NBrightPayPalPAYMENT", ctrlkey);
if (info == null)
{
info = new NBrightInfo(true);
info.GUIDKey = ctrlkey;
info.TypeCode = "NBrightPayPalPAYMENT";
info.ModuleId = -1;
info.PortalId = PortalSettings.Current.PortalId;
}
Utils.SetCache("NBrightPayPalPaymentProvider" + PortalSettings.Current.PortalId.ToString(""), info);
}
return info;
}
示例10: CopyAllCatXref
private String CopyAllCatXref(HttpContext context,Boolean moverecords = false)
{
var strOut = NBrightBuyUtils.GetResxMessage("general_fail");
try
{
var settings = GetAjaxFields(context);
var strFilter = " and XrefItemId = {Settings:itemid} ";
strFilter = Utils.ReplaceSettingTokens(strFilter, settings);
var newcatid = "";
if (settings.ContainsKey("selectedcatid")) newcatid = settings["selectedcatid"];
if (Utils.IsNumeric(newcatid) && settings.ContainsKey("itemid"))
{
var objCtrl = new NBrightBuyController();
var objList = objCtrl.GetList(PortalSettings.Current.PortalId, -1, "CATXREF", strFilter);
foreach (var obj in objList)
{
var strGuid = newcatid + "x" + obj.ParentItemId.ToString("");
var nbi = objCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "CATXREF", strGuid);
if (nbi == null)
{
if (!moverecords) obj.ItemID = -1;
obj.XrefItemId = Convert.ToInt32(newcatid);
obj.GUIDKey = strGuid;
obj.XMLData = null;
obj.TextData = null;
obj.Lang = null;
objCtrl.Update(obj);
//add all cascade xref
var objGrpCtrl = new GrpCatController(_lang, true);
var parentcats = objGrpCtrl.GetCategory(Convert.ToInt32(newcatid));
foreach (var p in parentcats.Parents)
{
strGuid = p.ToString("") + "x" + obj.ParentItemId.ToString("");
nbi = objCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "CATCASCADE", strGuid);
if (nbi == null)
{
obj.XrefItemId = p;
obj.TypeCode = "CATCASCADE";
obj.GUIDKey = strGuid;
objCtrl.Update(obj);
}
}
}
}
if (moverecords) DeleteAllCatXref(context);
strOut = NBrightBuyUtils.GetResxMessage();
}
}
catch (Exception ex)
{
return ex.ToString();
}
return strOut;
}
示例11: AddNewImage
private void AddNewImage(int itemId,String imageurl, String imagepath)
{
var objCtrl = new NBrightBuyController();
var dataRecord = objCtrl.Get(itemId);
if (dataRecord != null)
{
var strXml = "<genxml><imgs><genxml><hidden><imagepath>" + imagepath + "</imagepath><imageurl>" + imageurl + "</imageurl></hidden></genxml></imgs></genxml>";
if (dataRecord.XMLDoc.SelectSingleNode("genxml/imgs") == null)
{
dataRecord.AddXmlNode(strXml, "genxml/imgs", "genxml");
}
else
{
dataRecord.AddXmlNode(strXml, "genxml/imgs/genxml", "genxml/imgs");
}
objCtrl.Update(dataRecord);
}
}
示例12: GetReturnData
private string GetReturnData(HttpContext context)
{
try
{
var strOut = "";
var strIn = HttpUtility.UrlDecode(Utils.RequestParam(context, "inputxml"));
var xmlData = GenXmlFunctions.GetGenXmlByAjax(strIn, "");
var objInfo = new NBrightInfo();
objInfo.ItemID = -1;
objInfo.TypeCode = "AJAXDATA";
objInfo.XMLData = xmlData;
var settings = objInfo.ToDictionary();
var themeFolder = StoreSettings.Current.ThemeFolder;
if (settings.ContainsKey("themefolder")) themeFolder = settings["themefolder"];
var templCtrl = NBrightBuyUtils.GetTemplateGetter(themeFolder);
if (!settings.ContainsKey("portalid")) settings.Add("portalid", PortalSettings.Current.PortalId.ToString("")); // aways make sure we have portalid in settings
var objCtrl = new NBrightBuyController();
// run SQL and template to return html
if (settings.ContainsKey("sqltpl") && settings.ContainsKey("xsltpl"))
{
var strSql = templCtrl.GetTemplateData(settings["sqltpl"], _lang, true, true, true, StoreSettings.Current.Settings());
var xslTemp = templCtrl.GetTemplateData(settings["xsltpl"], _lang, true, true, true, StoreSettings.Current.Settings());
// replace any settings tokens (This is used to place the form data into the SQL)
strSql = Utils.ReplaceSettingTokens(strSql, settings);
strSql = Utils.ReplaceUrlTokens(strSql);
strSql = GenXmlFunctions.StripSqlCommands(strSql); // don't allow anything to update through here.
strOut = objCtrl.GetSqlxml(strSql);
if (!strOut.StartsWith("<root>")) strOut = "<root>" + strOut + "</root>"; // always wrap with root node.
strOut = XslUtils.XslTransInMemory(strOut, xslTemp);
}
return strOut;
}
catch (Exception ex)
{
return ex.ToString();
}
}
示例13: PopulateData
private void PopulateData(String shippingkey)
{
var modCtrl = new NBrightBuyController();
Info = modCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "SHIPPING", shippingkey);
if (Info == null)
{
Info = new NBrightInfo(true);
Info.GUIDKey = shippingkey;
Info.TypeCode = "SHIPPING";
Info.ModuleId = -1;
Info.PortalId = PortalSettings.Current.PortalId;
}
_shippingList = GetRuleList();
// build range Data
_rangeData = new List<RangeItem>();
foreach (var i in _shippingList)
{
var rangeList = i.GetXmlProperty("genxml/textbox/shiprange");
var rl = rangeList.Split(new string[] {"\n", "\r\n"}, StringSplitOptions.RemoveEmptyEntries);
foreach (var s in rl)
{
var ri = s.Split('=');
if (ri.Count() == 2 && Utils.IsNumeric(ri[1]))
{
var riV = ri[0].Split('-');
if (riV.Count() == 2 && Utils.IsNumeric(riV[0]) && Utils.IsNumeric(riV[1]))
{
var rItem = new RangeItem();
rItem.RefCsv = "," + i.GetXmlProperty("genxml/textbox/shipref") + ",";
rItem.RangeLow = Convert.ToDouble(riV[0],CultureInfo.GetCultureInfo("en-US"));
rItem.Cost = Convert.ToDouble(ri[1], CultureInfo.GetCultureInfo("en-US"));
rItem.RangeHigh = Convert.ToDouble(riV[1],CultureInfo.GetCultureInfo("en-US"));
_rangeData.Add(rItem);
}
}
}
}
}
示例14: DoImport
private void DoImport(NBrightInfo nbi)
{
var fname = StoreSettings.Current.FolderTempMapPath + "\\" + nbi.GetXmlProperty("genxml/hidden/hiddatafile");
if (System.IO.File.Exists(fname))
{
var xmlFile = new XmlDocument();
try
{
xmlFile.Load(fname);
}
catch (Exception e)
{
Exceptions.LogException(e);
NBrightBuyUtils.SetNotfiyMessage(ModuleId, "xmlloadfail", NotifyCode.fail, ControlPath + "/App_LocalResources/Import.ascx.resx");
return;
}
// Ref old cat id , id new cat
////////////////////////////////////////////////////////////////////////////
Dictionary<string, int> categoryListIDGiud = new Dictionary<string, int>();
Dictionary<int, int> categoryListIDFather = new Dictionary<int, int>();
///////////////////////////////////////////////////////////////////////////
var objCtrl = new NBrightBuyController();
// get all valid languages
var langList = DnnUtils.GetCultureCodeList(PortalId);
foreach (var lang in langList)
{
//Import Categories
#region "categories"
var nodList = xmlFile.SelectNodes("root/categories/" + lang + "/NB_Store_CategoriesInfo");
if (nodList != null)
{
var categoryid = -1;
foreach (XmlNode nod in nodList)
{
try
{
//if category Id exist replage guidKey
var guidKeyNod = nod.SelectSingleNode("CategoryID").InnerText;
if (guidKeyNod != null)
{
var guidKey = guidKeyNod;
categoryid = -1;
// see if category already exists (update if so)
var nbiImport = objCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "CATEGORY", guidKey);
if (nbiImport != null) categoryid = nbiImport.ItemID;
var CategoryData = new CategoryData(categoryid, lang);
// clear down existing XML data
var i = new NBrightInfo(true);
i.PortalId = PortalSettings.Current.PortalId;
CategoryData.DataRecord.XMLData = i.XMLData;
CategoryData.DataLangRecord.XMLData = i.XMLData;
// assign guidkey to legacy productid (guidKey)
CategoryData.DataRecord.GUIDKey = guidKey;
CategoryData.DataRecord.SetXmlProperty("genxml/textbox/txtcategoryref", guidKey);
// do mapping of XML data
// DATA FIELDS
var cD_CategoryID = nod.SelectSingleNode("CategoryID").InnerText;
var cD_PortalID = nod.SelectSingleNode("PortalID").InnerText;
var cD_Archived = nod.SelectSingleNode("Archived").InnerText;
var cD_Hide = nod.SelectSingleNode("Hide").InnerText;
var cD_CreatedByUser = nod.SelectSingleNode("CreatedByUser").InnerText;
var cD_CreatedDate = nod.SelectSingleNode("CreatedDate").InnerText;
var cD_ParentCategoryID = nod.SelectSingleNode("ParentCategoryID").InnerText;
var cD_ListOrder = nod.SelectSingleNode("ListOrder").InnerText;
var cD_Lang = nod.SelectSingleNode("Lang").InnerText;
var cD_ProductCount = nod.SelectSingleNode("ProductCount").InnerText;
var cD_ProductTemplate = nod.SelectSingleNode("ProductTemplate").InnerText;
var cD_ListItemTemplate = nod.SelectSingleNode("ListItemTemplate").InnerText;
var cD_ListAltItemTemplate = nod.SelectSingleNode("ListAltItemTemplate").InnerText;
var cD_ImageURL = nod.SelectSingleNode("ImageURL").InnerText;
// DATA LANG FIELDS
var cL_CategoryName = nod.SelectSingleNode("CategoryName").InnerText;
var cL_ParentName = nod.SelectSingleNode("ParentName").InnerText;
var cL_CategoryDesc = nod.SelectSingleNode("CategoryDesc").InnerText;
var cL_Message = nod.SelectSingleNode("Message").InnerText;
var cL_SEOPageTitle = nod.SelectSingleNode("SEOPageTitle").InnerText;
var cL_SEOName = nod.SelectSingleNode("SEOName").InnerText;
var cL_MetaDescription = nod.SelectSingleNode("MetaDescription").InnerText;
var cL_MetaKeywords = nod.SelectSingleNode("MetaKeywords").InnerText;
// Populate DATA CATEGORY
CategoryData.DataRecord.SetXmlProperty("genxml/hidden/recordsortorder", cD_ListOrder);
CategoryData.DataRecord.SetXmlProperty("genxml/checkbox/chkishidden", cD_Hide);
CategoryData.DataRecord.SetXmlProperty("genxml/checkbox/chkdisable", "False");
CategoryData.DataRecord.SetXmlProperty("genxml/dropdownlist/ddlgrouptype", "cat");
if (cD_ParentCategoryID != null && cD_ParentCategoryID != "0") CategoryData.DataRecord.SetXmlProperty("genxml/dropdownlist/ddlparentcatid", cD_ParentCategoryID);
//.........这里部分代码省略.........
示例15: 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);
}
}