예제 #1
0
        /// <summary>
        /// Updates the warehouse
        /// </summary>
        /// <param name="warehouseId">The warehouse identifier</param>
        /// <param name="name">The name</param>
        /// <param name="phoneNumber">The phone number</param>
        /// <param name="email">The email</param>
        /// <param name="faxNumber">The fax number</param>
        /// <param name="address1">The address 1</param>
        /// <param name="address2">The address 2</param>
        /// <param name="city">The city</param>
        /// <param name="stateProvince">The state/province</param>
        /// <param name="zipPostalCode">The zip/postal code</param>
        /// <param name="countryId">The country identifier</param>
        /// <param name="deleted">A value indicating whether the entity has been deleted</param>
        /// <param name="createdOn">The date and time of instance creation</param>
        /// <param name="updatedOn">The date and time of instance update</param>
        /// <returns>Warehouse</returns>
        public override DBWarehouse UpdateWarehouse(int warehouseId,
                                                    string name, string phoneNumber, string email, string faxNumber,
                                                    string address1, string address2, string city, string stateProvince,
                                                    string zipPostalCode, int countryId, bool deleted,
                                                    DateTime createdOn, DateTime updatedOn)
        {
            DBWarehouse item      = null;
            Database    db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand   dbCommand = db.GetStoredProcCommand("Nop_WarehouseUpdate");

            db.AddInParameter(dbCommand, "WarehouseID", DbType.Int32, warehouseId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "PhoneNumber", DbType.String, phoneNumber);
            db.AddInParameter(dbCommand, "Email", DbType.String, email);
            db.AddInParameter(dbCommand, "FaxNumber", DbType.String, faxNumber);
            db.AddInParameter(dbCommand, "Address1", DbType.String, address1);
            db.AddInParameter(dbCommand, "Address2", DbType.String, address2);
            db.AddInParameter(dbCommand, "City", DbType.String, city);
            db.AddInParameter(dbCommand, "StateProvince", DbType.String, stateProvince);
            db.AddInParameter(dbCommand, "ZipPostalCode", DbType.String, zipPostalCode);
            db.AddInParameter(dbCommand, "CountryID", DbType.Int32, countryId);
            db.AddInParameter(dbCommand, "Deleted", DbType.Boolean, deleted);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, createdOn);
            db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, updatedOn);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetWarehouseById(warehouseId);
            }

            return(item);
        }
예제 #2
0
        /// <summary>
        /// Updates the warehouse
        /// </summary>
        /// <param name="WarehouseID">The warehouse identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="PhoneNumber">The phone number</param>
        /// <param name="Email">The email</param>
        /// <param name="FaxNumber">The fax number</param>
        /// <param name="Address1">The address 1</param>
        /// <param name="Address2">The address 2</param>
        /// <param name="City">The city</param>
        /// <param name="StateProvince">The state/province</param>
        /// <param name="ZipPostalCode">The zip/postal code</param>
        /// <param name="CountryID">The country identifier</param>
        /// <param name="Deleted">A value indicating whether the entity has been deleted</param>
        /// <param name="CreatedOn">The date and time of instance creation</param>
        /// <param name="UpdatedOn">The date and time of instance update</param>
        /// <returns>Warehouse</returns>
        public override DBWarehouse UpdateWarehouse(int WarehouseID, string Name, string PhoneNumber, string Email, string FaxNumber,
                                                    string Address1, string Address2, string City, string StateProvince,
                                                    string ZipPostalCode, int CountryID, bool Deleted, DateTime CreatedOn, DateTime UpdatedOn)
        {
            DBWarehouse warehouse = null;
            Database    db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand   dbCommand = db.GetStoredProcCommand("Nop_WarehouseUpdate");

            db.AddInParameter(dbCommand, "WarehouseID", DbType.Int32, WarehouseID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "PhoneNumber", DbType.String, PhoneNumber);
            db.AddInParameter(dbCommand, "Email", DbType.String, Email);
            db.AddInParameter(dbCommand, "FaxNumber", DbType.String, FaxNumber);
            db.AddInParameter(dbCommand, "Address1", DbType.String, Address1);
            db.AddInParameter(dbCommand, "Address2", DbType.String, Address2);
            db.AddInParameter(dbCommand, "City", DbType.String, City);
            db.AddInParameter(dbCommand, "StateProvince", DbType.String, StateProvince);
            db.AddInParameter(dbCommand, "ZipPostalCode", DbType.String, ZipPostalCode);
            db.AddInParameter(dbCommand, "CountryID", DbType.Int32, CountryID);
            db.AddInParameter(dbCommand, "Deleted", DbType.Boolean, Deleted);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn);
            db.AddInParameter(dbCommand, "UpdatedOn", DbType.DateTime, UpdatedOn);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                warehouse = GetWarehouseByID(WarehouseID);
            }

            return(warehouse);
        }
예제 #3
0
        /// <summary>
        /// Gets a warehouse
        /// </summary>
        /// <param name="warehouseId">The warehouse identifier</param>
        /// <returns>Warehouse</returns>
        public override DBWarehouse GetWarehouseById(int warehouseId)
        {
            DBWarehouse item      = null;
            Database    db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand   dbCommand = db.GetStoredProcCommand("Nop_WarehouseLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "WarehouseID", DbType.Int32, warehouseId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetWarehouseFromReader(dataReader);
                }
            }
            return(item);
        }
예제 #4
0
        /// <summary>
        /// Gets all warehouses
        /// </summary>
        /// <returns>Warehouse collection</returns>
        public override DBWarehouseCollection GetAllWarehouses()
        {
            DBWarehouseCollection warehouseCollection = new DBWarehouseCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_WarehouseLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBWarehouse warehouse = GetWarehouseFromReader(dataReader);
                    warehouseCollection.Add(warehouse);
                }
            }

            return(warehouseCollection);
        }
예제 #5
0
        private DBWarehouse GetWarehouseFromReader(IDataReader dataReader)
        {
            var item = new DBWarehouse();

            item.WarehouseId   = NopSqlDataHelper.GetInt(dataReader, "WarehouseID");
            item.Name          = NopSqlDataHelper.GetString(dataReader, "Name");
            item.PhoneNumber   = NopSqlDataHelper.GetString(dataReader, "PhoneNumber");
            item.Email         = NopSqlDataHelper.GetString(dataReader, "Email");
            item.FaxNumber     = NopSqlDataHelper.GetString(dataReader, "FaxNumber");
            item.Address1      = NopSqlDataHelper.GetString(dataReader, "Address1");
            item.Address2      = NopSqlDataHelper.GetString(dataReader, "Address2");
            item.City          = NopSqlDataHelper.GetString(dataReader, "City");
            item.StateProvince = NopSqlDataHelper.GetString(dataReader, "StateProvince");
            item.ZipPostalCode = NopSqlDataHelper.GetString(dataReader, "ZipPostalCode");
            item.CountryId     = NopSqlDataHelper.GetInt(dataReader, "CountryID");
            item.Deleted       = NopSqlDataHelper.GetBoolean(dataReader, "Deleted");
            item.CreatedOn     = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            item.UpdatedOn     = NopSqlDataHelper.GetUtcDateTime(dataReader, "UpdatedOn");
            return(item);
        }