本文整理汇总了C#中Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController.GetByGuidKey方法的典型用法代码示例。如果您正苦于以下问题:C# NBrightBuyController.GetByGuidKey方法的具体用法?C# NBrightBuyController.GetByGuidKey怎么用?C# NBrightBuyController.GetByGuidKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController
的用法示例。
在下文中一共展示了NBrightBuyController.GetByGuidKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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() + " : ";
}
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: AddCategory
public void AddCategory(int categoryid)
{
if (Info != null)
{
var strGuid = categoryid.ToString("") + "x" + Info.ItemID.ToString("");
var objCtrl = new NBrightBuyController();
var nbi = objCtrl.GetByGuidKey(_portalId, -1, "CATXREF", strGuid);
if (nbi == null)
{
nbi = new NBrightInfo();
nbi.ItemID = -1;
nbi.PortalId = _portalId;
nbi.ModuleId = -1;
nbi.TypeCode = "CATXREF";
nbi.XrefItemId = categoryid;
nbi.ParentItemId = Info.ItemID;
nbi.XMLData = null;
nbi.TextData = null;
nbi.Lang = null;
nbi.GUIDKey = strGuid;
var newitemid = objCtrl.Update(nbi);
nbi = objCtrl.Get(newitemid);
nbi.XMLData = "<genxml><sort>" + newitemid.ToString() + "</sort></genxml>";
objCtrl.Update(nbi);
//add all cascade xref
var objGrpCtrl = new GrpCatController(_lang, true);
var parentcats = objGrpCtrl.GetCategory(categoryid);
if (parentcats != null)
{
foreach (var p in parentcats.Parents)
{
strGuid = p.ToString("") + "x" + Info.ItemID.ToString("");
var obj = objCtrl.GetByGuidKey(_portalId, -1, "CATCASCADE", strGuid);
if (obj == null)
{
nbi = new NBrightInfo();
nbi.ItemID = -1;
nbi.PortalId = _portalId;
nbi.ModuleId = -1;
nbi.XrefItemId = p;
nbi.ParentItemId = Info.ItemID;
nbi.TypeCode = "CATCASCADE";
nbi.GUIDKey = strGuid;
newitemid = objCtrl.Update(nbi);
nbi = objCtrl.Get(newitemid);
nbi.XMLData = "<genxml><sort>" + newitemid.ToString() + "</sort></genxml>";
objCtrl.Update(nbi);
}
}
}
}
}
}
示例6: PopulateData
private void PopulateData(String key)
{
var modCtrl = new NBrightBuyController();
Info = modCtrl.GetByGuidKey(PortalSettings.Current.PortalId, -1, "PROMOCODES", key);
if (Info == null)
{
Info = new NBrightInfo(true);
Info.GUIDKey = key;
Info.TypeCode = "PROMOCODES";
Info.ModuleId = -1;
Info.PortalId = PortalSettings.Current.PortalId;
}
_discountcodesList = GetRuleList();
}
示例7: UpdatePercentUsage
public override NBrightInfo UpdatePercentUsage(int portalId, int userId, NBrightInfo purchaseInfo)
{
var discountcode = purchaseInfo.GetXmlProperty("genxml/extrainfo/genxml/textbox/promocode");
if (!purchaseInfo.GetXmlPropertyBool("genxml/discountprocessed"))
{
if (userId > 0)
{
if (discountcode == "") return purchaseInfo;
var clientData = new ClientData(portalId, userId);
if (clientData.DiscountCodes.Count > 0)
{
var list = clientData.DiscountCodes;
foreach (var d in list)
{
if (d.GetXmlProperty("genxml/textbox/coderef").ToLower() == discountcode.ToLower())
{
var usageleft = d.GetXmlPropertyDouble("genxml/textbox/usageleft");
var used = d.GetXmlPropertyDouble("genxml/textbox/used");
d.SetXmlPropertyDouble("genxml/textbox/usageleft", (usageleft - 1));
d.SetXmlPropertyDouble("genxml/textbox/used", (used + 1));
}
}
clientData.UpdateDiscountCodeList(list);
clientData.Save();
purchaseInfo.SetXmlProperty("genxml/discountprocessed", "True");
}
}
var objCtrl = new NBrightBuyController();
var dis = objCtrl.GetByGuidKey(portalId, -1, "DISCOUNTCODE", discountcode);
if (dis != null)
{
var usage = dis.GetXmlPropertyDouble("genxml/textbox/usage");
dis.SetXmlPropertyDouble("genxml/textbox/usage", (usage + 1));
objCtrl.Update(dis);
purchaseInfo.SetXmlProperty("genxml/discountprocessed", "True");
}
}
return purchaseInfo;
}
示例8: 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);
}
}
}
}
}
示例9: ModuleSettingsGetCatIdFromRef
public static int ModuleSettingsGetCatIdFromRef(NBrightInfo settingsInfo)
{
var ModCtrl = new NBrightBuyController();
// categoryid no longer exists, see if we can get it back with the catref (might be lost due to cleardown and import)
var catref = settingsInfo.GetXmlProperty("genxml/catref");
var nbi = ModCtrl.GetByGuidKey(settingsInfo.PortalId, -1, "CATEGORY", catref);
if (nbi != null) return nbi.ItemID;
return -1;
}
示例10: StoreSettings
public StoreSettings(int portalId)
{
DebugMode = false;
DebugModeFileOut = false;
_settingDic = new Dictionary<string, string>();
//Get NBrightBuy Portal Settings.
var modCtrl = new NBrightBuyController();
SettingsInfo = modCtrl.GetByGuidKey(portalId, -1, "SETTINGS", "NBrightBuySettings");
if (SettingsInfo != null)
{
AddToSettingDic(SettingsInfo, "genxml/hidden/*");
AddToSettingDic(SettingsInfo, "genxml/textbox/*");
AddToSettingDic(SettingsInfo, "genxml/checkbox/*");
AddToSettingDic(SettingsInfo, "genxml/dropdownlist/*");
AddToSettingDic(SettingsInfo, "genxml/radiobuttonlist/*");
AddToSettingDicSelectedTextAttr(SettingsInfo, "genxml/dropdownlist/*");
AddToSettingDicSelectedTextAttr(SettingsInfo, "genxml/radiobuttonlist/*");
}
//add DNN Portalsettings
if (!_settingDic.ContainsKey("portalid")) _settingDic.Add("portalid", portalId.ToString(""));
if (PortalSettings.Current == null)
{
var portalsettings = NBrightDNN.DnnUtils.GetPortalSettings(portalId);
if (!_settingDic.ContainsKey("portalname")) _settingDic.Add("portalname", portalsettings.PortalName);
if (!_settingDic.ContainsKey("homedirectory")) _settingDic.Add("homedirectory", portalsettings.HomeDirectory);
if (!_settingDic.ContainsKey("homedirectorymappath")) _settingDic.Add("homedirectorymappath", portalsettings.HomeDirectoryMapPath);
}
else
{
if (!_settingDic.ContainsKey("portalname")) _settingDic.Add("portalname", PortalSettings.Current.PortalName);
if (!_settingDic.ContainsKey("homedirectory")) _settingDic.Add("homedirectory", PortalSettings.Current.HomeDirectory);
if (!_settingDic.ContainsKey("homedirectorymappath")) _settingDic.Add("homedirectorymappath", PortalSettings.Current.HomeDirectoryMapPath);
}
if (!_settingDic.ContainsKey("culturecode")) _settingDic.Add("culturecode", Utils.GetCurrentCulture());
ThemeFolder = Get("themefolder");
if (_settingDic.ContainsKey("debug.mode") && _settingDic["debug.mode"] == "True") DebugMode = true; // set debug mmode
if (_settingDic.ContainsKey("debugfileout") && _settingDic["debugfileout"] == "True") DebugModeFileOut = true; // set debug mmode
StorageTypeClient = DataStorageType.Cookie;
if (Get("storagetypeclient") == "SessionMemory") StorageTypeClient = DataStorageType.SessionMemory;
AdminEmail = Get("adminemail");
ManagerEmail = Get("manageremail");
FolderDocumentsMapPath = Get("homedirectorymappath").TrimEnd('\\') + "\\" + Get("folderdocs");
FolderImagesMapPath = Get("homedirectorymappath").TrimEnd('\\') + "\\" + Get("folderimages");
FolderUploadsMapPath = Get("homedirectorymappath").TrimEnd('\\') + "\\" + Get("folderuploads");
FolderClientUploadsMapPath = Get("homedirectorymappath").TrimEnd('\\') + "\\" + Get("folderclientuploads");
FolderTempMapPath = Get("homedirectorymappath").TrimEnd('\\') + "\\NBSTemp";
FolderNBStoreMapPath = Get("homedirectorymappath").TrimEnd('\\') + "\\NBStore";
FolderDocuments = Get("homedirectory").TrimEnd('/') + "/" + Get("folderdocs").Replace("\\", "/");
FolderImages = Get("homedirectory").TrimEnd('/') + "/" + Get("folderimages").Replace("\\", "/");
FolderUploads = Get("homedirectory").TrimEnd('/') + "/" + Get("folderuploads").Replace("\\", "/");
FolderClientUploads = Get("homedirectory").TrimEnd('/') + "/" + Get("folderclientuploads").Replace("\\", "/");
FolderTemp = Get("homedirectory").TrimEnd('/') + "/NBSTemp";
FolderNBStore = Get("homedirectory").TrimEnd('/') + "/NBStore";
if (!_settingDic.ContainsKey("FolderDocumentsMapPath")) _settingDic.Add("FolderDocumentsMapPath",FolderDocumentsMapPath );
if (!_settingDic.ContainsKey("FolderImagesMapPath")) _settingDic.Add("FolderImagesMapPath",FolderImagesMapPath );
if (!_settingDic.ContainsKey("FolderUploadsMapPath")) _settingDic.Add("FolderUploadsMapPath",FolderUploadsMapPath );
if (!_settingDic.ContainsKey("FolderDocuments")) _settingDic.Add("FolderDocuments", FolderDocuments);
if (!_settingDic.ContainsKey("FolderImages")) _settingDic.Add("FolderImages",FolderImages );
if (!_settingDic.ContainsKey("FolderUploads")) _settingDic.Add("FolderUploads", FolderUploads);
if (!_settingDic.ContainsKey("NBrightBuyPath")) _settingDic.Add("NBrightBuyPath", NBrightBuyPath());
}
示例11: GetCurrentCategoryData
public GroupCategoryData GetCurrentCategoryData(int portalId, System.Web.HttpRequest request, int entryId = 0, Dictionary<string, string> settings = null, String targetModuleKey = "")
{
var defcatid = 0;
var qrycatid = Utils.RequestQueryStringParam(request, "catid");
if (qrycatid == "")
{
var qrycatref = Utils.RequestQueryStringParam(request, "catref");
if (qrycatref != "")
{
var catrefData = GetCategoryByRef(portalId, qrycatref);
if (catrefData != null) qrycatid = catrefData.categoryid.ToString("");
}
}
// always use the catid in url if we have no target module
if (Utils.IsNumeric(qrycatid) && targetModuleKey == "") return GetCategory(Convert.ToInt32(qrycatid));
if (targetModuleKey != "")
{
var navigationdata = new NavigationData(portalId, targetModuleKey);
if (Utils.IsNumeric(navigationdata.CategoryId) && navigationdata.FilterMode) defcatid = Convert.ToInt32(navigationdata.CategoryId);
// always use the catid in url if we have no navigation categoryid for the target module.
if (Utils.IsNumeric(qrycatid) && defcatid == 0) return GetCategory(Convert.ToInt32(qrycatid));
}
// if we have no catid in url, make sure we have any possible entryid
if (entryId == 0)
{
var qryitemid = Utils.RequestQueryStringParam(request, "eid");
if (Utils.IsNumeric(qryitemid))
{
entryId = Convert.ToInt32(qryitemid);
}
else
{
var qryguidkey = Utils.RequestQueryStringParam(request, "guidkey");
if (qryguidkey == "") qryguidkey = Utils.RequestQueryStringParam(request, "ref");
if (qryguidkey != "")
{
var objCtrl = new NBrightBuyController();
var guidData = objCtrl.GetByGuidKey(portalId, -1, "PRD", qryguidkey);
if (guidData != null) entryId = guidData.ItemID;
}
}
}
// use the first/default category the proiduct has
if (Utils.IsNumeric(entryId) && entryId > 0) return GetDefaultCategory(entryId);
// get any default set in the settings
if (defcatid == 0)
{
if (settings != null && settings["defaultcatid"] != null)
{
var setcatid = settings["defaultcatid"];
if (Utils.IsNumeric(setcatid)) defcatid = Convert.ToInt32(setcatid);
}
}
return GetCategory(defcatid);
}
示例12: GetEntryIdFromUrl
public static int GetEntryIdFromUrl(int portalId, System.Web.HttpRequest request)
{
var entryId = 0;
var qryitemid = Utils.RequestQueryStringParam(request, "eid");
if (Utils.IsNumeric(qryitemid))
{
entryId = Convert.ToInt32(qryitemid);
}
else
{
var qryguidkey = Utils.RequestQueryStringParam(request, "guidkey");
if (qryguidkey == "") qryguidkey = Utils.RequestQueryStringParam(request, "ref");
if (qryguidkey != "")
{
var objCtrl = new NBrightBuyController();
var guidData = objCtrl.GetByGuidKey(portalId, -1, "PRD", qryguidkey);
if (guidData != null) entryId = guidData.ItemID;
}
}
return entryId;
}
示例13: CalculateVoucherAmount
public override NBrightInfo CalculateVoucherAmount(int portalId, int userId, NBrightInfo cartInfo, string discountcode)
{
cartInfo.SetXmlPropertyDouble("genxml/discountstatus", "");
cartInfo.SetXmlPropertyDouble("genxml/voucherdiscount", "0"); // reset discount amount
Double discountcodeamt = 0;
if (userId > 0)
{
var clientData = new ClientData(portalId, userId);
if (clientData.DiscountCodes.Count > 0)
{
var subtotal = cartInfo.GetXmlPropertyDouble("genxml/subtotal");
// do client voucher discount on total cart
foreach (var d in clientData.VoucherCodes)
{
var validutil = d.GetXmlProperty("genxml/textbox/validuntil");
var validutildate = DateTime.Today;
if (Utils.IsDate(validutil)) validutildate = Convert.ToDateTime(validutil);
if (d.GetXmlProperty("genxml/textbox/coderef").ToLower() == discountcode.ToLower() && validutildate >= DateTime.Today)
{
var amount = d.GetXmlPropertyDouble("genxml/textbox/amount");
if (amount > 0)
{
if (subtotal >= amount)
discountcodeamt = amount;
else
discountcodeamt = subtotal;
cartInfo.SetXmlPropertyDouble("genxml/discountstatus", "valid");
}
else
{
cartInfo.SetXmlPropertyDouble("genxml/discountstatus", "invalid");
}
}
if (discountcodeamt > 0) break;
}
}
}
if (discountcodeamt == 0) // if no client level, calc any portal level percentage discount
{
var objCtrl = new NBrightBuyController();
var d = objCtrl.GetByGuidKey(portalId, -1, "DISCOUNTCODE", discountcode);
if (d != null)
{
var validutil = d.GetXmlProperty("genxml/textbox/validuntil");
var validutildate = DateTime.Today;
if (Utils.IsDate(validutil)) validutildate = Convert.ToDateTime(validutil);
if (validutildate >= DateTime.Today && d.GetXmlProperty("genxml/radiobuttonlist/amounttype") == "1")
{
var minamountlimit = d.GetXmlPropertyDouble("genxml/textbox/minamountlimit");
var amount = d.GetXmlPropertyDouble("genxml/textbox/amount");
var usage = d.GetXmlPropertyDouble("genxml/textbox/usage");
var usagelimit = d.GetXmlPropertyDouble("genxml/textbox/usagelimit");
var appliedsubtotal = cartInfo.GetXmlPropertyDouble("genxml/appliedsubtotal");
if (amount > 0 && (usagelimit == 0 || usagelimit > usage) && (appliedsubtotal >= minamountlimit))
{
discountcodeamt = amount;
cartInfo.SetXmlPropertyDouble("genxml/discountstatus", "valid");
}
else
{
cartInfo.SetXmlPropertyDouble("genxml/discountstatus", "invalid");
}
}
}
}
cartInfo.SetXmlPropertyDouble("genxml/voucherdiscount", discountcodeamt); // reset discount amount
return cartInfo;
}
示例14: AddProperty
public void AddProperty(String propertyref)
{
var objCtrl = new NBrightBuyController();
var pinfo = objCtrl.GetByGuidKey(_portalId, -1,"CATEGORY",propertyref);
if (pinfo == null)
{
// not using the unique ref, look for the friendly propertyref name.
var l = objCtrl.GetList(_portalId, -1, "CATEGORY", " and [XMLData].value('(genxml/textbox/propertyref)[1]','nvarchar(max)') = '" + propertyref + "' ", "", 1);
if (l.Any()) pinfo = l[0];
}
if (pinfo != null && Utils.IsNumeric(pinfo.ItemID) && pinfo.ItemID > 0) AddCategory(pinfo.ItemID);
}
示例15: ModuleSettingsResetCatIdFromRef
public static NBrightInfo ModuleSettingsResetCatIdFromRef(NBrightInfo objInfo)
{
var ModCtrl = new NBrightBuyController();
var catid = objInfo.GetXmlPropertyInt("genxml/dropdownlist/defaultcatid");
var nbi = ModCtrl.Get(catid);
if (nbi == null)
{
// categoryid no longer exists, see if we can get it back with the catref (might be lost due to cleardown and import)
var catref = objInfo.GetXmlProperty("genxml/catref");
nbi = ModCtrl.GetByGuidKey(objInfo.PortalId, -1, "CATEGORY", catref);
if (nbi != null)
{
objInfo.SetXmlProperty("genxml/dropdownlist/defaultcatid", nbi.ItemID.ToString(""));
}
}
return objInfo;
}