Ejemplo n.º 1
0
        private DBNewsLetterSubscription GetNewsLetterSubscriptionFromReader(IDataReader dataReader)
        {
            var item = new DBNewsLetterSubscription();

            item.NewsLetterSubscriptionId   = NopSqlDataHelper.GetInt(dataReader, "NewsLetterSubscriptionID");
            item.NewsLetterSubscriptionGuid = NopSqlDataHelper.GetGuid(dataReader, "NewsLetterSubscriptionGuid");
            item.Email     = NopSqlDataHelper.GetString(dataReader, "Email");
            item.IsActive  = NopSqlDataHelper.GetBoolean(dataReader, "Active");
            item.CreatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");

            return(item);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the newsletter subscription by email
        /// </summary>
        /// <param name="email">The Email</param>
        /// <returns>NewsLetterSubscription entity</returns>
        public override DBNewsLetterSubscription GetNewsLetterSubscriptionByEmail(string email)
        {
            DBNewsLetterSubscription item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_NewsLetterSubscriptionLoadByEmail");

            db.AddInParameter(dbCommand, "Email", DbType.String, email);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetNewsLetterSubscriptionFromReader(dataReader);
                }
            }
            return(item);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the newsletter subscription by newsletter subscription identifier
        /// </summary>
        /// <param name="newsLetterSubscriptionId">The newsletter subscription identifier</param>
        /// <returns>NewsLetterSubscription entity</returns>
        public override DBNewsLetterSubscription GetNewsLetterSubscriptionById(int newsLetterSubscriptionId)
        {
            DBNewsLetterSubscription item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_NewsLetterSubscriptionLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "NewsLetterSubscriptionID", DbType.Int32, newsLetterSubscriptionId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetNewsLetterSubscriptionFromReader(dataReader);
                }
            }
            return(item);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the newsletter subscription
        /// </summary>
        /// <param name="newsLetterSubscriptionId">The newsletter subscription identifier</param>
        /// <param name="newsLetterSubscriptionGuid">The newsletter subscription GUID</param>
        /// <param name="email">The subscriber email</param>
        /// <param name="isActive">A value indicating whether subscription is active</param>
        /// <param name="createdOn">The date and time of instance creation</param>
        /// <returns>NewsLetterSubscription entity</returns>
        public override DBNewsLetterSubscription UpdateNewsLetterSubscription(int newsLetterSubscriptionId,
                                                                              Guid newsLetterSubscriptionGuid, string email, bool isActive, DateTime createdOn)
        {
            DBNewsLetterSubscription item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_NewsLetterSubscriptionUpdate");

            db.AddInParameter(dbCommand, "NewsLetterSubscriptionID", DbType.Int32, newsLetterSubscriptionId);
            db.AddInParameter(dbCommand, "NewsLetterSubscriptionGuid", DbType.Guid, newsLetterSubscriptionGuid);
            db.AddInParameter(dbCommand, "Email", DbType.String, email);
            db.AddInParameter(dbCommand, "Active", DbType.Boolean, isActive);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, createdOn);

            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetNewsLetterSubscriptionById(newsLetterSubscriptionId);
            }
            return(item);
        }