/// <summary> /// Finds the nodes dto. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="options">The options.</param> /// <param name="recordsCount">The records count.</param> /// <returns></returns> public CatalogNodeDto FindNodesDto(CatalogSearchParameters parameters, CatalogSearchOptions options, ref int recordsCount) { CatalogSearch search = new CatalogSearch(); search.SearchOptions = options; search.SearchParameters = parameters; return(CatalogNodeManager.FindNodesDto(search, ref recordsCount, new CatalogNodeResponseGroup())); }
/// <summary> /// Gets the catalog node. /// </summary> /// <param name="code">The code.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogNode GetCatalogNode(string code, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogNode(code, responseGroup)); }
/// <summary> /// Gets the catalog node. /// </summary> /// <param name="code">The code.</param> /// <returns></returns> public CatalogNode GetCatalogNode(string code) { return(CatalogNodeManager.GetCatalogNode(code, new CatalogNodeResponseGroup())); }
/// <summary> /// Gets the catalog node. /// </summary> /// <param name="catalogNodeId">The catalog node id.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogNode GetCatalogNode(int catalogNodeId, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogNode(catalogNodeId, responseGroup)); }
/// <summary> /// Gets the catalog node. /// </summary> /// <param name="catalogNodeId">The catalog node id.</param> /// <returns></returns> public CatalogNode GetCatalogNode(int catalogNodeId) { return(CatalogNodeManager.GetCatalogNode(catalogNodeId, new CatalogNodeResponseGroup())); }
/// <summary> /// Gets the catalog nodes. /// </summary> /// <param name="catalogName">Name of the catalog.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogNodes GetCatalogNodes(string catalogName, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogNodes(catalogName, responseGroup)); }
/// <summary> /// Gets the catalog nodes. /// </summary> /// <param name="catalogName">Name of the catalog.</param> /// <returns></returns> public CatalogNodes GetCatalogNodes(string catalogName) { return(CatalogNodeManager.GetCatalogNodes(catalogName, new CatalogNodeResponseGroup())); }
/// <summary> /// Deletes the catalog node. /// </summary> /// <param name="catalogNodeId">The catalog node id.</param> /// <param name="catalogId">The catalog id.</param> public void DeleteCatalogNode(int catalogNodeId, int catalogId) { CatalogNodeManager.DeleteCatalogNode(catalogNodeId, catalogId); }
/// <summary> /// Gets the catalog nodes. /// </summary> /// <param name="catalogId">The catalog id.</param> /// <param name="parentNodeId">The parent node id.</param> /// <returns></returns> public CatalogNodes GetCatalogNodes(int catalogId, int parentNodeId) { return(CatalogNodeManager.GetCatalogNodes(catalogId, parentNodeId, new CatalogNodeResponseGroup())); }
/// <summary> /// Gets the catalog nodes dto. /// </summary> /// <param name="catalogName">Name of the catalog.</param> /// <param name="parentNodeCode">The parent node code.</param> /// <returns></returns> public CatalogNodeDto GetCatalogNodesDto(string catalogName, string parentNodeCode) { return(CatalogNodeManager.GetCatalogNodesDto(catalogName, parentNodeCode, new CatalogNodeResponseGroup())); }
/// <summary> /// Saves the catalog node. /// </summary> /// <param name="dto">The dto.</param> public void SaveCatalogNode(CatalogNodeDto dto) { CatalogNodeManager.SaveCatalogNode(dto); }
/// <summary> /// Gets the catalog nodes dto. /// </summary> /// <param name="catalogId">The catalog id.</param> /// <returns></returns> public CatalogNodeDto GetCatalogNodesDto(int catalogId) { return(CatalogNodeManager.GetCatalogNodesDto(catalogId, new CatalogNodeResponseGroup())); }
/// <summary> /// Gets the catalog nodes dto. /// </summary> /// <param name="catalogId">The catalog id.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogNodeDto GetCatalogNodesDto(int catalogId, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogNodesDto(catalogId, responseGroup)); }
/// <summary> /// Finds the catalog items table. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public DataTable FindCatalogItemsTable(ItemSearchParameters parameters, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogItemsTable(parameters, responseGroup)); }
/// <summary> /// Gets the catalog node. /// </summary> /// <param name="uri">The URI.</param> /// <param name="languageCode">The language code.</param> /// <returns></returns> public CatalogNode GetCatalogNode(string uri, string languageCode) { return(CatalogNodeManager.GetCatalogNode(uri, languageCode, new CatalogNodeResponseGroup())); }
/// <summary> /// Gets the catalog nodes. /// </summary> /// <param name="catalogId">The catalog id.</param> /// <param name="parentNodeId">The parent node id.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogNodes GetCatalogNodes(int catalogId, int parentNodeId, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogNodes(catalogId, parentNodeId, responseGroup)); }
/// <summary> /// Gets the catalog node. /// </summary> /// <param name="uri">The URI.</param> /// <param name="languageCode">The language code.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogNode GetCatalogNode(string uri, string languageCode, CatalogNodeResponseGroup responseGroup) { return(CatalogNodeManager.GetCatalogNode(uri, languageCode, responseGroup)); }
protected override int CreateSystemRow(FillDataMode Mode, int RowIndex, params object[] Item) { int i = 0; object objSysRowAction = Item[i++]; //CatalogNode object objCode = Item[i++]; object objParentCode = Item[i++]; object objName = Item[i++]; object objStartDate = Item[i++]; object objEndDate = Item[i++]; object objTemplateName = Item[i++]; object objIsActive = Item[i++]; object objSortOrder = Item[i++]; //SEO object objSeoTitle = Item[i++]; object objSeoUrl = Item[i++]; object objSeoDescription = Item[i++]; object objSeoKeywords = Item[i++]; CatalogNodeDto.CatalogNodeRow nodeRow = null; try { RowAction sysRowAction = RowAction.Default; if (objSysRowAction != null) { sysRowAction = GetRowActionEnum((string)objSysRowAction); } string Code; if (!String.IsNullOrEmpty((string)objCode)) { Code = (string)objCode; } else { throw new AbsentValue("Code"); } int parentNodeId = 0; if (objParentCode != null) { if (!objParentCode.Equals(String.Empty)) { CatalogNodeDto parentNodeDto = CatalogNodeManager.GetCatalogNodeDto((string)objParentCode, new CatalogNodeResponseGroup(CatalogNodeResponseGroup.ResponseGroup.CatalogNodeInfo)); if (parentNodeDto.CatalogNode.Count > 0) { parentNodeId = parentNodeDto.CatalogNode[0].CatalogNodeId; } } } bool bIsNew = false; CatalogNodeDto catalogNodeDto = CatalogNodeManager.GetCatalogNodeDto(Code, new CatalogNodeResponseGroup(CatalogNodeResponseGroup.ResponseGroup.CatalogNodeFull)); if (catalogNodeDto.CatalogNode.Count > 0) { if (sysRowAction == RowAction.Insert) { throw new MDPImportException(String.Format("The Catalog Node with Code '{0}' already exists.", Code)); } nodeRow = catalogNodeDto.CatalogNode[0]; if (sysRowAction == RowAction.Delete) { CatalogContext.Current.DeleteCatalogNode(nodeRow.CatalogNodeId, nodeRow.CatalogId); return(0); } if (objParentCode != null && parentNodeId > -1) { nodeRow.ParentNodeId = parentNodeId; } } else { if (sysRowAction == RowAction.Update) { throw new MDPImportException(String.Format("The Catalog Node with code '{0}' does not exists.", Code)); } if (sysRowAction == RowAction.Delete) { throw new MDPImportException(String.Format("The Catalog Node with code '{0}' does not exists.", Code)); } nodeRow = catalogNodeDto.CatalogNode.NewCatalogNodeRow(); nodeRow.ApplicationId = CatalogConfiguration.Instance.ApplicationId; nodeRow.CatalogId = _CatalogId; nodeRow.Code = Code; nodeRow.ParentNodeId = parentNodeId; nodeRow.Name = String.Empty; nodeRow.StartDate = DateTime.UtcNow; nodeRow.EndDate = DateTime.UtcNow.AddYears(3); nodeRow.TemplateName = String.Empty; nodeRow.IsActive = false; nodeRow.SortOrder = 0; bIsNew = true; } if (objName != null) { nodeRow.Name = (string)objName; } if (objStartDate != null) { nodeRow.StartDate = ((DateTime)objStartDate).ToUniversalTime(); } if (objEndDate != null) { nodeRow.EndDate = ((DateTime)objEndDate).ToUniversalTime(); } if (objTemplateName != null) { nodeRow.TemplateName = (string)objTemplateName; } if (objIsActive != null) { nodeRow.IsActive = (bool)objIsActive; } if (objSortOrder != null) { nodeRow.SortOrder = (int)objSortOrder; } int oldMetaClassId = 0; if (!_isSystemClass && _metaClassId > 0) { if (!bIsNew) { oldMetaClassId = nodeRow.MetaClassId; } nodeRow.MetaClassId = _metaClassId; } else if (bIsNew) { throw new MDPImportException("The new category cannot be created without metaclass definition."); } if (bIsNew) { catalogNodeDto.CatalogNode.AddCatalogNodeRow(nodeRow); } //SEO CatalogNodeDto.CatalogItemSeoRow catalogItemSeoRow = null; bool bSeoIsNew = false; if (!String.IsNullOrEmpty(this.Context.Language)) { if (catalogNodeDto.CatalogItemSeo.Count > 0) { DataRow[] drs = catalogNodeDto.CatalogItemSeo.Select(String.Format("LanguageCode LIKE '{0}' AND CatalogNodeId = {1}", this.Context.Language, nodeRow.CatalogNodeId)); if (drs.Length > 0) { catalogItemSeoRow = (CatalogNodeDto.CatalogItemSeoRow)drs[0]; } } if (catalogItemSeoRow == null) { catalogItemSeoRow = catalogNodeDto.CatalogItemSeo.NewCatalogItemSeoRow(); catalogItemSeoRow.ApplicationId = CatalogConfiguration.Instance.ApplicationId; catalogItemSeoRow.LanguageCode = this.Context.Language.ToLower(); catalogItemSeoRow.CatalogNodeId = nodeRow.CatalogNodeId; catalogItemSeoRow.Description = String.Empty; catalogItemSeoRow.Keywords = String.Empty; bSeoIsNew = true; } if (objSeoTitle != null) { catalogItemSeoRow.Title = (string)objSeoTitle; } if (objSeoUrl != null) { catalogItemSeoRow.Uri = (string)objSeoUrl; } else if (bSeoIsNew) { // Auto generate the URL if empty string name = catalogNodeDto.CatalogNode[0].Name; string url = String.Format("{0}.aspx", CommerceHelper.CleanUrlField(name)); int index = 1; while (CatalogContext.Current.GetCatalogEntryByUriDto(url, this.Context.Language).CatalogEntry.Count != 0 || CatalogContext.Current.GetCatalogNodeDto(url, this.Context.Language).CatalogNode.Count != 0) { url = String.Format("{0}-{1}.aspx", CommerceHelper.CleanUrlField(name), index.ToString()); index++; } catalogItemSeoRow.Uri = url; } if (objSeoDescription != null) { catalogItemSeoRow.Description = (string)objSeoDescription; } if (objSeoKeywords != null) { catalogItemSeoRow.Keywords = (string)objSeoKeywords; } if (bSeoIsNew) { catalogNodeDto.CatalogItemSeo.AddCatalogItemSeoRow(catalogItemSeoRow); } } using (TransactionScope tx = new TransactionScope()) { // Save modifications if (catalogNodeDto.HasChanges()) { CatalogContext.Current.SaveCatalogNode(catalogNodeDto); } if (!bIsNew && !_isSystemClass && oldMetaClassId != nodeRow.MetaClassId) { MetaObject.Delete(this.Context, nodeRow.CatalogNodeId, oldMetaClassId); MetaObject obj = MetaObject.NewObject(this.Context, nodeRow.CatalogNodeId, nodeRow.MetaClassId); obj.AcceptChanges(this.Context); } tx.Complete(); } } catch (Exception ex) { throw new MDPImportException(ex.Message, null, RowIndex, null, null, Item); } return(nodeRow.CatalogNodeId); }