Beispiel #1
0
        /// <summary>
        /// Updates the payment method
        /// </summary>
        /// <param name="paymentMethodId">The payment method identifer</param>
        /// <param name="name">The name</param>
        /// <param name="visibleName">The visible name</param>
        /// <param name="description">The description</param>
        /// <param name="configureTemplatePath">The configure template path</param>
        /// <param name="userTemplatePath">The user template path</param>
        /// <param name="className">The class name</param>
        /// <param name="systemKeyword">The system keyword</param>
        /// <param name="isActive">A value indicating whether the payment method is active</param>
        /// <param name="displayOrder">The display order</param>
        /// <returns>Payment method</returns>
        public override DBPaymentMethod UpdatePaymentMethod(int paymentMethodId,
                                                            string name, string visibleName, string description, string configureTemplatePath,
                                                            string userTemplatePath, string className, string systemKeyword,
                                                            bool isActive, int displayOrder)
        {
            DBPaymentMethod item      = null;
            Database        db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand       dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodUpdate");

            db.AddInParameter(dbCommand, "PaymentMethodID", DbType.Int32, paymentMethodId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "VisibleName", DbType.String, visibleName);
            db.AddInParameter(dbCommand, "Description", DbType.String, description);
            db.AddInParameter(dbCommand, "ConfigureTemplatePath", DbType.String, configureTemplatePath);
            db.AddInParameter(dbCommand, "UserTemplatePath", DbType.String, userTemplatePath);
            db.AddInParameter(dbCommand, "ClassName", DbType.String, className);
            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, systemKeyword);
            db.AddInParameter(dbCommand, "IsActive", DbType.Boolean, isActive);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetPaymentMethodById(paymentMethodId);
            }

            return(item);
        }
Beispiel #2
0
        private DBPaymentMethod GetPaymentMethodFromReader(IDataReader dataReader)
        {
            DBPaymentMethod paymentMethod = new DBPaymentMethod();

            paymentMethod.PaymentMethodID       = NopSqlDataHelper.GetInt(dataReader, "PaymentMethodID");
            paymentMethod.Name                  = NopSqlDataHelper.GetString(dataReader, "Name");
            paymentMethod.VisibleName           = NopSqlDataHelper.GetString(dataReader, "VisibleName");
            paymentMethod.Description           = NopSqlDataHelper.GetString(dataReader, "Description");
            paymentMethod.ConfigureTemplatePath = NopSqlDataHelper.GetString(dataReader, "ConfigureTemplatePath");
            paymentMethod.UserTemplatePath      = NopSqlDataHelper.GetString(dataReader, "UserTemplatePath");
            paymentMethod.ClassName             = NopSqlDataHelper.GetString(dataReader, "ClassName");
            paymentMethod.SystemKeyword         = NopSqlDataHelper.GetString(dataReader, "SystemKeyword");
            paymentMethod.IsActive              = NopSqlDataHelper.GetBoolean(dataReader, "IsActive");
            paymentMethod.DisplayOrder          = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(paymentMethod);
        }
Beispiel #3
0
        /// <summary>
        /// Gets all payment methods
        /// </summary>
        /// <returns>Payment method collection</returns>
        public override DBPaymentMethodCollection GetAllPaymentMethods(bool showHidden)
        {
            DBPaymentMethodCollection paymentMethodCollection = new DBPaymentMethodCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodLoadAll");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBPaymentMethod paymentMethod = GetPaymentMethodFromReader(dataReader);
                    paymentMethodCollection.Add(paymentMethod);
                }
            }
            return(paymentMethodCollection);
        }
Beispiel #4
0
        /// <summary>
        /// Gets a payment method
        /// </summary>
        /// <param name="SystemKeyword">Payment method system keyword</param>
        /// <returns>Payment method</returns>
        public override DBPaymentMethod GetPaymentMethodBySystemKeyword(string SystemKeyword)
        {
            DBPaymentMethod paymentMethod = null;

            if (String.IsNullOrEmpty(SystemKeyword))
            {
                return(paymentMethod);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodLoadBySystemKeyword");

            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, SystemKeyword);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    paymentMethod = GetPaymentMethodFromReader(dataReader);
                }
            }
            return(paymentMethod);
        }
Beispiel #5
0
        /// <summary>
        /// Gets a payment method
        /// </summary>
        /// <param name="PaymentMethodID">Payment method identifier</param>
        /// <returns>Payment method</returns>
        public override DBPaymentMethod GetPaymentMethodByID(int PaymentMethodID)
        {
            DBPaymentMethod paymentMethod = null;

            if (PaymentMethodID == 0)
            {
                return(paymentMethod);
            }
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "PaymentMethodID", DbType.Int32, PaymentMethodID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    paymentMethod = GetPaymentMethodFromReader(dataReader);
                }
            }
            return(paymentMethod);
        }
Beispiel #6
0
        /// <summary>
        /// Updates the payment method
        /// </summary>
        /// <param name="PaymentMethodID">The payment method identifer</param>
        /// <param name="Name">The name</param>
        /// <param name="VisibleName">The visible name</param>
        /// <param name="Description">The description</param>
        /// <param name="ConfigureTemplatePath">The configure template path</param>
        /// <param name="UserTemplatePath">The user template path</param>
        /// <param name="ClassName">The class name</param>
        /// <param name="SystemKeyword">The system keyword</param>
        /// <param name="IsActive">A value indicating whether the payment method is active</param>
        /// <param name="DisplayOrder">The display order</param>
        /// <returns>Payment method</returns>
        public override DBPaymentMethod UpdatePaymentMethod(int PaymentMethodID, string Name, string VisibleName, string Description,
                                                            string ConfigureTemplatePath, string UserTemplatePath, string ClassName, string SystemKeyword, bool IsActive, int DisplayOrder)
        {
            DBPaymentMethod paymentMethod = null;
            Database        db            = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand       dbCommand     = db.GetStoredProcCommand("Nop_PaymentMethodUpdate");

            db.AddInParameter(dbCommand, "PaymentMethodID", DbType.Int32, PaymentMethodID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "VisibleName", DbType.String, VisibleName);
            db.AddInParameter(dbCommand, "Description", DbType.String, Description);
            db.AddInParameter(dbCommand, "ConfigureTemplatePath", DbType.String, ConfigureTemplatePath);
            db.AddInParameter(dbCommand, "UserTemplatePath", DbType.String, UserTemplatePath);
            db.AddInParameter(dbCommand, "ClassName", DbType.String, ClassName);
            db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, SystemKeyword);
            db.AddInParameter(dbCommand, "IsActive", DbType.Boolean, IsActive);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, DisplayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                paymentMethod = GetPaymentMethodByID(PaymentMethodID);
            }

            return(paymentMethod);
        }