private DBTaxProvider GetTaxProviderFromReader(IDataReader dataReader)
 {
     DBTaxProvider taxProvider = new DBTaxProvider();
     taxProvider.TaxProviderID = NopSqlDataHelper.GetInt(dataReader, "TaxProviderID");
     taxProvider.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     taxProvider.Description = NopSqlDataHelper.GetString(dataReader, "Description");
     taxProvider.ConfigureTemplatePath = NopSqlDataHelper.GetString(dataReader, "ConfigureTemplatePath");
     taxProvider.ClassName = NopSqlDataHelper.GetString(dataReader, "ClassName");
     taxProvider.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
     return taxProvider;
 }
        private DBTaxProvider GetTaxProviderFromReader(IDataReader dataReader)
        {
            DBTaxProvider taxProvider = new DBTaxProvider();

            taxProvider.TaxProviderID         = NopSqlDataHelper.GetInt(dataReader, "TaxProviderID");
            taxProvider.Name                  = NopSqlDataHelper.GetString(dataReader, "Name");
            taxProvider.Description           = NopSqlDataHelper.GetString(dataReader, "Description");
            taxProvider.ConfigureTemplatePath = NopSqlDataHelper.GetString(dataReader, "ConfigureTemplatePath");
            taxProvider.ClassName             = NopSqlDataHelper.GetString(dataReader, "ClassName");
            taxProvider.DisplayOrder          = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(taxProvider);
        }
        /// <summary>
        /// Gets all tax providers
        /// </summary>
        /// <returns>Shipping rate computation method collection</returns>
        public override DBTaxProviderCollection GetAllTaxProviders()
        {
            DBTaxProviderCollection taxProviderCollection = new DBTaxProviderCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_TaxProviderLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBTaxProvider taxProvider = GetTaxProviderFromReader(dataReader);
                    taxProviderCollection.Add(taxProvider);
                }
            }
            return(taxProviderCollection);
        }
        /// <summary>
        /// Updates the tax provider
        /// </summary>
        /// <param name="TaxProviderID">The tax provider identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="Description">The description</param>
        /// <param name="ConfigureTemplatePath">The configure template path</param>
        /// <param name="ClassName">The class name</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <returns>Tax provider</returns>
        public override DBTaxProvider UpdateTaxProvider(int TaxProviderID, string Name, string Description,
                                                        string ConfigureTemplatePath, string ClassName, int DisplayOrder)
        {
            DBTaxProvider taxProvider = null;
            Database      db          = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand     dbCommand   = db.GetStoredProcCommand("Nop_TaxProviderUpdate");

            db.AddInParameter(dbCommand, "TaxProviderID", DbType.Int32, TaxProviderID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "Description", DbType.String, Description);
            db.AddInParameter(dbCommand, "ConfigureTemplatePath", DbType.String, ConfigureTemplatePath);
            db.AddInParameter(dbCommand, "ClassName", DbType.String, ClassName);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                taxProvider = GetTaxProviderByID(TaxProviderID);
            }

            return(taxProvider);
        }
Пример #5
0
        /// <summary>
        /// Inserts a tax provider
        /// </summary>
        /// <param name="name">The name</param>
        /// <param name="description">The description</param>
        /// <param name="configureTemplatePath">The configure template path</param>
        /// <param name="className">The class name</param>
        /// <param name="displayOrder">The display order</param>
        /// <returns>Tax provider</returns>
        public override DBTaxProvider InsertTaxProvider(string name, string description,
                                                        string configureTemplatePath, string className, int displayOrder)
        {
            DBTaxProvider item      = null;
            Database      db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand     dbCommand = db.GetStoredProcCommand("Nop_TaxProviderInsert");

            db.AddOutParameter(dbCommand, "TaxProviderID", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "Description", DbType.String, description);
            db.AddInParameter(dbCommand, "ConfigureTemplatePath", DbType.String, configureTemplatePath);
            db.AddInParameter(dbCommand, "ClassName", DbType.String, className);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                int taxProviderId = Convert.ToInt32(db.GetParameterValue(dbCommand, "@TaxProviderID"));
                item = GetTaxProviderById(taxProviderId);
            }
            return(item);
        }
        /// <summary>
        /// Gets a tax provider
        /// </summary>
        /// <param name="TaxProviderID">Tax provider identifier</param>
        /// <returns>Tax provider</returns>
        public override DBTaxProvider GetTaxProviderByID(int TaxProviderID)
        {
            DBTaxProvider taxProvider = null;

            if (TaxProviderID == 0)
            {
                return(taxProvider);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_TaxProviderLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "TaxProviderID", DbType.Int32, TaxProviderID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    taxProvider = GetTaxProviderFromReader(dataReader);
                }
            }
            return(taxProvider);
        }