本文整理汇总了C#中NBrightInfo类的典型用法代码示例。如果您正苦于以下问题:C# NBrightInfo类的具体用法?C# NBrightInfo怎么用?C# NBrightInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NBrightInfo类属于命名空间,在下文中一共展示了NBrightInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateItemPercentDiscount
public override NBrightInfo CalculateItemPercentDiscount(int portalId, int userId, NBrightInfo cartItemInfo,String discountcode)
{
if (userId <= 0) return cartItemInfo;
cartItemInfo.SetXmlPropertyDouble("genxml/discountcodeamt", "0"); // reset discount amount
if (discountcode == "") return cartItemInfo;
var clientData = new ClientData(portalId,userId);
if (clientData.DiscountCodes.Count == 0) return cartItemInfo;
Double discountcodeamt = 0;
foreach (var d in clientData.DiscountCodes)
{
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 usageleft = d.GetXmlPropertyDouble("genxml/textbox/usageleft");
var percentage = d.GetXmlPropertyDouble("genxml/textbox/percentage");
if (percentage > 0 && usageleft > 0)
{
var appliedtotalcost = cartItemInfo.GetXmlPropertyDouble("genxml/appliedtotalcost");
discountcodeamt = ((appliedtotalcost/100)*percentage);
}
}
if (discountcodeamt > 0) break;
}
cartItemInfo.SetXmlPropertyDouble("genxml/discountcodeamt", discountcodeamt);
return cartItemInfo;
}
示例2: UpdatePercentUsage
public override NBrightInfo UpdatePercentUsage(int portalId, int userId, NBrightInfo purchaseInfo)
{
if (userId <= 0) return purchaseInfo;
var discountcode = purchaseInfo.GetXmlProperty("genxml/extrainfo/genxml/textbox/promocode");
if (!purchaseInfo.GetXmlPropertyBool("genxml/discountprocessed"))
{
if (discountcode == "") return purchaseInfo;
var clientData = new ClientData(portalId, userId);
if (clientData.DiscountCodes.Count == 0) return purchaseInfo;
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");
}
return purchaseInfo;
}
示例3: AddNewRule
public String AddNewRule()
{
var ruleInfo = new NBrightInfo(true);
ruleInfo.ItemID = -1;
ruleInfo.SetXmlProperty("genxml/hidden/index","-1");
return UpdateRule(ruleInfo);
}
示例4: IsValid
public override bool IsValid(NBrightInfo cartInfo)
{
// check if this provider is valid for the counrty in the checkout
var shipoption = cartInfo.GetXmlProperty("genxml/extrainfo/genxml/radiobuttonlist/rblshippingoptions");
var countrycode = "";
switch (shipoption)
{
case "1":
countrycode = cartInfo.GetXmlProperty("genxml/billaddress/genxml/dropdownlist/country");
break;
case "2":
countrycode = cartInfo.GetXmlProperty("genxml/shipaddress/genxml/dropdownlist/country");
break;
}
var isValid = true;
var shipData = new ShippingData(Shippingkey);
var validlist = "," + shipData.Info.GetXmlProperty("genxml/textbox/validcountrycodes") + ",";
var notvalidlist = "," + shipData.Info.GetXmlProperty("genxml/textbox/notvalidcountrycodes") + ",";
if (validlist.Trim(',') != "")
{
isValid = false;
if (validlist.Contains("," + countrycode + ",")) isValid = true;
}
if (notvalidlist.Trim(',') != "" && notvalidlist.Contains("," + countrycode + ",")) isValid = false;
return isValid;
}
示例5: GetTemplate
public override string GetTemplate(NBrightInfo cartInfo)
{
var info = ProviderUtils.GetProviderSettings("NBrightPayPalpayment");
var templ = ProviderUtils.GetTemplateData(info.GetXmlProperty("genxml/textbox/checkouttemplate"));
return templ;
}
示例6: DoDetail
/// <summary>
/// Display template with moduleid set
/// </summary>
/// <param name="rp1"></param>
/// <param name="moduleId"></param>
public void DoDetail(Repeater rp1,int moduleId)
{
var obj = new NBrightInfo(true);
obj.ModuleId = moduleId;
var l = new List<object> { obj };
rp1.DataSource = l;
rp1.DataBind();
}
示例7: 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() + " : ";
}
}
示例8: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
// inject any pageheader we need
var nbi = new NBrightInfo();
nbi.Lang = Utils.GetCurrentCulture();
nbi.PortalId = PortalId;
var pageheaderTempl = NBrightBuyUtils.RazorTemplRender("Admin_Orders_head.cshtml", 0, "", nbi, "/DesktopModules/NBright/NBrightBuy", "config", Utils.GetCurrentCulture(), StoreSettings.Current.Settings());
PageIncludes.IncludeTextInHeader(Page, pageheaderTempl);
}
示例9: DoXslTransOnTemplate
public static string DoXslTransOnTemplate(string strTemplateText, NBrightInfo objInfo)
{
if (strTemplateText.ToLower().Contains("<xsl:stylesheet"))
{
var xmlOut = "<root>";
var l = new List<NBrightInfo> {objInfo};
xmlOut += NBrightBuyUtils.FormatListtoXml(l);
xmlOut += "</root>";
return XslUtils.XslTransInMemory(xmlOut, strTemplateText);
}
return strTemplateText;
}
示例10: UpdateItemPercentDiscountCode
public static NBrightInfo UpdateItemPercentDiscountCode(int portalId, int userId, NBrightInfo cartItemInfo, String discountcode)
{
cartItemInfo.SetXmlPropertyDouble("genxml/discountcodeamt", "0");
foreach (var prov in ProviderList)
{
var newItemInfo = prov.Value.CalculateItemPercentDiscount(portalId, userId, cartItemInfo, discountcode);
if (cartItemInfo.GetXmlPropertyDouble("genxml/discountcodeamt") < newItemInfo.GetXmlPropertyDouble("genxml/discountcodeamt"))
{
cartItemInfo.SetXmlPropertyDouble("genxml/discountcodeamt", newItemInfo.GetXmlPropertyDouble("genxml/discountcodeamt"));
}
}
return cartItemInfo;
}
示例11: AddAddress
/// <summary>
/// Add Adddress
/// </summary>
/// <param name="rpData"></param>
/// <param name="debugMode"></param>
public String AddAddress(Repeater rpData, Boolean debugMode = false)
{
var strXml = GenXmlFunctions.GetGenXml(rpData, "", "");
// load into NBrigthInfo class, so it's easier to get at xml values.
var objInfoIn = new NBrightInfo();
objInfoIn.XMLData = strXml;
var addIndex = objInfoIn.GetXmlProperty("genxml/hidden/index"); // addresses updated from manager should have a index hidden field.
if (addIndex == "") addIndex = objInfoIn.GetXmlProperty("genxml/dropdownlist/selectaddress"); // updated from cart should have a selected address
if (!Utils.IsNumeric(addIndex)) addIndex = "-1"; // assume new address.
var addressIndex = Convert.ToInt32(addIndex);
AddAddress(objInfoIn,addressIndex);
return ""; // if everything is OK, don't send a message back.
}
示例12: GetProfile
public NBrightInfo GetProfile()
{
var pInfo = new NBrightInfo(true);
if (_uData.Exists)
{
var xmlNode = _uData.Info.XMLDoc.SelectSingleNode("genxml/profile/genxml");
if (xmlNode != null)
{
pInfo.PortalId = _uData.Info.PortalId;
pInfo.Lang = _uData.Info.Lang;
pInfo.XMLData = xmlNode.OuterXml;
}
}
return pInfo;
}
示例13: GetRuleList
/// <summary>
/// Get Current Cart Item List
/// </summary>
/// <returns></returns>
public List<NBrightInfo> GetRuleList()
{
var rtnList = new List<NBrightInfo>();
var xmlNodeList = Info.XMLDoc.SelectNodes("genxml/list/*");
if (xmlNodeList != null)
{
foreach (XmlNode carNod in xmlNodeList)
{
var newInfo = new NBrightInfo {XMLData = carNod.OuterXml};
newInfo.ItemID = rtnList.Count;
newInfo.SetXmlProperty("genxml/hidden/index", rtnList.Count.ToString(""));
rtnList.Add(newInfo);
}
}
return rtnList;
}
示例14: PluginData
public PluginData(int portalId, Boolean systemlevel = false)
{
_templCtrl = NBrightBuyUtils.GetTemplateGetter(portalId,"config");
portallevel = !systemlevel;
if (StoreSettings.Current == null)
{
storeSettings = new StoreSettings(portalId);
}
else
{
storeSettings = StoreSettings.Current;
}
var menuplugin = _templCtrl.GetTemplateData("menuplugin.xml", Utils.GetCurrentCulture(), true, true, portallevel, storeSettings.Settings());
if (menuplugin != "")
{
Info = new NBrightInfo();
Info.XMLData = menuplugin;
_pluginList = new List<NBrightInfo>();
_pluginList = GetPluginList();
}
else
{
// no menuplugin.xml exists, so must be new install, get new config
var pluginfoldermappath = System.Web.Hosting.HostingEnvironment.MapPath(StoreSettings.NBrightBuyPath() + "/Plugins");
if (pluginfoldermappath != null && Directory.Exists(pluginfoldermappath))
{
var xmlDoc = new XmlDocument();
xmlDoc.Load(pluginfoldermappath + "\\menu.config");
pluginfoldermappath = System.Web.Hosting.HostingEnvironment.MapPath(StoreSettings.NBrightBuyPath() + "/Themes/config/default");
xmlDoc.Save(pluginfoldermappath + "\\menuplugin.xml");
//load new config
menuplugin = _templCtrl.GetTemplateData("menuplugin.xml", Utils.GetCurrentCulture(), true, true, portallevel, storeSettings.Settings());
if (menuplugin != "")
{
Info = new NBrightInfo();
Info.XMLData = menuplugin;
_pluginList = new List<NBrightInfo>();
_pluginList = GetPluginList();
}
}
}
}
示例15: AddEntity
public static NBrightInfo AddEntity(NBrightInfo objInfo, String entityName, int numberToAdd = 1, String genxmlData = "<genxml></genxml>")
{
var xNod = objInfo.XMLDoc.SelectSingleNode("genxml/" + entityName.ToLower());
if (xNod != null)
{
var strModelXml = "";
for (int i = 0; i < numberToAdd; i++)
{
strModelXml += genxmlData;
}
// Create a document fragment to contain the XML to be inserted.
var docFrag = objInfo.XMLDoc.CreateDocumentFragment();
// Set the contents of the document fragment.
docFrag.InnerXml = strModelXml;
//Add new model data
xNod.AppendChild(docFrag);
objInfo.XMLData = objInfo.XMLDoc.OuterXml;
}
return objInfo;
}