/// ----------------------------------------------------------------------------- /// <summary> /// ImportModule implements the IPortable ImportModule Interface /// </summary> /// <remarks> /// </remarks> /// <param name = "ModuleID">The ID of the Module being imported</param> /// <param name = "Content">The Content being imported</param> /// <param name = "Version">The Version of the Module Content being imported</param> /// <param name = "UserId">The UserID of the User importing the Content</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public void ImportModule(int ModuleID, string Content, string Version, int UserId) { var xmlDoc = new XmlDocument(); var objModCtrl = new ModuleController(); var objModInfo = objModCtrl.GetModule(ModuleID); if (objModInfo != null) { var objImp = new NBrightInfo(false); objImp.FromXmlItem(Content); objImp.ModuleId = ModuleID; objImp.PortalId = objModInfo.PortalID; objImp.ItemID = -1; // create new record //delete the old setting record. var moduleSettings = NBrightBuyUtils.GetSettings(objModInfo.PortalID, ModuleID, "", false); if (moduleSettings.ItemID > -1) { Delete(moduleSettings.ItemID); } Update(objImp); NBrightBuyUtils.RemoveModCache(ModuleID); } }
/// ----------------------------------------------------------------------------- /// <summary> /// ImportModule implements the IPortable ImportModule Interface /// </summary> /// <remarks> /// </remarks> /// <param name = "moduleId">The ID of the Module being imported</param> /// <param name = "content">The Content being imported</param> /// <param name = "version">The Version of the Module Content being imported</param> /// <param name = "userId">The UserID of the User importing the Content</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public void ImportModule(int moduleId, string content, string version, int userId) { var xmlDoc = new XmlDocument(); var objModCtrl = new ModuleController(); var objCtrl = new NBrightDataController(); var objModInfo = objModCtrl.GetModule(moduleId); if (objModInfo != null) { var portalId = objModInfo.PortalID; // import All records xmlDoc.LoadXml(content); var xmlNodList = xmlDoc.SelectNodes("root/item"); if (xmlNodList != null) { foreach (XmlNode xmlNod1 in xmlNodList) { var nbi = new NBrightInfo(); nbi.FromXmlItem(xmlNod1.OuterXml); objCtrl.Update(nbi); } } // relink the tabid using breadcrumb var tl = DnnUtils.GetPortalTabs(portalId); foreach (var t in tl) { var tabInfo = (TabInfo)t.Value; var strFilter = " and NB1.GUIDKey = '" + tabInfo.TabPath + "' "; var l = objCtrl.GetList(portalId, moduleId, "PL", strFilter); foreach (var i in l) { i.GUIDKey = tabInfo.TabID.ToString(""); objCtrl.Update(i); } var l2 = objCtrl.GetList(portalId, moduleId, "PLLANG", strFilter); foreach (var i in l2) { i.GUIDKey = tabInfo.TabID.ToString(""); objCtrl.Update(i); } } } }
private void PageLoad() { #region "get Dashboard" bool forceRefresh = Utils.RequestParam(Context, "refresh") == "1"; var statsInfo = GetStats(PortalId, forceRefresh); var statsData = new NBrightInfo(true); #endregion #region "get order list" var orderList = new List <NBrightInfo>(); var nodList = statsInfo.XMLDoc.SelectNodes("root/orders/*"); if (nodList != null) { foreach (XmlNode nod in nodList) { var nbi = new NBrightInfo(); nbi.FromXmlItem(nod.OuterXml); var xmlData = nod.SelectSingleNode("genxml/genxml"); if (xmlData != null) { nbi.XMLData = xmlData.OuterXml; } orderList.Add(nbi); } } #endregion DoDetail(rpDash, statsInfo); // dashboard DoDetail(rpDataH, statsInfo); // orders header rpData.DataSource = orderList; // orders body rpData.DataBind(); DoDetail(rpDataF, statsInfo); // orders footer }
private void ImportRecord(XmlDocument xmlFile, String typeCode, Boolean updaterecordsbyref = true) { var nodList = xmlFile.SelectNodes("root/item[./typecode='" + typeCode + "']"); if (nodList != null) { foreach (XmlNode nod in nodList) { var nbi = new NBrightInfo(); nbi.FromXmlItem(nod.OuterXml); var olditemid = nbi.ItemID; // check to see if we have a new record or updating a existing one, use the ref field to find out. nbi.ItemID = -1; if (nbi.PortalId >= 0) { nbi.PortalId = PortalId; // shared products have -1 portalid } if (typeCode == "PRD" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtproductref"); if (itemref != "") { var l = ModCtrl.GetList(nbi.PortalId, -1, "PRD", " and NB1.XmlData.value('(genxml/textbox/txtproductref)[1]','nvarchar(max)') = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } } } if (typeCode == "PRDLANG") { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(nbi.PortalId, -1, "PRDLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } // import any entitytype provider data // This is data created by plugins into the NBS data tables. var pluginData = new PluginData(PortalSettings.Current.PortalId); var provList = pluginData.GetEntityTypeProviders(); foreach (var prov in provList) { var entityprov = EntityTypeInterface.Instance(prov.Key); if (entityprov != null) { if (typeCode == entityprov.GetEntityTypeCode() && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtproductref"); if (itemref != "") { var l = ModCtrl.GetList(nbi.PortalId, -1, entityprov.GetEntityTypeCode(), " and NB3.ProductRef = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } } } if (typeCode == entityprov.GetEntityTypeCodeLang()) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(nbi.PortalId, -1, entityprov.GetEntityTypeCodeLang(), " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } } } if ((typeCode == "PRDXREF" || typeCode == "CATXREF" || typeCode == "CATCASCADE")) { if (_recordXref.ContainsKey(nbi.XrefItemId)) { nbi.XrefItemId = _recordXref[nbi.XrefItemId]; } if (_recordXref.ContainsKey(nbi.ParentItemId)) { nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } var l = ModCtrl.GetList(nbi.PortalId, -1, typeCode, " AND nb1.XrefItemId = " + nbi.XrefItemId + " AND nb1.ParentItemId=" + nbi.ParentItemId); if (l.Count > 0) { return; } } if (typeCode == "USERPRDXREF") { var u = UserController.GetUserByName(nbi.PortalId, nbi.TextData); if (u != null) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } if (_recordXref.ContainsKey(nbi.XrefItemId)) { nbi.UserId = u.UserID; } var l = ModCtrl.GetList(nbi.PortalId, -1, "USERPRDXREF", " AND nb1.UserId = " + nbi.UserId + " AND nb1.ParentItemId=" + nbi.ParentItemId); if (l.Count > 0) { return; } } } if (typeCode == "CATEGORY" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtcategoryref"); if (itemref != "") { var l = ModCtrl.GetList(nbi.PortalId, -1, "CATEGORY", " and [XMLData].value('(genxml/textbox/txtcategoryref)[1]','nvarchar(max)') = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } } } if (typeCode == "CATEGORYLANG") { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(nbi.PortalId, -1, "CATEGORYLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "GROUP" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/groupref"); if (itemref != "") { var l = ModCtrl.GetList(nbi.PortalId, -1, "GROUP", " and [XMLData].value('(genxml/textbox/groupref)[1]','nvarchar(max)') = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } } } if (typeCode == "GROUPLANG") { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(nbi.PortalId, -1, "GROUPLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "SETTINGS") // the setting exported are only the portal settings, not module. So always update and don;t create new. { var l = ModCtrl.GetList(nbi.PortalId, 0, "SETTINGS", " and NB1.GUIDKey = 'NBrightBuySettings' "); if (l.Count > 0) { nbi.ItemID = l[0].ItemID; } } //NOTE: if ORDERS are imported, we expect those to ALWAYS be new records, we don't want to delete any validate orders in this import. // NOTE: we expect the records to be done in typecode order so we know parent and xref itemids. var newitemid = ModCtrl.Update(nbi); if (newitemid > 0) { _recordXref.Add(olditemid, newitemid); } if (typeCode == "PRD" && !_productList.ContainsKey(newitemid)) { _productList.Add(newitemid, typeCode); } // Add any provider data types foreach (var prov in provList) { var entityprov = EntityTypeInterface.Instance(prov.Key); if (entityprov != null) { if (typeCode == entityprov.GetEntityTypeCode()) { _productList.Add(newitemid, typeCode); } } } } } }
/// ----------------------------------------------------------------------------- /// <summary> /// ImportModule implements the IPortable ImportModule Interface /// </summary> /// <remarks> /// </remarks> /// <param name = "ModuleID">The ID of the Module being imported</param> /// <param name = "Content">The Content being imported</param> /// <param name = "Version">The Version of the Module Content being imported</param> /// <param name = "UserId">The UserID of the User importing the Content</param> /// <history> /// </history> /// ----------------------------------------------------------------------------- public void ImportModule(int ModuleID, string Content, string Version, int UserId) { var xmlDoc = new XmlDocument(); var objModCtrl = new ModuleController(); var objModInfo = objModCtrl.GetModule(ModuleID); if (objModInfo != null) { var objImp = new NBrightInfo(false); objImp.FromXmlItem(Content); objImp.ModuleId = ModuleID; objImp.PortalId = objModInfo.PortalID; objImp.ItemID = -1; // create new record //delete the old setting record. var moduleSettings = NBrightBuyUtils.GetSettings(objModInfo.PortalID, ModuleID, "", false); if (moduleSettings.ItemID > -1) Delete(moduleSettings.ItemID); Update(objImp); NBrightBuyUtils.RemoveModCache(ModuleID); } }
private void PageLoad() { #region "get Dashboard" bool forceRefresh = Utils.RequestParam(Context, "refresh") == "1"; var statsInfo = GetStats(PortalId, forceRefresh); var statsData = new NBrightInfo(true); #endregion #region "get order list" var orderList = new List<NBrightInfo>(); var nodList = statsInfo.XMLDoc.SelectNodes("root/orders/*"); if (nodList != null) { foreach (XmlNode nod in nodList) { var nbi = new NBrightInfo(); nbi.FromXmlItem(nod.OuterXml); var xmlData = nod.SelectSingleNode("genxml/genxml"); if (xmlData != null) nbi.XMLData = xmlData.OuterXml; orderList.Add(nbi); } } #endregion DoDetail(rpDash, statsInfo); // dashboard DoDetail(rpDataH, statsInfo); // orders header rpData.DataSource = orderList; // orders body rpData.DataBind(); DoDetail(rpDataF, statsInfo); // orders footer }
public List <NBrightInfo> GetListByUserDataInfoVar(string typeCode, string webserviceurl = "") { try { var weblist = new List <NBrightInfo>(); var recordCount = 0; // in some ascx we want to run a wesvice on the OnLoad event, the base.OnLoad doesn;t allow us to pass the webservice url, so we can use this to override the normal function and force a webservice to be used. if (!string.IsNullOrEmpty(OverRideWebserviceUrl)) { webserviceurl = OverRideWebserviceUrl; } if (EntityTypeCode == "" && !string.IsNullOrEmpty(webserviceurl)) { // No EntityType, therefore data must be selected from WebService. var l = new List <NBrightInfo>(); var xmlDoc = new XmlDocument(); // pass the userdatainfo into the header request (saves using or creating a post field or adding to url) var objInfo = ObjCtrl.Get(UInfo.ItemId); var userdatainfo = ""; if (objInfo != null) { if (objInfo.TypeCode == "USERDATAINFO") { //userdatainfo = DotNetNuke.Common.Globals.HTTPPOSTEncode(objInfo.XMLData); userdatainfo = objInfo.XMLData; } } string strResp = DnnUtils.GetDataResponseAsString(webserviceurl, "userdatainfo", userdatainfo); try { xmlDoc.LoadXml(strResp); } catch (Exception) { return(null); } var rc = xmlDoc.SelectSingleNode("root/recordcount"); if (rc != null && Utils.IsNumeric(rc.InnerText)) { recordCount = Convert.ToInt32(rc.InnerText); } var xmlNodeList = xmlDoc.SelectNodes("root/item"); if (xmlNodeList != null) { foreach (XmlNode xmlNod in xmlNodeList) { var obj = new NBrightInfo(); obj.FromXmlItem(xmlNod.OuterXml); l.Add(obj); } } weblist = l; if (recordCount == 0) { recordCount = weblist.Count; } } else { if (OverRideInfoList != null) { recordCount = OverRideInfoList.Count; } else { recordCount = ObjCtrl.GetListCount(UInfo.SearchPortalId, UInfo.SearchModuleId, EntityTypeCode, UInfo.SearchFilters, EntityTypeCodeLang, EntityLangauge); } } if (!Utils.IsNumeric(UInfo.SearchPageNumber)) { UInfo.SearchPageNumber = "1"; } UInfo.SearchPageSize = GenXmlFunctions.GetHiddenField(CtrlSearch, "searchpagesize"); if (UInfo.SearchPageSize == "") { UInfo.SearchPageSize = GenXmlFunctions.GetHiddenField(CtrlSearch, "pagesize"); } UInfo.SearchReturnLimit = GenXmlFunctions.GetHiddenField(CtrlSearch, "searchreturnlimit"); if (!Utils.IsNumeric(UInfo.SearchPageSize)) { UInfo.SearchPageSize = "25"; } if (!Utils.IsNumeric(UInfo.SearchReturnLimit)) { UInfo.SearchReturnLimit = "0"; } if (_activatePaging) { CtrlPaging.PageSize = Convert.ToInt32(UInfo.SearchPageSize); CtrlPaging.TotalRecords = recordCount; CtrlPaging.CurrentPage = Convert.ToInt32(UInfo.SearchPageNumber); CtrlPaging.BindPageLinks(); } else { CtrlPaging.Visible = false; } if (UInfo.SearchClearAfter == "1") { UInfo.ClearSearchData(); } if (OverRideInfoList != null) { //overiding list passed from control, so use linq to do the paging, select var records = (from o in OverRideInfoList select o); var pgNo = Convert.ToInt32(UInfo.SearchPageNumber); var pgRec = Convert.ToInt32(UInfo.SearchPageSize); var rtnRecords = records.Skip((pgNo - 1) * pgRec).Take(pgRec).ToList(); return(rtnRecords); } if (EntityTypeCode == "" & webserviceurl != "") { // use website (Might be empty). return(weblist); } else { var l = GetList(UInfo.SearchPortalId, UInfo.SearchModuleId, EntityTypeCode, UInfo.SearchFilters, UInfo.SearchOrderby, Convert.ToInt32(UInfo.SearchReturnLimit), Convert.ToInt32(UInfo.SearchPageNumber), Convert.ToInt32(UInfo.SearchPageSize), recordCount, EntityTypeCodeLang, EntityLangauge); return(l); } } catch (Exception) { //clear data incase error in userdata UInfo.ClearSearchData(); throw; } }
private void ImportRecord(XmlDocument xmlFile, String typeCode, Boolean updaterecordsbyref = true) { var nodList = xmlFile.SelectNodes("root/item[./typecode='" + typeCode + "']"); if (nodList != null) { foreach (XmlNode nod in nodList) { var nbi = new NBrightInfo(); nbi.FromXmlItem(nod.OuterXml); var olditemid = nbi.ItemID; // check to see if we have a new record or updating a existing one, use the ref field to find out. nbi.ItemID = -1; nbi.PortalId = PortalId; if (typeCode == "PRD" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtproductref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, "PRD", " and NB3.ProductRef = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == "PRDLANG" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, "PRDLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } // import any entitytype provider data // This is data created by plugins into the NBS data tables. var pluginData = new PluginData(PortalSettings.Current.PortalId); var provList = pluginData.GetEntityTypeProviders(); foreach (var prov in provList) { var entityprov = EntityTypeInterface.Instance(prov.Key); if (entityprov != null) { if (typeCode == entityprov.GetEntityTypeCode() && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtproductref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, entityprov.GetEntityTypeCode(), " and NB3.ProductRef = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == entityprov.GetEntityTypeCodeLang() && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, entityprov.GetEntityTypeCodeLang(), " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } } } if (typeCode == "PRDXREF" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.XrefItemId)) nbi.XrefItemId = _recordXref[nbi.XrefItemId]; if (_recordXref.ContainsKey(nbi.ParentItemId)) nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } if (typeCode == "USERPRDXREF" && updaterecordsbyref) { var u = UserController.GetUserByName(PortalId, nbi.TextData); if (u != null) { if (_recordXref.ContainsKey(nbi.ParentItemId)) nbi.ParentItemId = _recordXref[nbi.ParentItemId]; if (_recordXref.ContainsKey(nbi.XrefItemId)) nbi.UserId = u.UserID; } } if (typeCode == "CATEGORY" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtcategoryref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, "CATEGORY", " and [XMLData].value('(genxml/textbox/txtcategoryref)[1]','nvarchar(max)') = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == "CATEGORYLANG" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, "CATEGORYLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "GROUP" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/groupref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, "GROUP", " and [XMLData].value('(genxml/textbox/groupref)[1]','nvarchar(max)') = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == "GROUPLANG" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, "GROUPLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "SETTINGS") // the setting exported are only the portal settings, not module. So always update and don;t create new. { var l = ModCtrl.GetList(PortalId, 0, "SETTINGS", " and NB1.GUIDKey = 'NBrightBuySettings' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } //NOTE: if ORDERS are imported, we expect those to ALWAYS be new records, we don't want to delete any validate orders in this import. // NOTE: we expect the records to be done in typecode order so we know parent and xref itemids. var newitemid = ModCtrl.Update(nbi); if (newitemid > 0) _recordXref.Add(olditemid, newitemid); if (typeCode == "PRD") _productList.Add(newitemid, typeCode); // Add any provider data types foreach (var prov in provList) { var entityprov = EntityTypeInterface.Instance(prov.Key); if (entityprov != null) { if (typeCode == entityprov.GetEntityTypeCode()) _productList.Add(newitemid, typeCode); } } } } }
private void ImportRecord(XmlDocument xmlFile, String typeCode, Boolean updaterecordsbyref = true) { var nodList = xmlFile.SelectNodes("root/item[./typecode='" + typeCode + "']"); if (nodList != null) { foreach (XmlNode nod in nodList) { var nbi = new NBrightInfo(); nbi.FromXmlItem(nod.OuterXml); var olditemid = nbi.ItemID; // check to see if we have a new record or updating a existing one, use the ref field to find out. nbi.ItemID = -1; nbi.PortalId = PortalId; if (typeCode == "PRD" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtproductref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, "PRD", " and NB3.ProductRef = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == "PRDLANG" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, "PRDLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "CATEGORY" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/txtcategoryref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, "CATEGORY", " and [XMLData].value('(genxml/textbox/txtcategoryref)[1]','nvarchar(max)') = '" + itemref.Replace("'","''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == "CATEGORYLANG" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, "CATEGORYLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "GROUP" && updaterecordsbyref) { var itemref = nbi.GetXmlProperty("genxml/textbox/groupref"); if (itemref != "") { var l = ModCtrl.GetList(PortalId, -1, "GROUP", " and [XMLData].value('(genxml/textbox/groupref)[1]','nvarchar(max)') = '" + itemref.Replace("'", "''") + "' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } } if (typeCode == "GROUPLANG" && updaterecordsbyref) { if (_recordXref.ContainsKey(nbi.ParentItemId)) { var l = ModCtrl.GetList(PortalId, -1, "GROUPLANG", " and NB1.parentitemid = '" + _recordXref[nbi.ParentItemId].ToString("") + "' and NB1.Lang = '" + nbi.Lang + "'"); if (l.Count > 0) nbi.ItemID = l[0].ItemID; nbi.ParentItemId = _recordXref[nbi.ParentItemId]; } } if (typeCode == "SETTINGS") // the setting exported are only the portal settings, not module. So always update and don;t create new. { var l = ModCtrl.GetList(PortalId, 0, "SETTINGS", " and NB1.GUIDKey = 'NBrightBuySettings' "); if (l.Count > 0) nbi.ItemID = l[0].ItemID; } //NOTE: if ORDERS are imported, we expect those to ALWAYS be new records, we don't want to delete any validate orders in this import. // NOTE: we expect the records to be done in typecode order so we know parent and xref itemids. var newitemid = ModCtrl.Update(nbi); if (newitemid > 0) _recordXref.Add(olditemid, newitemid); if (typeCode == "PRD") _productList.Add(newitemid); } } }