Beispiel #1
0
        private void LoadItems(Order order)
        {
            string     sql     = @"select * from Items where orderId = @orderId";
            SqlCommand command = new SqlCommand(sql, connection);

            command.Parameters.AddWithValue("@orderId", order.Id);
            IDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                string  sku      = reader["sku"].ToString();
                int     quantity = Convert.ToInt32(reader["quantity"]);
                Product product  = productGateway.Find(sku);
                order.AddItem(product, quantity);
            }
        }