/// <summary> /// Inserts the entry ids into search results table. /// </summary> /// <param name="searchSetId">The search set id.</param> /// <param name="catalogEntries">The catalog entries.</param> /// <returns>true if any results found</returns> internal bool InsertSearchResults(Guid searchSetId, int[] catalogEntries) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); string list = String.Empty; foreach (int id in catalogEntries) { if (String.IsNullOrEmpty(list)) { list = id.ToString(); } else { list = list + "," + id.ToString(); } } cmd.CommandText = String.Format("ecf_CatalogEntry_SearchInsertList"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("SearchSetId", searchSetId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("List", list, DataParameterType.NVarChar)); DataService.ExecuteNonExec(cmd); return(true); }
/// <summary> /// Deletes the specified catalog entry id. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> internal static void Delete(int catalogEntryId) { CatalogEntryAdmin admin = new CatalogEntryAdmin(); admin.Load(catalogEntryId); if (admin.CurrentDto.CatalogEntry.Count == 0) { throw new InvalidObjectException(); } int metaClassId = admin.CurrentDto.CatalogEntry[0].MetaClassId; DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = DataHelper.CreateDeleteStoredProcedureName("CatalogEntry"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("CatalogEntryId", catalogEntryId)); using (TransactionScope scop = new TransactionScope()) { DataService.ExecuteNonExec(cmd); // Make sure to remove meta data, if any if (metaClassId > 0) { MetaObject.Delete(CatalogContext.MetaDataContext, catalogEntryId, metaClassId); } } }
/// <summary> /// Loads the specified site GUID. /// </summary> /// <param name="siteGuid">The site GUID.</param> internal void Load(Guid siteGuid) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_Catalog"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); if (siteGuid != Guid.Empty) { cmd.Parameters.Add(new DataParameter("SiteId", siteGuid, DataParameterType.UniqueIdentifier)); } else { cmd.Parameters.Add(new DataParameter("SiteId", DataParameterType.UniqueIdentifier)); } cmd.Parameters.Add(new DataParameter("CatalogId", DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.DataSet = this.CurrentDto; cmd.TableMapping = DataHelper.MapTables("Catalog", "CatalogLanguage", "SiteCatalog"); DataService.LoadDataSet(cmd); }
/// <summary> /// Updates the currency. /// </summary> internal void Save() { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(CatalogContext.MetaDataContext, cmd, CurrentDto, "Currency", "CurrencyRate"); scope.Complete(); } }
/// <summary> /// Updates the catalog node. /// </summary> internal void Save() { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(CatalogContext.MetaDataContext, cmd, CurrentDto, "CatalogNodeRelation", "CatalogEntryRelation", "NodeEntryRelation", "CatalogItemAsset"); scope.Complete(); } }
/// <summary> /// Adds the site catalog relation. /// </summary> /// <param name="siteGuid">The site GUID.</param> /// <param name="catalogId">The catalog id.</param> internal static void AddSiteCatalogRelation(Guid siteGuid, int catalogId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = DataHelper.CreateInsertStoredProcedureName("SiteCatalog"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("SiteId", siteGuid)); cmd.Parameters.Add(new DataParameter("CatalogId", catalogId)); DataService.ExecuteNonExec(cmd); }
/// <summary> /// Loads the search results. /// </summary> /// <param name="searchSetId">The search set id.</param> internal void LoadSearchResults(Guid searchSetId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_Search_CatalogNode"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("SearchSetId", searchSetId, DataParameterType.UniqueIdentifier)); cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the variation. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> internal void LoadVariation(int catalogEntryId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntry_Variation"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("CatalogEntryId", catalogEntryId, DataParameterType.Int)); cmd.TableMapping = DataHelper.MapTables("Variation", "SalePrice", "Merchant"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the specified catalog association id. /// </summary> /// <param name="catalogAssociationId">The catalog association id.</param> internal void Load(int catalogAssociationId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogAssociation"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("CatalogAssociationId", catalogAssociationId, DataParameterType.Int)); cmd.DataSet = CurrentDto; cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads all the merchants for the current application. /// </summary> internal void LoadMerchants() { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("select * from [Merchant] where [ApplicationId]='{0}';", CatalogConfiguration.Instance.ApplicationId); cmd.CommandType = CommandType.Text; cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.TableMapping = DataHelper.MapTables("Merchant"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the assets. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> internal void LoadAssets(int catalogEntryId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntry_Asset"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("CatalogEntryId", catalogEntryId, DataParameterType.Int)); cmd.TableMapping = DataHelper.MapTables("CatalogItemAsset"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the search results. /// </summary> /// <param name="searchSetId">The search set id.</param> internal void LoadSearchResults(Guid searchSetId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_Search_CatalogEntry"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("SearchSetId", searchSetId, DataParameterType.UniqueIdentifier)); cmd.TableMapping = DataHelper.MapTables("CatalogEntry", "CatalogItemSeo", "Variation", "Merchant", "Inventory", "SalePrice", "CatalogAssociation", "CatalogItemAsset"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the root catalog nodes by site GUID. /// </summary> /// <param name="siteGuid">The site GUID.</param> internal void LoadRootBySite(Guid siteGuid) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogNode_SiteId"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("SiteId", siteGuid, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.DataSet = CurrentDto; cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the inventory. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> internal void LoadInventory(int catalogEntryId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntry_Inventory"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("CatalogEntryId", catalogEntryId, DataParameterType.Int)); cmd.TableMapping = DataHelper.MapTables("Inventory"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the specified catalog association name. /// </summary> /// <param name="catalogAssociationName">Name of the catalog association.</param> internal void Load(string catalogAssociationName) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogAssociationByName"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("AssociationName", catalogAssociationName, DataParameterType.NVarChar, 150)); cmd.DataSet = CurrentDto; cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the asset. /// </summary> /// <param name="key">The asset key.</param> internal void LoadAsset(string key) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntry_AssetKey"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("AssetKey", key, DataParameterType.NVarChar, 254)); cmd.TableMapping = DataHelper.MapTables("CatalogItemAsset"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the specified catalog entry id. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> internal void Load(int catalogEntryId) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntry"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("CatalogEntryId", catalogEntryId, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.DataSet = CurrentDto; cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the currencies. /// </summary> internal void Load() { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = "ecf_Currency"; cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.DataSet = CurrentDto; cmd.TableMapping = DataHelper.MapTables("Currency", "CurrencyRate"); DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the specified catalog entry code. /// </summary> /// <param name="catalogEntryCode">The catalog entry code.</param> internal void Load(string catalogEntryCode) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntryByCode"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("CatalogEntryCode", catalogEntryCode, DataParameterType.NVarChar, 100)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.DataSet = CurrentDto; cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the associated. /// </summary> /// <param name="parentEntryId">The parent entry id.</param> /// <param name="associationName">Name of the association.</param> internal void LoadAssociated(int parentEntryId, string associationName) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("[ecf_CatalogEntry_Associated]"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("CatalogEntryId", parentEntryId, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("AssociationName", associationName, DataParameterType.NVarChar, 150)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the currency by specified currency code. /// </summary> internal void LoadByCurrencyCode(string currencyCode) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = "ecf_Currency_Code"; cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("CurrencyCode", currencyCode, DataParameterType.NChar, 3)); cmd.DataSet = CurrentDto; cmd.TableMapping = DataHelper.MapTables("Currency", "CurrencyRate"); CurrentDto.EnforceConstraints = false; DataService.LoadDataSet(cmd); }
/// <summary> /// Gets the catalog node by URL na dlanguage code. /// </summary> /// <param name="uri">The URI.</param> /// <param name="languageCode">The language code.</param> internal void LoadByUri(string uri, string languageCode) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogNode_UriLanguage"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("Uri", uri, DataParameterType.NVarChar, 255)); cmd.Parameters.Add(new DataParameter("LanguageCode", languageCode, DataParameterType.NVarChar, 50)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.DataSet = CurrentDto; cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); }
/// <summary> /// Loads the specified catalog id. /// </summary> /// <param name="catalogId">The catalog id.</param> /// <param name="catalogNodeId">The catalog node id.</param> /// <param name="catalogEntryId">The catalog entry id.</param> /// <param name="groupName">Name of the group.</param> /// <param name="responseGroup">The response group.</param> internal void Load(int catalogId, int catalogNodeId, int catalogEntryId, string groupName, int responseGroup) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogRelation"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); cmd.Parameters.Add(new DataParameter("CatalogId", catalogId, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("CatalogNodeId", catalogNodeId, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("CatalogEntryId", catalogEntryId, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("GroupName", groupName, DataParameterType.NVarChar, 100)); cmd.Parameters.Add(new DataParameter("ResponseGroup", responseGroup, DataParameterType.Int)); cmd.DataSet = CurrentDto; cmd.TableMapping = DataHelper.MapTables("CatalogNodeRelation", "CatalogEntryRelation", "NodeEntryRelation"); DataService.LoadDataSet(cmd); }
/// <summary> /// Deletes the specified catalog association id. /// </summary> /// <param name="catalogAssociationId">The catalog association id.</param> internal static void Delete(int catalogAssociationId) { CatalogAssociationAdmin admin = new CatalogAssociationAdmin(); admin.Load(catalogAssociationId); if (admin.CurrentDto.CatalogAssociation.Count == 0) { throw new InvalidObjectException(); } DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = DataHelper.CreateDeleteStoredProcedureName("CatalogAssociation"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("CatalogAssociationId", catalogAssociationId)); DataService.ExecuteNonExec(cmd); }
/// <summary> /// Updates the catalog. /// </summary> internal void Save() { if (CurrentDto.Catalog == null) { return; } if (CurrentDto.Catalog.Count == 0) { return; } DataCommand cmd = CatalogDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(CatalogContext.MetaDataContext, cmd, CurrentDto, "Catalog", "CatalogLanguage", "SiteCatalog"); scope.Complete(); } }
/// <summary> /// Saves this instance. /// </summary> internal void Save() { if (CurrentDto.CatalogEntry == null) { return; } if (CurrentDto.CatalogEntry.Count == 0) { return; } DataCommand cmd = CatalogDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(CatalogContext.MetaDataContext, cmd, CurrentDto, "CatalogEntry", "CatalogItemSeo", "CatalogItemAsset", "Variation", "Inventory", "Merchant", "CatalogAssociation", "SalePrice"); scope.Complete(); } }
internal void SaveMerchants() { if (CurrentDto.Merchant == null) { return; } if (CurrentDto.Merchant.Count == 0) { return; } DataCommand cmd = CatalogDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(CatalogContext.MetaDataContext, cmd, CurrentDto, "Merchant"); scope.Complete(); } }
/// <summary> /// Saves this instance. /// </summary> internal void SaveAssociationType() { if (CurrentDto.AssociationType == null) { return; } if (CurrentDto.AssociationType.Count == 0) { return; } DataCommand cmd = CatalogDataHelper.CreateDataCommand(); using (TransactionScope scope = new TransactionScope()) { DataHelper.SaveDataSetSimple(CatalogContext.MetaDataContext, cmd, CurrentDto, _AssociationTypeTableName); scope.Complete(); } }
/// <summary> /// Loads the by parent entry id. /// </summary> /// <param name="parentEntryId">The parent entry id.</param> /// <param name="entryType">Type of the entry.</param> /// <param name="relationType">Type of the relation.</param> internal void LoadChildren(int parentEntryId, string entryType, string relationType) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogEntry_ParentEntryId"); cmd.Parameters = new DataParameters(); cmd.DataSet = CurrentDto; cmd.Parameters.Add(new DataParameter("ParentEntryId", parentEntryId, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("ClassTypeId", entryType.ToString(), DataParameterType.NVarChar, 50)); cmd.Parameters.Add(new DataParameter("RelationTypeId", relationType.ToString(), DataParameterType.NVarChar, 50)); cmd.Parameters.Add(new DataParameter("ReturnInactive", true, DataParameterType.Bit)); cmd.TableMapping = Mapping; DataService.LoadDataSet(cmd); // Mark columns with a do not persist attribute DataTable catalogEntryTable = cmd.DataSet.Tables["CatalogEntry"]; catalogEntryTable.Columns["RelationTypeId"].ExtendedProperties.Add("Persist", "false"); catalogEntryTable.Columns["Quantity"].ExtendedProperties.Add("Persist", "false"); catalogEntryTable.Columns["GroupName"].ExtendedProperties.Add("Persist", "false"); catalogEntryTable.Columns["SortOrder"].ExtendedProperties.Add("Persist", "false"); }
/// <summary> /// Loads the specified operation. /// </summary> /// <param name="operation">The operation.</param> /// <param name="objectType">Type of the object.</param> /// <param name="created">The created.</param> /// <param name="startingRecord">The starting record.</param> /// <param name="numberOfRecords">The number of records.</param> /// <param name="totalRecords">The total records.</param> internal void Load(string operation, string objectType, DateTime created, int startingRecord, int numberOfRecords, ref int totalRecords) { DataCommand cmd = CatalogDataHelper.CreateDataCommand(); cmd.CommandText = String.Format("ecf_CatalogLog"); cmd.Parameters = new DataParameters(); cmd.Parameters.Add(new DataParameter("ApplicationId", CatalogConfiguration.Instance.ApplicationId, DataParameterType.UniqueIdentifier)); if (!String.IsNullOrEmpty(operation)) { cmd.Parameters.Add(new DataParameter("Operation", operation, DataParameterType.NVarChar, 50)); } if (!String.IsNullOrEmpty(objectType)) { cmd.Parameters.Add(new DataParameter("ObjectType", objectType, DataParameterType.NVarChar, 50)); } if (created != DateTime.MinValue) { cmd.Parameters.Add(new DataParameter("Created", created, DataParameterType.DateTime)); } cmd.Parameters.Add(new DataParameter("StartingRec", startingRecord, DataParameterType.Int)); cmd.Parameters.Add(new DataParameter("NumRecords", numberOfRecords, DataParameterType.Int)); cmd.DataSet = this.CurrentDto; cmd.TableMapping = DataHelper.MapTables("CatalogLog"); DataService.LoadDataSet(cmd); if (CurrentDto.CatalogLog.Count > 0) { totalRecords = (int)this.CurrentDto.CatalogLog[0]["TotalCount"]; } }