Exemple #1
0
        public List <OrderLine> FindOrderLines(int orderNo)
        {
            List <OrderLine> orderLines = new List <OrderLine>();

            try
            {
                using (SqlConnection con = dBConnection.OpenConnection())
                {
                    SqlCommand command = new SqlCommand(FIND_ORDERLINES, con);
                    command.Parameters.AddWithValue("o_id", orderNo);
                    SqlDataReader dr        = command.ExecuteReader();
                    DBProduct     dBProduct = new DBProduct();
                    while (dr.Read())
                    {
                        OrderLine orderLine = new OrderLine();
                        orderLine.Product = dBProduct.FindProduct(dr.GetInt("pr_id"));
                        orderLines.Add(orderLine);
                    }
                }
                return(orderLines);
            }
            catch (TransactionAbortedException)
            {
            }
            return(null);
        }