Order Object RRS feed

  • Question

  • User-1204164177 posted

    HelloThe e-commerce site I am creating is composed of the following layers...WEB, BLL, DAL, BUSINESSENTITIES....

    I have a business entity class for creating an orderline.. and a seperate class for creating an order header... this is fine for when im creating orders...

    but when i want to pull orders out of my database, I want to create an order object, ie orderlines and order header in one object?

    how can i do this?

    Any help would be appriciated


    Saturday, December 5, 2009 8:09 PM

All replies

  • User78336405 posted


    Maybe this will help you:http://communities.progress.com/pcom/thread/14698 

    Sunday, December 6, 2009 8:45 PM
  • User-455638226 posted

    You can use aggregation by having a new class with your order header class and order line class as member variables.



    Tim Robson
    Comm100, Microsoft Gold Certified Partner


    Tuesday, January 5, 2010 12:09 AM
  • User854688209 posted

    As you are trying to create object based on the data fetched from the database.  Factory pattern should resolve the issue.


    Refer below link to know about factory pattern


    Wednesday, January 6, 2010 2:06 PM
  • User-1067358373 posted

    Add a new property called OrderLineItems to your Order Header class

    public List<OrderLineItems> LineItems


    Now in you DAL class

    read each OrderLine Item, add it to a list and finally set the LineItems property of the header object

    Friday, January 8, 2010 4:12 PM
  • User-952121411 posted

    You could create a new class named 'Order' that contains a List(of OrderLines) and a reference to an OrderHeader as well.  Take a look at the basic code below:

    ''' <summary>
    ''' This class contains a list of Orlderlines and an associated OrderHeader
    ''' </summary>
    Public Class Order
        Private mOrderLines As List(Of OrderLine)
        Private mHeader As OrderHeader
        Public Property OrderLines() As List(Of OrderLine)
                Return mOrderLines
            End Get
            Set(ByVal value As List(Of OrderLine))
                mOrderLines = value
            End Set
        End Property
        Public Property Header() As OrderHeader
                Return mHeader
            End Get
            Set(ByVal value As OrderHeader)
                mHeader = value
            End Set
        End Property
    End Class
    Public Class OrderLine
    End Class
    Public Class OrderHeader
    End Class


    Tuesday, January 12, 2010 9:48 AM