private static Manufacturer DBMapping(DBManufacturer dbItem)
        {
            if (dbItem == null)
                return null;

            Manufacturer item = new Manufacturer();
            item.ManufacturerID = dbItem.ManufacturerID;
            item.Name = dbItem.Name;
            item.Description = dbItem.Description;
            item.TemplateID = dbItem.TemplateID;
            item.MetaKeywords = dbItem.MetaKeywords;
            item.MetaDescription = dbItem.MetaDescription;
            item.MetaTitle = dbItem.MetaTitle;
            item.SEName = dbItem.SEName;
            item.PictureID = dbItem.PictureID;
            item.PageSize = dbItem.PageSize;
            item.PriceRanges = dbItem.PriceRanges;
            item.Published = dbItem.Published;
            item.Deleted = dbItem.Deleted;
            item.DisplayOrder = dbItem.DisplayOrder;
            item.CreatedOn = dbItem.CreatedOn;
            item.UpdatedOn = dbItem.UpdatedOn;

            return item;
        }
Exemple #2
0
        /// <summary>
        /// Updates the manufacturer
        /// </summary>
        /// <param name="ManufacturerID">Manufacturer identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="Description">The description</param>
        /// <param name="TemplateID">The template identifier</param>
        /// <param name="MetaKeywords">The meta keywords</param>
        /// <param name="MetaDescription">The meta description</param>
        /// <param name="MetaTitle">The meta title</param>
        /// <param name="SEName">The search-engine name</param>
        /// <param name="PictureID">The parent picture identifier</param>
        /// <param name="PageSize">The page size</param>
        /// <param name="PriceRanges">The price ranges</param>
        /// <param name="Published">A value indicating whether the entity is published</param>
        /// <param name="Deleted">A value indicating whether the entity has been deleted</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <param name="CreatedOn">The date and time of instance creation</param>
        /// <param name="UpdatedOn">The date and time of instance update</param>
        /// <returns>Manufacturer</returns>
        public override DBManufacturer UpdateManufacturer(int ManufacturerID, string Name, string Description,
                                                          int TemplateID, string MetaKeywords, string MetaDescription, string MetaTitle,
                                                          string SEName, int PictureID, int PageSize, string PriceRanges, bool Published, bool Deleted,
                                                          int DisplayOrder, DateTime CreatedOn, DateTime UpdatedOn)
        {
            DBManufacturer manufacturer = null;
            Database       db           = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand      dbCommand    = db.GetStoredProcCommand("Nop_ManufacturerUpdate");

            db.AddInParameter(dbCommand, "ManufacturerID", DbType.Int32, ManufacturerID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "Description", DbType.String, Description);
            db.AddInParameter(dbCommand, "TemplateID", DbType.Int32, TemplateID);
            db.AddInParameter(dbCommand, "MetaKeywords", DbType.String, MetaKeywords);
            db.AddInParameter(dbCommand, "MetaDescription", DbType.String, MetaDescription);
            db.AddInParameter(dbCommand, "MetaTitle", DbType.String, MetaTitle);
            db.AddInParameter(dbCommand, "SEName", DbType.String, SEName);
            db.AddInParameter(dbCommand, "PictureID", DbType.Int32, PictureID);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "PriceRanges", DbType.String, PriceRanges);
            db.AddInParameter(dbCommand, "Published", DbType.Boolean, Published);
            db.AddInParameter(dbCommand, "Deleted", DbType.Boolean, Deleted);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn);
            db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, UpdatedOn);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                manufacturer = GetManufacturerByID(ManufacturerID);
            }


            return(manufacturer);
        }
Exemple #3
0
        /// <summary>
        /// Updates the manufacturer
        /// </summary>
        /// <param name="manufacturerId">Manufacturer identifier</param>
        /// <param name="name">The name</param>
        /// <param name="description">The description</param>
        /// <param name="templateId">The template identifier</param>
        /// <param name="metaKeywords">The meta keywords</param>
        /// <param name="metaDescription">The meta description</param>
        /// <param name="metaTitle">The meta title</param>
        /// <param name="seName">The search-engine name</param>
        /// <param name="pictureId">The parent picture identifier</param>
        /// <param name="pageSize">The page size</param>
        /// <param name="priceRanges">The price ranges</param>
        /// <param name="published">A value indicating whether the entity is published</param>
        /// <param name="deleted">A value indicating whether the entity has been deleted</param>
        /// <param name="displayOrder">The display order</param>
        /// <param name="createdOn">The date and time of instance creation</param>
        /// <param name="updatedOn">The date and time of instance update</param>
        /// <returns>Manufacturer</returns>
        public override DBManufacturer UpdateManufacturer(int manufacturerId,
                                                          string name, string description,
                                                          int templateId, string metaKeywords, string metaDescription, string metaTitle,
                                                          string seName, int pictureId, int pageSize, string priceRanges,
                                                          bool published, bool deleted, int displayOrder,
                                                          DateTime createdOn, DateTime updatedOn)
        {
            DBManufacturer item      = null;
            Database       db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand      dbCommand = db.GetStoredProcCommand("Nop_ManufacturerUpdate");

            db.AddInParameter(dbCommand, "ManufacturerID", DbType.Int32, manufacturerId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "Description", DbType.String, description);
            db.AddInParameter(dbCommand, "TemplateID", DbType.Int32, templateId);
            db.AddInParameter(dbCommand, "MetaKeywords", DbType.String, metaKeywords);
            db.AddInParameter(dbCommand, "MetaDescription", DbType.String, metaDescription);
            db.AddInParameter(dbCommand, "MetaTitle", DbType.String, metaTitle);
            db.AddInParameter(dbCommand, "SEName", DbType.String, seName);
            db.AddInParameter(dbCommand, "PictureID", DbType.Int32, pictureId);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, pageSize);
            db.AddInParameter(dbCommand, "PriceRanges", DbType.String, priceRanges);
            db.AddInParameter(dbCommand, "Published", DbType.Boolean, published);
            db.AddInParameter(dbCommand, "Deleted", DbType.Boolean, deleted);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, createdOn);
            db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, updatedOn);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetManufacturerById(manufacturerId, 0);
            }

            return(item);
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        /// <summary>
        /// Gets a manufacturer
        /// </summary>
        /// <param name="ManufacturerID">Manufacturer identifier</param>
        /// <returns>Manufacturer</returns>
        public override DBManufacturer GetManufacturerByID(int ManufacturerID)
        {
            DBManufacturer manufacturer = null;

            if (ManufacturerID == 0)
            {
                return(manufacturer);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "ManufacturerID", DbType.Int32, ManufacturerID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    manufacturer = GetManufacturerFromReader(dataReader);
                }
            }
            return(manufacturer);
        }
Exemple #6
0
        private DBManufacturer GetManufacturerFromReader(IDataReader dataReader)
        {
            DBManufacturer manufacturer = new DBManufacturer();

            manufacturer.ManufacturerID  = NopSqlDataHelper.GetInt(dataReader, "ManufacturerID");
            manufacturer.Name            = NopSqlDataHelper.GetString(dataReader, "Name");
            manufacturer.Description     = NopSqlDataHelper.GetString(dataReader, "Description");
            manufacturer.TemplateID      = NopSqlDataHelper.GetInt(dataReader, "TemplateID");
            manufacturer.MetaKeywords    = NopSqlDataHelper.GetString(dataReader, "MetaKeywords");
            manufacturer.MetaDescription = NopSqlDataHelper.GetString(dataReader, "MetaDescription");
            manufacturer.MetaTitle       = NopSqlDataHelper.GetString(dataReader, "MetaTitle");
            manufacturer.SEName          = NopSqlDataHelper.GetString(dataReader, "SEName");
            manufacturer.PictureID       = NopSqlDataHelper.GetInt(dataReader, "PictureID");
            manufacturer.PageSize        = NopSqlDataHelper.GetInt(dataReader, "PageSize");
            manufacturer.PriceRanges     = NopSqlDataHelper.GetString(dataReader, "PriceRanges");
            manufacturer.Published       = NopSqlDataHelper.GetBoolean(dataReader, "Published");
            manufacturer.Deleted         = NopSqlDataHelper.GetBoolean(dataReader, "Deleted");
            manufacturer.DisplayOrder    = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            manufacturer.CreatedOn       = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            manufacturer.UpdatedOn       = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
            return(manufacturer);
        }