/// <summary> /// Gets all checkout attributes /// </summary> /// <param name="languageId">Language identifier</param> /// <param name="dontLoadShippableProductRequired">Value indicating whether to do not load attributes for checkout attibutes which require shippable products</param> /// <returns>Checkout attribute collection</returns> public override DBCheckoutAttributeCollection GetAllCheckoutAttributes(int languageId, bool dontLoadShippableProductRequired) { var result = new DBCheckoutAttributeCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CheckoutAttributeLoadAll"); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); db.AddInParameter(dbCommand, "DontLoadShippableProductRequired", DbType.Boolean, dontLoadShippableProductRequired); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetCheckoutAttributeFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Update a localized specification attribute option /// </summary> /// <param name="specificationAttributeOptionLocalizedId">Localized specification attribute option identifier</param> /// <param name="specificationAttributeOptionId">Specification attribute option identifier</param> /// <param name="languageId">Language identifier</param> /// <param name="name">Name text</param> /// <returns>Localized specification attribute option</returns> public override DBSpecificationAttributeOptionLocalized UpdateSpecificationAttributeOptionLocalized(int specificationAttributeOptionLocalizedId, int specificationAttributeOptionId, int languageId, string name) { DBSpecificationAttributeOptionLocalized item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_SpecificationAttributeOptionLocalizedUpdate"); db.AddInParameter(dbCommand, "SpecificationAttributeOptionLocalizedID", DbType.Int32, specificationAttributeOptionLocalizedId); db.AddInParameter(dbCommand, "SpecificationAttributeOptionID", DbType.Int32, specificationAttributeOptionId); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); db.AddInParameter(dbCommand, "Name", DbType.String, name); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetSpecificationAttributeOptionLocalizedById(specificationAttributeOptionLocalizedId); } return(item); }
/// <summary> /// Gets all manufacturers /// </summary> /// <param name="showHidden">A value indicating whether to show hidden records</param> /// <returns>Manufacturer collection</returns> public override DBManufacturerCollection GetAllManufacturers(bool showHidden) { DBManufacturerCollection manufacturerCollection = new DBManufacturerCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerLoadAll"); db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBManufacturer manufacturer = GetManufacturerFromReader(dataReader); manufacturerCollection.Add(manufacturer); } } return(manufacturerCollection); }
/// <summary> /// Updates the shipping method /// </summary> /// <param name="ShippingMethodID">The shipping method identifier</param> /// <param name="Name">The name</param> /// <param name="Description">The description</param> /// <param name="DisplayOrder">The display order</param> /// <returns>Shipping method</returns> public override DBShippingMethod UpdateShippingMethod(int ShippingMethodID, string Name, string Description, int DisplayOrder) { DBShippingMethod shippingMethod = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodUpdate"); db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, ShippingMethodID); db.AddInParameter(dbCommand, "Name", DbType.String, Name); db.AddInParameter(dbCommand, "Description", DbType.String, Description); db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder); if (db.ExecuteNonQuery(dbCommand) > 0) { shippingMethod = GetShippingMethodByID(ShippingMethodID); } return(shippingMethod); }
/// <summary> /// Gets all ShippingByWeights by shipping method identifier /// </summary> /// <param name="ShippingMethodID">The shipping method identifier</param> /// <returns>ShippingByWeight collection</returns> public override DBShippingByWeightCollection GetAllByShippingMethodID(int ShippingMethodID) { DBShippingByWeightCollection shippingByWeightCollection = new DBShippingByWeightCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingByWeightLoadByShippingMethodID"); db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, ShippingMethodID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBShippingByWeight shippingByWeight = GetShippingByWeightFromReader(dataReader); shippingByWeightCollection.Add(shippingByWeight); } } return(shippingByWeightCollection); }
/// <summary> /// Gets all locale string resources by language identifier /// </summary> /// <param name="LanguageID">Language identifier</param> /// <returns>Locale string resource collection</returns> public override DBLocaleStringResourceCollection GetAllResourcesByLanguageID(int LanguageID) { DBLocaleStringResourceCollection localeStringResourceCollection = new DBLocaleStringResourceCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceLoadAllByLanguageID"); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBLocaleStringResource localeStringResource = GetLocaleStringResourceFromReader(dataReader); localeStringResourceCollection.Add(localeStringResource); } } return(localeStringResourceCollection); }
/// <summary> /// Updates the shipping method /// </summary> /// <param name="shippingMethodId">The shipping method identifier</param> /// <param name="name">The name</param> /// <param name="description">The description</param> /// <param name="displayOrder">The display order</param> /// <returns>Shipping method</returns> public override DBShippingMethod UpdateShippingMethod(int shippingMethodId, string name, string description, int displayOrder) { DBShippingMethod item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingMethodUpdate"); db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, shippingMethodId); db.AddInParameter(dbCommand, "Name", DbType.String, name); db.AddInParameter(dbCommand, "Description", DbType.String, description); db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetShippingMethodById(shippingMethodId); } return(item); }
/// <summary> /// Update a localized product variant attribute value /// </summary> /// <param name="productVariantAttributeValueLocalizedId">Localized product variant attribute value identifier</param> /// <param name="productVariantAttributeValueId">Product variant attribute value identifier</param> /// <param name="languageId">Language identifier</param> /// <param name="name">Name text</param> /// <returns>Localized product variant attribute value</returns> public override DBProductVariantAttributeValueLocalized UpdateProductVariantAttributeValueLocalized(int productVariantAttributeValueLocalizedId, int productVariantAttributeValueId, int languageId, string name) { DBProductVariantAttributeValueLocalized item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductVariantAttributeValueLocalizedUpdate"); db.AddInParameter(dbCommand, "ProductVariantAttributeValueLocalizedID", DbType.Int32, productVariantAttributeValueLocalizedId); db.AddInParameter(dbCommand, "ProductVariantAttributeValueID", DbType.Int32, productVariantAttributeValueId); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); db.AddInParameter(dbCommand, "Name", DbType.String, name); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetProductVariantAttributeValueLocalizedById(productVariantAttributeValueLocalizedId); } return(item); }
/// <summary> /// Updates a setting /// </summary> /// <param name="settingId">Setting identifier</param> /// <param name="name">The name</param> /// <param name="value">The value</param> /// <param name="description">The description</param> /// <returns>Setting</returns> public override DBSetting UpdateSetting(int settingId, string name, string value, string description) { DBSetting item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_SettingUpdate"); db.AddInParameter(dbCommand, "SettingID", DbType.Int32, settingId); db.AddInParameter(dbCommand, "Name", DbType.String, name); db.AddInParameter(dbCommand, "Value", DbType.String, value); db.AddInParameter(dbCommand, "Description", DbType.String, description); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetSettingById(settingId); } return(item); }
/// <summary> /// Updates the locale string resource /// </summary> /// <param name="localeStringResourceId">The locale string resource identifier</param> /// <param name="languageId">The language identifier</param> /// <param name="resourceName">The resource name</param> /// <param name="resourceValue">The resource value</param> /// <returns>Locale string resource</returns> public override DBLocaleStringResource UpdateLocaleStringResource(int localeStringResourceId, int languageId, string resourceName, string resourceValue) { DBLocaleStringResource item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceUpdate"); db.AddInParameter(dbCommand, "LocaleStringResourceID", DbType.Int32, localeStringResourceId); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); db.AddInParameter(dbCommand, "ResourceName", DbType.String, resourceName); db.AddInParameter(dbCommand, "ResourceValue", DbType.String, resourceValue); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetLocaleStringResourceById(localeStringResourceId); } return(item); }
/// <summary> /// Gets product variant attribute values by product identifier /// </summary> /// <param name="productVariantAttributeId">The product variant attribute mapping identifier</param> /// <param name="languageId">Language identifier</param> /// <returns>Product variant attribute mapping collection</returns> public override DBProductVariantAttributeValueCollection GetProductVariantAttributeValues(int productVariantAttributeId, int languageId) { var result = new DBProductVariantAttributeValueCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductVariantAttributeValueLoadByProductVariantAttributeID"); db.AddInParameter(dbCommand, "ProductVariantAttributeID", DbType.Int32, productVariantAttributeId); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetProductVariantAttributeValueFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Gets all locale string resources by language identifier /// </summary> /// <param name="languageId">Language identifier</param> /// <returns>Locale string resource collection</returns> public override DBLocaleStringResourceCollection GetAllResourcesByLanguageId(int languageId) { var result = new DBLocaleStringResourceCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_LocaleStringResourceLoadAllByLanguageID"); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetLocaleStringResourceFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Gets a poll answers by poll identifier /// </summary> /// <param name="pollId">Poll identifier</param> /// <returns>Poll answer collection</returns> public override DBPollAnswerCollection GetPollAnswersByPollId(int pollId) { var result = new DBPollAnswerCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_PollAnswerLoadByPollID"); db.AddInParameter(dbCommand, "PollID", DbType.Int32, pollId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetPollAnswerFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Inserts a localized checkout attribute value /// </summary> /// <param name="checkoutAttributeValueId">Checkout attribute value identifier</param> /// <param name="languageId">Language identifier</param> /// <param name="name">Name text</param> /// <returns>Localized checkout attribute value</returns> public override DBCheckoutAttributeValueLocalized InsertCheckoutAttributeValueLocalized(int checkoutAttributeValueId, int languageId, string name) { DBCheckoutAttributeValueLocalized item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CheckoutAttributeValueLocalizedInsert"); db.AddOutParameter(dbCommand, "CheckoutAttributeValueLocalizedID", DbType.Int32, 0); db.AddInParameter(dbCommand, "CheckoutAttributeValueID", DbType.Int32, checkoutAttributeValueId); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); db.AddInParameter(dbCommand, "Name", DbType.String, name); if (db.ExecuteNonQuery(dbCommand) > 0) { int checkoutAttributeValueLocalizedId = Convert.ToInt32(db.GetParameterValue(dbCommand, "@CheckoutAttributeValueLocalizedID")); item = GetCheckoutAttributeValueLocalizedById(checkoutAttributeValueLocalizedId); } return(item); }
/// <summary> /// Inserts a search log item /// </summary> /// <param name="SearchTerm">The search term</param> /// <param name="CustomerID">The customer identifier</param> /// <param name="CreatedOn">The date and time of instance creation</param> /// <returns>Search log item</returns> public override DBSearchLog InsertSearchLog(string SearchTerm, int CustomerID, DateTime CreatedOn) { DBSearchLog searchLog = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_SearchLogInsert"); db.AddOutParameter(dbCommand, "SearchLogID", DbType.Int32, 0); db.AddInParameter(dbCommand, "SearchTerm", DbType.String, SearchTerm); db.AddInParameter(dbCommand, "CustomerID", DbType.Int32, CustomerID); db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn); if (db.ExecuteNonQuery(dbCommand) > 0) { int SearchLogID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@SearchLogID")); searchLog = GetSearchLogByID(SearchLogID); } return(searchLog); }
/// <summary> /// Updates an IP address /// </summary> /// <param name="bannedIpAddressID">IP address unique identifier</param> /// <param name="address">IP address</param> /// <param name="comment">Reason why the IP was banned</param> /// <param name="createdOn">When the record was last updated</param> /// <param name="updatedOn">When the record was last updated</param> /// <returns>Banned IP address</returns> public override DBBannedIpAddress UpdateBannedIpAddress(int bannedIpAddressID, string address, string comment, DateTime createdOn, DateTime updatedOn) { DBBannedIpAddress ipAddress = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BannedIpAddressUpdate"); db.AddInParameter(dbCommand, "BannedIpAddressID", DbType.Int32, bannedIpAddressID); db.AddInParameter(dbCommand, "Address", DbType.String, address); db.AddInParameter(dbCommand, "Comment", DbType.String, comment); db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, createdOn); db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, updatedOn); if (db.ExecuteNonQuery(dbCommand) > 0) { ipAddress = GetIpAddressByID(bannedIpAddressID); } return(ipAddress); }
/// <summary> /// Gets all blog posts /// </summary> /// <param name="LanguageID">Language identifier. 0 if you want to get all news</param> /// <returns>Blog posts</returns> public override DBBlogPostCollection GetAllBlogPosts(int LanguageID) { DBBlogPostCollection blogPostCollection = new DBBlogPostCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_BlogPostLoadAll"); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBBlogPost blogPost = GetBlogPostFromReader(dataReader); blogPostCollection.Add(blogPost); } } return(blogPostCollection); }
/// <summary> /// Inserts a credit card type /// </summary> /// <param name="Name">The name</param> /// <param name="SystemKeyword">The system keyword</param> /// <param name="DisplayOrder">The display order</param> /// <param name="Deleted">A value indicating whether the entity has been deleted</param> /// <returns>A credit card type</returns> public override DBCreditCardType InsertCreditCardType(string Name, string SystemKeyword, int DisplayOrder, bool Deleted) { DBCreditCardType creditCardType = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CreditCardTypeInsert"); db.AddOutParameter(dbCommand, "CreditCardTypeID", DbType.Int32, 0); db.AddInParameter(dbCommand, "Name", DbType.String, Name); db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, SystemKeyword); db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder); db.AddInParameter(dbCommand, "Deleted", DbType.Boolean, Deleted); if (db.ExecuteNonQuery(dbCommand) > 0) { int CreditCardTypeID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@CreditCardTypeID")); creditCardType = GetCreditCardTypeByID(CreditCardTypeID); } return(creditCardType); }
/// <summary> /// Updates the picture /// </summary> /// <param name="pictureId">The picture identifier</param> /// <param name="pictureBinary">The picture binary</param> /// <param name="extension">The picture extension</param> /// <param name="isNew">A value indicating whether the picture is new</param> /// <returns>Picture</returns> public override DBPicture UpdatePicture(int pictureId, byte[] pictureBinary, string extension, bool isNew) { DBPicture item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_PictureUpdate"); db.AddInParameter(dbCommand, "PictureID", DbType.Int32, pictureId); db.AddInParameter(dbCommand, "PictureBinary", DbType.Binary, pictureBinary); db.AddInParameter(dbCommand, "Extension", DbType.String, extension); db.AddInParameter(dbCommand, "IsNew", DbType.Boolean, isNew); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetPictureById(pictureId); } return(item); }
/// <summary> /// Inserts a campaign /// </summary> /// <param name="Name">The name</param> /// <param name="Subject">The subject</param> /// <param name="Body">The body</param> /// <param name="CreatedOn">The date and time of instance creation</param> /// <returns>Campaign</returns> public override DBCampaign InsertCampaign(string Name, string Subject, string Body, DateTime CreatedOn) { DBCampaign campaign = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CampaignInsert"); db.AddOutParameter(dbCommand, "CampaignID", DbType.Int32, 0); db.AddInParameter(dbCommand, "Name", DbType.String, Name); db.AddInParameter(dbCommand, "Subject", DbType.String, Subject); db.AddInParameter(dbCommand, "Body", DbType.String, Body); db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn); if (db.ExecuteNonQuery(dbCommand) > 0) { int CampaignID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@CampaignID")); campaign = GetCampaignByID(CampaignID); } return(campaign); }
/// <summary> /// Updates a language /// </summary> /// <param name="LanguageID">Language identifier</param> /// <param name="Name">The name</param> /// <param name="LanguageCulture">The language culture</param> /// <param name="Published">A value indicating whether the language is published</param> /// <param name="DisplayOrder">The display order</param> /// <returns>Language</returns> public override DBLanguage UpdateLanguage(int LanguageID, string Name, string LanguageCulture, bool Published, int DisplayOrder) { DBLanguage language = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_LanguageUpdate"); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, LanguageID); db.AddInParameter(dbCommand, "Name", DbType.String, Name); db.AddInParameter(dbCommand, "LanguageCulture", DbType.String, LanguageCulture); db.AddInParameter(dbCommand, "Published", DbType.Boolean, Published); db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder); if (db.ExecuteNonQuery(dbCommand) > 0) { language = GetLanguageByID(LanguageID); } return(language); }
/// <summary> /// Gets a localized message template by name and language identifier /// </summary> /// <param name="name">Message template name</param> /// <param name="languageId">Language identifier</param> /// <returns>Localized message template</returns> public override DBLocalizedMessageTemplate GetLocalizedMessageTemplate(string name, int languageId) { DBLocalizedMessageTemplate item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_MessageTemplateLocalizedLoadByNameAndLanguageID"); db.AddInParameter(dbCommand, "Name", DbType.String, name); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { item = GetLocalizedMessageTemplateFromReader(dataReader); } } return(item); }
/// <summary> /// Gets all ShippingByTotals by shipping method identifier /// </summary> /// <param name="shippingMethodId">The shipping method identifier</param> /// <returns>ShippingByTotal collection</returns> public override DBShippingByTotalCollection GetAllByShippingMethodId(int shippingMethodId) { var result = new DBShippingByTotalCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingByTotalLoadByShippingMethodID"); db.AddInParameter(dbCommand, "ShippingMethodID", DbType.Int32, shippingMethodId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetShippingByTotalFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Gets all categories displayed on the home page /// </summary> /// <param name="showHidden">A value indicating whether to show hidden records</param> /// <param name="languageId">Language identifier</param> /// <returns>Category collection</returns> public override DBCategoryCollection GetAllCategoriesDisplayedOnHomePage(bool showHidden, int languageId) { var result = new DBCategoryCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CategoryLoadDisplayedOnHomePage"); db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetCategoryFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Updates the specification attribute option /// </summary> /// <param name="specificationAttributeOptionId">The specification attribute option identifier</param> /// <param name="specificationAttributeId">The specification attribute identifier</param> /// <param name="name">The name</param> /// <param name="displayOrder">Display order</param> /// <returns>Specification attribute option</returns> public override DBSpecificationAttributeOption UpdateSpecificationAttributeOption(int specificationAttributeOptionId, int specificationAttributeId, string name, int displayOrder) { DBSpecificationAttributeOption item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_SpecificationAttributeOptionUpdate"); db.AddInParameter(dbCommand, "SpecificationAttributeOptionID", DbType.Int32, specificationAttributeOptionId); db.AddInParameter(dbCommand, "SpecificationAttributeID", DbType.Int32, specificationAttributeId); db.AddInParameter(dbCommand, "Name", DbType.String, name); db.AddInParameter(dbCommand, "DisplayOrder", DbType.String, displayOrder); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetSpecificationAttributeOptionById(specificationAttributeOptionId, 0); } return(item); }
/// <summary> /// Inserts a topic /// </summary> /// <param name="Name">The name</param> /// <param name="metaKeywords">Key words adds to title (SEO)</param> /// <param name="metaDescription">Description for SEO</param> /// <param name="metaTitle">Title for SEO</param> /// <returns>Topic</returns> public override DBTopic InsertTopic(string Name, string metaKeywords, string metaDescription, string metaTitle) { DBTopic topic = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_TopicInsert"); db.AddOutParameter(dbCommand, "TopicID", DbType.Int32, 0); db.AddInParameter(dbCommand, "Name", DbType.String, Name); db.AddInParameter(dbCommand, "MetaKeywords", DbType.String, metaKeywords); db.AddInParameter(dbCommand, "MetaDescription", DbType.String, metaDescription); db.AddInParameter(dbCommand, "MetaTitle", DbType.String, metaTitle); if (db.ExecuteNonQuery(dbCommand) > 0) { int TopicID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@TopicID")); topic = GetTopicByID(TopicID); } return(topic); }
/// <summary> /// Gets all specification attribute option filter mapping collection by category id /// </summary> /// <param name="categoryId">Product category identifier</param> /// <param name="languageId">Language identifier</param> /// <returns>Specification attribute option filter mapping collection</returns> public override DBSpecificationAttributeOptionFilterCollection GetSpecificationAttributeOptionFilterByCategoryId(int categoryId, int languageId) { var result = new DBSpecificationAttributeOptionFilterCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_SpecificationAttributeOptionFilter_LoadByFilter"); db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, categoryId); db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetSpecificationAttributeOptionFilterFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Updates the viewed item /// </summary> /// <param name="ViewedItemID">The viewed item identifier</param> /// <param name="CustomerSessionGUID">The customer session identifier</param> /// <param name="ProductVariantID">The product variant identifier</param> /// <param name="CreatedOn">The date and time of instance creation</param> /// <returns>Viewed item</returns> public override DBViewedItem UpdateViewedItem(int ViewedItemID, Guid CustomerSessionGUID, int ProductVariantID, DateTime CreatedOn) { DBViewedItem viewedItem = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("ViewedItemUpdate"); db.AddInParameter(dbCommand, "ViewedItemID", DbType.Int32, ViewedItemID); db.AddInParameter(dbCommand, "CustomerSessionGUID", DbType.Guid, CustomerSessionGUID); db.AddInParameter(dbCommand, "ProductVariantID", DbType.Int32, ProductVariantID); db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn); if (db.ExecuteNonQuery(dbCommand) > 0) { viewedItem = GetViewedItemByID(ViewedItemID); } return(viewedItem); }
/// <summary> /// Inserts a product manufacturer mapping /// </summary> /// <param name="ProductID">Product identifier</param> /// <param name="ManufacturerID">Manufacturer identifier</param> /// <param name="IsFeaturedProduct">A value indicating whether the product is featured</param> /// <param name="DisplayOrder">The display order</param> /// <returns>Product manufacturer mapping </returns> public override DBProductManufacturer InsertProductManufacturer(int ProductID, int ManufacturerID, bool IsFeaturedProduct, int DisplayOrder) { DBProductManufacturer productManufacturer = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_Product_Manufacturer_MappingInsert"); db.AddOutParameter(dbCommand, "ProductManufacturerID", DbType.Int32, 0); db.AddInParameter(dbCommand, "ProductID", DbType.Int32, ProductID); db.AddInParameter(dbCommand, "ManufacturerID", DbType.Int32, ManufacturerID); db.AddInParameter(dbCommand, "IsFeaturedProduct", DbType.Boolean, IsFeaturedProduct); db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder); if (db.ExecuteNonQuery(dbCommand) > 0) { int ProductManufacturerID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@ProductManufacturerID")); productManufacturer = GetProductManufacturerByID(ProductManufacturerID); } return(productManufacturer); }
/// <summary> /// Gets all currencies /// </summary> /// <returns>Currency collection</returns> public override DBCurrencyCollection GetAllCurrencies(bool showHidden) { var result = new DBCurrencyCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_CurrencyLoadAll"); db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetCurrencyFromReader(dataReader); result.Add(item); } } return(result); }