本文整理汇总了C#中Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController.Get方法的典型用法代码示例。如果您正苦于以下问题:C# NBrightBuyController.Get方法的具体用法?C# NBrightBuyController.Get怎么用?C# NBrightBuyController.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nevoweb.DNN.NBrightBuy.Components.NBrightBuyController
的用法示例。
在下文中一共展示了NBrightBuyController.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
private void LoadData(int groupId)
{
Exists = false;
if (groupId == -1) AddNew(); // add new record if -1 is used as id.
var objCtrl = new NBrightBuyController();
Info = objCtrl.Get(groupId, "GROUPLANG", _lang);
if (Info != null)
{
Exists = true;
DataRecord = objCtrl.GetData(groupId);
DataLangRecord = objCtrl.GetDataLang(groupId, _lang);
}
}
示例2: 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);
}
}
}
}
}
}
示例3: Save
public void Save()
{
foreach (var model in Models)
{
var qty = DataRecord.GetXmlPropertyDouble("genxml/models/genxml[" + model.ItemID.ToString("") + "]/textbox/txtqtyremaining");
var minqty = DataRecord.GetXmlPropertyDouble("genxml/models/genxml[" + model.ItemID.ToString("") + "]/textbox/txtqtyminstock");
var currentstatus = DataRecord.GetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/dropdownlist/modelstatus");
var activatestock = DataRecord.GetXmlPropertyBool("genxml/models/genxml[" + model.ItemID.ToString("") + "]/checkbox/chkstockon");
if (activatestock && currentstatus != "040" && currentstatus != "050")
{
if (qty > 0) DataRecord.SetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/dropdownlist/modelstatus", "010");
if (minqty == qty) DataRecord.SetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/dropdownlist/modelstatus", "020");
if (qty <= 0 && minqty < qty) DataRecord.SetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/dropdownlist/modelstatus", "030");
}
else
{
// stock not activate so set status to available
DataRecord.SetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/dropdownlist/modelstatus", "010");
}
if (DataRecord.GetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/hidden/modelid") == "") DataRecord.SetXmlProperty("genxml/models/genxml[" + model.ItemID.ToString("") + "]/hidden/modelid", Utils.GetUniqueKey());
}
// calcs what the import and guidkey should be.
SetGuidKey();
DataRecord.ModuleId = -1; // moduleid of product always set to -1 (Portal Wide)
DataLangRecord.ModuleId = -1; // moduleid of product always set to -1 (Portal Wide)
var objCtrl = new NBrightBuyController();
var productid = objCtrl.Update(DataRecord);
DataLangRecord.ParentItemId = productid;
var plangid = objCtrl.Update(DataLangRecord);
// reload data so it's upto date with new ids
DataRecord = objCtrl.Get(productid);
DataLangRecord = objCtrl.Get(plangid);
NBrightBuyUtils.ProcessEventProvider(EventActions.AfterProductSave, DataRecord);
}
示例4: 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;
}
示例5: LoadData
private void LoadData(int productId, Boolean hydrateLists = true)
{
Exists = false;
var objCtrl = new NBrightBuyController();
if (productId == -1) productId = AddNew(); // add new record if -1 is used as id.
Info = objCtrl.Get(productId, "PRDLANG", _lang);
if (Info != null)
{
_portalId = Info.PortalId;
_storeSettings = new StoreSettings(_portalId);
Exists = true;
if (hydrateLists)
{
//build model list
Models = GetEntityList("models");
Options = GetEntityList("options");
Imgs = GetEntityList("imgs");
Docs = GetEntityList("docs");
OptionValues = new List<NBrightInfo>();
foreach (var o in Options)
{
var l = GetOptionValuesById(o.GetXmlProperty("genxml/hidden/optionid"));
OptionValues.AddRange(l);
}
}
Exists = true;
DataRecord = objCtrl.GetData(productId);
DataLangRecord = objCtrl.GetDataLang(productId, _lang);
if (DataLangRecord == null) // rebuild langauge is we have a missing lang record
{
Validate();
DataLangRecord = objCtrl.GetDataLang(productId, _lang);
}
IsOnSale = CheckIsOnSale();
IsInStock = CheckIsInStock();
}
else
{
Exists = false;
}
}
示例6: DeleteData
private String DeleteData(HttpContext context)
{
var objCtrl = new NBrightBuyController();
//get uploaded params
var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
var itemid = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");
if (Utils.IsNumeric(itemid))
{
var nbi = objCtrl.Get(Convert.ToInt32(itemid));
if (nbi != null)
{
var typecode = nbi.TypeCode;
// run the promo before delete, so we remove any promo data that may exist.
if (typecode == "CATEGORYPROMO")
{
PromoUtils.RemoveGroupProductPromo(PortalSettings.Current.PortalId, Convert.ToInt32(itemid));
}
if (typecode == "MULTIBUYPROMO")
{
PromoUtils.RemoveMultiBuyProductPromo(PortalSettings.Current.PortalId, Convert.ToInt32(itemid));
}
}
// delete DB record
objCtrl.Delete(Convert.ToInt32(itemid));
NBrightBuyUtils.RemoveModCache(-2);
}
return "";
}
示例7: SaveData
private String SaveData(HttpContext context)
{
try
{
var objCtrl = new NBrightBuyController();
//get uploaded params
var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
SetContextLangauge(ajaxInfo); // Ajax breaks context with DNN, so reset the context language to match the client.
var itemid = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");
var lang = ajaxInfo.GetXmlProperty("genxml/hidden/editlang");
if (lang == "") lang = ajaxInfo.GetXmlProperty("genxml/hidden/lang");
if (lang == "") lang = _lang;
if (Utils.IsNumeric(itemid))
{
// get DB record
var nbi = objCtrl.Get(Convert.ToInt32(itemid));
if (nbi != null)
{
// get data passed back by ajax
var strIn = HttpUtility.UrlDecode(Utils.RequestParam(context, "inputxml"));
// update record with ajax data
nbi.UpdateAjax(strIn);
nbi.GUIDKey = nbi.GetXmlProperty("genxml/textbox/code");
objCtrl.Update(nbi);
// do langauge record
nbi = objCtrl.GetDataLang(Convert.ToInt32(itemid), lang);
nbi.UpdateAjax(strIn);
objCtrl.Update(nbi);
DataCache.ClearCache(); // clear ALL cache, the usagelimit may need to be reset.
}
}
return "";
}
catch (Exception ex)
{
return ex.ToString();
}
}
示例8: CalculateModels
public static NBrightInfo CalculateModels(NBrightInfo objInfo,String controlMapPath)
{
var objCtrl = new NBrightBuyController();
var optList = new List<NBrightInfo>();
// get list of active options for product models
var xmlOptList = objInfo.XMLDoc.SelectNodes("genxml/prdopt/id");
if (xmlOptList != null)
{
foreach (XmlNode xNod in xmlOptList)
{
if (Utils.IsNumeric(xNod.InnerText))
{
var objOpt = objCtrl.Get(Convert.ToInt32(xNod.InnerText));
if (objOpt != null) optList.Add(objOpt);
}
}
}
//sort into ItemId order so we get the same modelcode created.
optList.Sort(delegate(NBrightInfo p1, NBrightInfo p2)
{
return p1.ItemID.CompareTo(p2.ItemID);
});
//Build modelCode list
int lp1 = 0;
var mcList = new List<string>();
lp1 = 0;
if (optList.Count == 1)
{
// only 1 option with stock, so no need to do a recursive build.
var xmlNodList2 = optList[0].XMLDoc.SelectNodes("genxml/optionval/genxml");
if (xmlNodList2 != null)
foreach (XmlNode xNod2 in xmlNodList2)
{
var xNod = xNod2.SelectSingleNode("textbox/txtoptionvalue");
if (xNod != null) mcList.Add(xNod.InnerText);
}
}
else
{
// do recursive build on options.
while (lp1 < (optList.Count - 1))
{
mcList = BuildModelCodes(optList, lp1, "", "", mcList);
lp1++;
}
}
//Merge with existing models
var templCtrl = new TemplateGetter(controlMapPath,controlMapPath);
Repeater rpEntity;
var strTemplate = templCtrl.GetTemplateData("AdminProducts_Models.html", Utils.GetCurrentCulture(), true, true, true, StoreSettings.Current.Settings());
// remove models no longer needed
XmlNodeList nodes = objInfo.XMLDoc.SelectNodes("genxml/models/genxml");
for (int i = nodes.Count - 1; i >= 0; i--)
{
var mCode = nodes[i].SelectSingleNode("hidden/modelcode");
if (mCode != null)
{
if (!mcList.Contains(mCode.InnerText))
{
var parentNode = nodes[i].ParentNode;
if (parentNode != null) parentNode.RemoveChild(nodes[i]);
}
}
else
{
// no modelcode, invalid, so remove
var parentNode = nodes[i].ParentNode;
if (parentNode != null) parentNode.RemoveChild(nodes[i]);
}
}
// save changes back to the product object
objInfo.XMLData = objInfo.XMLDoc.OuterXml;
// add new models
var idx = 0;
foreach (var modelCode in mcList)
{
if (objInfo.XMLDoc.SelectSingleNode("genxml/models/genxml/hidden/modelcode[.='" + modelCode + "']") == null)
{
var obj = new NBrightInfo();
rpEntity = GenXmlFunctions.InitRepeater(obj, strTemplate);
GenXmlFunctions.SetHiddenField(rpEntity.Items[0], "modelcode", modelCode);
GenXmlFunctions.SetHiddenField(rpEntity.Items[0], "entityindex", idx.ToString(CultureInfo.InvariantCulture));
var strXml = GenXmlFunctions.GetGenXml(rpEntity, 0);
objInfo = AddEntity(objInfo, "models", 1, strXml);
idx += 1;
}
}
return objInfo;
}
示例9: RemoveAllXref
public static void RemoveAllXref(string itemId)
{
if (Utils.IsNumeric(itemId))
{
var xrefList = new List<string>();
xrefList.Add("prdimg");
xrefList.Add("prdxref");
xrefList.Add("prddoc");
xrefList.Add("prdopt");
foreach (var xrefName in xrefList)
{
var objCtrl = new NBrightBuyController();
var objPInfo = objCtrl.Get(Convert.ToInt32(itemId));
if (objPInfo != null)
{
var xrefIdList = objPInfo.GetXrefList(xrefName);
foreach (var xrefid in xrefIdList)
{
if (Utils.IsNumeric(xrefid))
{
var objRef = objCtrl.Get(Convert.ToInt32(xrefid));
if (objRef != null)
{
objRef.RemoveXref(xrefName, itemId);
objCtrl.Update(objRef);
}
}
objPInfo.RemoveXref(xrefName, xrefid);
objCtrl.Update(objPInfo);
}
}
}
}
}
示例10: GetRelatedCats
public static string GetRelatedCats(int portalId, string parentItemId, string cultureCode, string templatePrefix, string controlMapPath, Boolean AllowCache = true)
{
var strOut = "";
if (Utils.IsNumeric(parentItemId))
{
if (!AllowCache)
{
//Remove any cache for the module -1, we don't want any cache in BO
//All xref records are portal wide, hence -1 in cahce key.
NBrightBuyUtils.RemoveModCache(-1);
}
var objCtrl = new NBrightBuyController();
var templCtrl = new TemplateController(controlMapPath);
var hTempl = templCtrl.GetTemplateData(templatePrefix + "_" + ModuleEventCodes.selectedheader + ".html", Utils.GetCurrentCulture());
var bTempl = templCtrl.GetTemplateData(templatePrefix + "_" + ModuleEventCodes.selectedbody + ".html", Utils.GetCurrentCulture());
var fTempl = templCtrl.GetTemplateData(templatePrefix + "_" + ModuleEventCodes.selectedfooter + ".html", Utils.GetCurrentCulture());
// replace Settings tags for ajax to work.
hTempl = Utils.ReplaceUrlTokens(hTempl);
bTempl = Utils.ReplaceUrlTokens(bTempl);
fTempl = Utils.ReplaceUrlTokens(fTempl);
var strFilter = " and parentitemid = " + parentItemId;
var strOrderBy = GenXmlFunctions.GetSqlOrderBy(hTempl);
if (strOrderBy == "")
{
strOrderBy = GenXmlFunctions.GetSqlOrderBy(bTempl);
}
var l = objCtrl.GetList(portalId, -1, "CATXREF", strFilter, strOrderBy);
var objList = new List<NBrightInfo>();
foreach (var objXref in l)
{
var o = objCtrl.Get(objXref.XrefItemId, "CATEGORYLANG", cultureCode);
if (o != null)
{
if (objXref.GetXmlProperty("genxml/hidden/defaultcat") != "")
{
// set the default flag in the category, for display in the entry only.
o.SetXmlProperty("genxml/hidden/defaultcat", "True");
}
o.GUIDKey = objXref.ItemID.ToString(); // overwrite with xref itemid for delete ajax action.
o.TextData = o.GetXmlProperty("genxml/lang/genxml/textbox/txtname"); // set for sort
o.Lang = cultureCode; // set lang so the GenXmlTemplateExt can pickup the edit langauge.
objList.Add(o);
objList.Sort(delegate(NBrightInfo p1, NBrightInfo p2) { return p1.TextData.CompareTo(p2.TextData); });
}
}
var obj = new NBrightInfo();
strOut += GenXmlFunctions.RenderRepeater(obj, hTempl);
strOut += GenXmlFunctions.RenderRepeater(objList, bTempl);
strOut += GenXmlFunctions.RenderRepeater(obj, fTempl);
}
return strOut;
}
示例11: GetRelatedXref
public static string GetRelatedXref(int portalId, string parentItemId, string lang, string templatePrefix, string nodeName, string entityTypeCodeLang, string controlMapPath)
{
var strOut = "";
if (Utils.IsNumeric(parentItemId))
{
var objCtrl = new NBrightBuyController();
var templCtrl = new TemplateController(controlMapPath);
var hTempl = templCtrl.GetTemplateData(templatePrefix + "_" + ModuleEventCodes.selectedheader + ".html", Utils.GetCurrentCulture());
var bTempl = templCtrl.GetTemplateData(templatePrefix + "_" + ModuleEventCodes.selectedbody + ".html", Utils.GetCurrentCulture());
var fTempl = templCtrl.GetTemplateData(templatePrefix + "_" + ModuleEventCodes.selectedfooter + ".html", Utils.GetCurrentCulture());
// replace tags for ajax to work.
hTempl = Utils.ReplaceUrlTokens(hTempl);
bTempl = Utils.ReplaceUrlTokens(bTempl);
fTempl = Utils.ReplaceUrlTokens(fTempl);
var objPInfo = objCtrl.Get(Convert.ToInt32(parentItemId));
if (objPInfo != null)
{
var nodList = objPInfo.XMLDoc.SelectNodes("genxml/" + nodeName + "/id");
var objList = new List<NBrightInfo>();
foreach (XmlNode xNod in nodList)
{
if (xNod != null && Utils.IsNumeric(xNod.InnerText))
{
var o = objCtrl.Get(Convert.ToInt32(xNod.InnerText), lang, entityTypeCodeLang);
if (o != null)
{
objList.Add(o);
}
}
}
var obj = new NBrightInfo();
strOut += GenXmlFunctions.RenderRepeater(obj, hTempl);
strOut += GenXmlFunctions.RenderRepeater(objList, bTempl);
strOut += GenXmlFunctions.RenderRepeater(obj, fTempl);
}
}
return strOut;
}
示例12: LoadData
private void LoadData(int categoryId)
{
Exists = false;
if (categoryId == -1) categoryId = AddNew(); // add new record if -1 is used as id.
var objCtrl = new NBrightBuyController();
if (_lang == "") _lang = Utils.GetCurrentCulture();
Info = objCtrl.Get(categoryId, "CATEGORYLANG", _lang);
if (Info != null)
{
Exists = true;
_portalId = Info.PortalId;
DataRecord = objCtrl.GetData(categoryId);
DataLangRecord = objCtrl.GetDataLang(categoryId, _lang);
if (DataLangRecord == null) // rebuild langauge is we have a missing lang record
{
Validate();
DataLangRecord = objCtrl.GetDataLang(categoryId, _lang);
}
}
}
示例13: Validate
public int Validate()
{
var errorcount = 0;
var objCtrl = new NBrightBuyController();
// default any undefined group type as category (I think quickcategory v1.0.0 plugin causes this)
if (DataRecord.GetXmlProperty("genxml/dropdownlist/ddlgrouptype") == "")
{
DataRecord.SetXmlProperty("genxml/dropdownlist/ddlgrouptype", "cat");
objCtrl.Update(DataRecord);
}
if (GroupType == "cat")
{
// the base category ref cannot have language dependant refs, we therefore just use a unique key
var catref = DataRecord.GetXmlProperty("genxml/textbox/txtcategoryref");
if (catref == "" || DataRecord.GUIDKey == "")
{
catref = Utils.GetUniqueKey().ToLower();
DataRecord.SetXmlProperty("genxml/textbox/txtcategoryref", catref);
DataRecord.GUIDKey = catref;
errorcount += 1;
}
if (DataRecord.GetXmlProperty("genxml/dropdownlist/ddlparentcatid") != DataRecord.ParentItemId.ToString())
{
DataRecord.SetXmlProperty("genxml/dropdownlist/ddlparentcatid", DataRecord.ParentItemId.ToString());
}
}
DataRecord.ValidateXmlFormat();
if (DataLangRecord == null)
{
// we have no datalang record for this language, so get an existing one and save it.
var l = objCtrl.GetList(_portalId, -1, "CATEGORYLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString(""));
if (l.Count > 0)
{
DataLangRecord = (NBrightInfo)l[0].Clone();
DataLangRecord.ItemID = -1;
DataLangRecord.Lang = _lang;
DataLangRecord.ValidateXmlFormat();
objCtrl.Update(DataLangRecord);
}
}
// fix image
var imgpath = DataRecord.GetXmlProperty("genxml/hidden/imagepath");
var imgurl = DataRecord.GetXmlProperty("genxml/hidden/imageurl");
var imagefilename = Path.GetFileName(imgpath);
if (!imgpath.StartsWith(StoreSettings.Current.FolderImagesMapPath))
{
DataRecord.SetXmlProperty("genxml/hidden/imagepath", StoreSettings.Current.FolderImagesMapPath.TrimEnd('\\') + "\\" + imagefilename);
errorcount += 1;
}
if (imagefilename == "")
{
DataRecord.SetXmlProperty("genxml/hidden/imagepath", "");
errorcount += 1;
}
if (!imgurl.StartsWith(StoreSettings.Current.FolderImages))
{
DataRecord.SetXmlProperty("genxml/hidden/imageurl", StoreSettings.Current.FolderImages.TrimEnd('/') + "/" + imagefilename);
errorcount += 1;
}
if (imagefilename == "")
{
DataRecord.SetXmlProperty("genxml/hidden/imageurl", "");
errorcount += 1;
}
// check guidkey is correct
if (DataRecord.GUIDKey != CategoryRef)
{
DataRecord.GUIDKey = CategoryRef;
errorcount += 1;
}
if (errorcount > 0) objCtrl.Update(DataRecord); // update if we find a error
// fix langauge records
foreach (var lang in DnnUtils.GetCultureCodeList(_portalId))
{
var l = objCtrl.GetList(_portalId, -1, "CATEGORYLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'");
if (l.Count == 0 && DataLangRecord != null)
{
var nbi = (NBrightInfo)DataLangRecord.Clone();
nbi.ItemID = -1;
nbi.Lang = lang;
objCtrl.Update(nbi);
errorcount += 1;
}
if (l.Count > 1)
{
// we have more records than shoudl exists, remove any old ones.
var l2 = objCtrl.GetList(_portalId, -1, "CATEGORYLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'", "order by Modifieddate desc");
var lp = 1;
foreach (var i in l2)
{
//.........这里部分代码省略.........
示例14: SaveData
private String SaveData(HttpContext context)
{
var objCtrl = new NBrightBuyController();
//get uploaded params
var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
SetContextLangauge(ajaxInfo); // Ajax breaks context with DNN, so reset the context language to match the client.
var itemid = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");
var lang = ajaxInfo.GetXmlProperty("genxml/hidden/editlang");
if (lang == "") lang = ajaxInfo.GetXmlProperty("genxml/hidden/lang");
if (lang == "") lang = _lang;
if (Utils.IsNumeric(itemid))
{
// get DB record
var nbi = objCtrl.Get(Convert.ToInt32(itemid));
if (nbi != null)
{
var typecode = nbi.TypeCode;
// get data passed back by ajax
var strIn = HttpUtility.UrlDecode(Utils.RequestParam(context, "inputxml"));
// update record with ajax data
nbi.UpdateAjax(strIn);
nbi.GUIDKey = nbi.GetXmlProperty("genxml/textbox/code");
objCtrl.Update(nbi);
// do langauge record
var nbi2 = objCtrl.GetDataLang(Convert.ToInt32(itemid), lang);
nbi2.UpdateAjax(strIn);
objCtrl.Update(nbi2);
DataCache.ClearCache(); // clear ALL cache.
// run the promo before delete, so we remove any promo data that may exist.
if (typecode == "CATEGORYPROMO")
{
PromoUtils.CalcGroupPromoItem(nbi);
}
if (typecode == "MULTIBUYPROMO")
{
PromoUtils.CalcMultiBuyPromoItem(nbi);
}
}
}
return "";
}
示例15: PopulatePurchaseData
/// <summary>
/// Get CartID from cookie or session
/// </summary>
/// <returns></returns>
protected int PopulatePurchaseData(int entryId)
{
_entryId = entryId;
//populate cart data
var modCtrl = new NBrightBuyController();
PurchaseInfo = modCtrl.Get(Convert.ToInt32(_entryId));
if (PurchaseInfo == null)
{
PurchaseInfo = new NBrightInfo(true);
PurchaseInfo.TypeCode = PurchaseTypeCode;
//add items node so we can add items
PurchaseInfo.AddSingleNode("items","","genxml");
if (entryId == -1)
{
PurchaseInfo.UserId = UserController.Instance.GetCurrentUserInfo().UserID; // new cart created from front office, so give current userid.
EditMode = "";
}
}
PurchaseTypeCode = PurchaseInfo.TypeCode;
UserId = PurchaseInfo.UserId; //retain theuserid, if created by a manager for a client.
var currentuserInfo = UserController.Instance.GetCurrentUserInfo();
if (UserId > 0 && EditMode != "") // 0 is default userid for new cart
{
PurchaseInfo.SetXmlProperty("genxml/clientmode", "True", TypeCode.String, false);
PurchaseInfo.SetXmlProperty("genxml/clientdisplayname", currentuserInfo.DisplayName);
}
else
{
PurchaseInfo.SetXmlProperty("genxml/clientmode", "False", TypeCode.String, false);
PurchaseInfo.SetXmlProperty("genxml/clientdisplayname", "");
}
//build item list
PopulateItemList();
return Convert.ToInt32(_entryId);
}