Example #1
0
        private DBManufacturerTemplate GetManufacturerTemplateFromReader(IDataReader dataReader)
        {
            DBManufacturerTemplate manufacturerTemplate = new DBManufacturerTemplate();

            manufacturerTemplate.ManufacturerTemplateID = NopSqlDataHelper.GetInt(dataReader, "ManufacturerTemplateID");
            manufacturerTemplate.Name         = NopSqlDataHelper.GetString(dataReader, "Name");
            manufacturerTemplate.TemplatePath = NopSqlDataHelper.GetString(dataReader, "TemplatePath");
            manufacturerTemplate.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            manufacturerTemplate.CreatedOn    = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            manufacturerTemplate.UpdatedOn    = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
            return(manufacturerTemplate);
        }
        private DBManufacturerTemplate GetManufacturerTemplateFromReader(IDataReader dataReader)
        {
            var item = new DBManufacturerTemplate();

            item.ManufacturerTemplateId = NopSqlDataHelper.GetInt(dataReader, "ManufacturerTemplateID");
            item.Name         = NopSqlDataHelper.GetString(dataReader, "Name");
            item.TemplatePath = NopSqlDataHelper.GetString(dataReader, "TemplatePath");
            item.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            item.CreatedOn    = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            item.UpdatedOn    = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
            return(item);
        }
Example #3
0
        /// <summary>
        /// Deletes a manufacturer template
        /// </summary>
        /// <param name="ManufacturerTemplateID">Manufacturer template identifier</param>
        public override void DeleteManufacturerTemplate(int ManufacturerTemplateID)
        {
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DBManufacturerTemplate manufacturerTemplate = GetManufacturerTemplateByID(ManufacturerTemplateID);

            if (manufacturerTemplate != null)
            {
                DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerTemplateDelete");
                db.AddInParameter(dbCommand, "ManufacturerTemplateID", DbType.Int32, ManufacturerTemplateID);
                int retValue = db.ExecuteNonQuery(dbCommand);
            }
        }
Example #4
0
        /// <summary>
        /// Gets all manufacturer templates
        /// </summary>
        /// <returns>Manufacturer template collection</returns>
        public override DBManufacturerTemplateCollection GetAllManufacturerTemplates()
        {
            DBManufacturerTemplateCollection manufacturerTemplateCollection = new DBManufacturerTemplateCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerTemplateLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBManufacturerTemplate manufacturerTemplate = GetManufacturerTemplateFromReader(dataReader);
                    manufacturerTemplateCollection.Add(manufacturerTemplate);
                }
            }

            return(manufacturerTemplateCollection);
        }
        /// <summary>
        /// Inserts a manufacturer template
        /// </summary>
        /// <param name="name">The manufacturer template identifier</param>
        /// <param name="templatePath">The template path</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 template</returns>
        public override DBManufacturerTemplate InsertManufacturerTemplate(string name,
                                                                          string templatePath, int displayOrder, DateTime createdOn, DateTime updatedOn)
        {
            DBManufacturerTemplate item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerTemplateInsert");

            db.AddOutParameter(dbCommand, "ManufacturerTemplateID", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "TemplatePath", DbType.String, templatePath);
            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)
            {
                int manufacturerTemplateId = Convert.ToInt32(db.GetParameterValue(dbCommand, "@ManufacturerTemplateID"));
                item = GetManufacturerTemplateById(manufacturerTemplateId);
            }
            return(item);
        }
Example #6
0
        /// <summary>
        /// Updates the manufacturer template
        /// </summary>
        /// <param name="ManufacturerTemplateID">Manufacturer template identifer</param>
        /// <param name="Name">The manufacturer template identifier</param>
        /// <param name="TemplatePath">The template path</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 template</returns>
        public override DBManufacturerTemplate UpdateManufacturerTemplate(int ManufacturerTemplateID, string Name, string TemplatePath,
                                                                          int DisplayOrder, DateTime CreatedOn, DateTime UpdatedOn)
        {
            DBManufacturerTemplate manufacturerTemplate = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerTemplateUpdate");

            db.AddInParameter(dbCommand, "ManufacturerTemplateID", DbType.Int32, ManufacturerTemplateID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "TemplatePath", DbType.String, TemplatePath);
            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)
            {
                manufacturerTemplate = GetManufacturerTemplateByID(ManufacturerTemplateID);
            }

            return(manufacturerTemplate);
        }
        /// <summary>
        /// Gets a manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplateId">Manufacturer template identifier</param>
        /// <returns>Manufacturer template</returns>
        public override DBManufacturerTemplate GetManufacturerTemplateById(int manufacturerTemplateId)
        {
            DBManufacturerTemplate item = null;

            if (manufacturerTemplateId == 0)
            {
                return(item);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ManufacturerTemplateLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "ManufacturerTemplateID", DbType.Int32, manufacturerTemplateId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetManufacturerTemplateFromReader(dataReader);
                }
            }
            return(item);
        }