private DBMeasureWeight GetMeasureWeightFromReader(IDataReader dataReader)
 {
     DBMeasureWeight measureWeight = new DBMeasureWeight();
     measureWeight.MeasureWeightID = NopSqlDataHelper.GetInt(dataReader, "MeasureWeightID");
     measureWeight.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     measureWeight.SystemKeyword = NopSqlDataHelper.GetString(dataReader, "SystemKeyword");
     measureWeight.DisplayOrder = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
     return measureWeight;
 }
        private DBMeasureWeight GetMeasureWeightFromReader(IDataReader dataReader)
        {
            DBMeasureWeight measureWeight = new DBMeasureWeight();

            measureWeight.MeasureWeightID = NopSqlDataHelper.GetInt(dataReader, "MeasureWeightID");
            measureWeight.Name            = NopSqlDataHelper.GetString(dataReader, "Name");
            measureWeight.SystemKeyword   = NopSqlDataHelper.GetString(dataReader, "SystemKeyword");
            measureWeight.DisplayOrder    = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(measureWeight);
        }
예제 #3
0
        private DBMeasureWeight GetMeasureWeightFromReader(IDataReader dataReader)
        {
            var item = new DBMeasureWeight();

            item.MeasureWeightId = NopSqlDataHelper.GetInt(dataReader, "MeasureWeightID");
            item.Name            = NopSqlDataHelper.GetString(dataReader, "Name");
            item.SystemKeyword   = NopSqlDataHelper.GetString(dataReader, "SystemKeyword");
            item.Ratio           = NopSqlDataHelper.GetDecimal(dataReader, "Ratio");
            item.DisplayOrder    = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(item);
        }
예제 #4
0
        private static MeasureWeight DBMapping(DBMeasureWeight dbItem)
        {
            if (dbItem == null)
                return null;

            MeasureWeight item = new MeasureWeight();
            item.MeasureWeightID = dbItem.MeasureWeightID;
            item.Name = dbItem.Name;
            item.SystemKeyword = dbItem.SystemKeyword;
            item.DisplayOrder = dbItem.DisplayOrder;

            return item;
        }
예제 #5
0
        /// <summary>
        /// Gets a measure weight by identifier
        /// </summary>
        /// <param name="measureWeightId">Measure weight identifier</param>
        /// <returns>Measure weight</returns>
        public override DBMeasureWeight GetMeasureWeightById(int measureWeightId)
        {
            DBMeasureWeight item      = null;
            Database        db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand       dbCommand = db.GetStoredProcCommand("Nop_MeasureWeightLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "MeasureWeightID", DbType.Int32, measureWeightId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetMeasureWeightFromReader(dataReader);
                }
            }
            return(item);
        }
        /// <summary>
        /// Gets all measure weights
        /// </summary>
        /// <returns>Measure weight collection</returns>
        public override DBMeasureWeightCollection GetAllMeasureWeights()
        {
            DBMeasureWeightCollection measureWeightCollection = new DBMeasureWeightCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_MeasureWeightLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBMeasureWeight measureWeight = GetMeasureWeightFromReader(dataReader);
                    measureWeightCollection.Add(measureWeight);
                }
            }

            return(measureWeightCollection);
        }
예제 #7
0
        /// <summary>
        /// Updates the measure weight
        /// </summary>
        /// <param name="measureWeightId">Measure weight identifier</param>
        /// <param name="name">The name</param>
        /// <param name="systemKeyword">The system keyword</param>
        /// <param name="ratio">The ratio</param>
        /// <param name="displayOrder">The display order</param>
        /// <returns>A measure weight</returns>
        public override DBMeasureWeight UpdateMeasureWeight(int measureWeightId, string name,
                                                            string systemKeyword, decimal ratio, int displayOrder)
        {
            DBMeasureWeight item      = null;
            Database        db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand       dbCommand = db.GetStoredProcCommand("Nop_MeasureWeightUpdate");

            db.AddInParameter(dbCommand, "MeasureWeightID", DbType.Int32, measureWeightId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, systemKeyword);
            db.AddInParameter(dbCommand, "Ratio", DbType.Decimal, ratio);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetMeasureWeightById(measureWeightId);
            }

            return(item);
        }