using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Westwind.BusinessObjects;
using System.Collections.Generic;

namespace ScriptCallbacks.BusinessObjects
{
    public class CustomerEntity : CustomersRow
    {
        public CustomerEntity() : base() { }

        public PhoneNumber PhoneNumbers = new PhoneNumber();
        public OrdersRow[] Orders
        {
            get
            { return _Orders; }
            set { _Orders = value; }
        }
        private OrdersRow[] _Orders = null;
              
    
        public void LoadOrders()
        {
             busInvoice Invoice = new busInvoice();
             if (Invoice.GetInvoicesForCustomer(this.Customerid) < 1)
             {
                 this.Orders = null;
                 return;
             }

             List<OrdersRow> OrderList = new List<OrdersRow>();

             foreach (DataRow Row in Invoice.DataSet.Tables["TCustomerInvoiceList"].Rows)
             {
                 OrdersRow Order = new OrdersRow();
                 Westwind.Tools.wwDataUtils.CopyObjectFromDataRow(Row, Order);
                 OrderList.Add(Order);
             }
             this.Orders = OrderList.ToArray(); 
        }
    }

    public class PhoneNumber
    {
        public string HomePhone = "(503) 121-1212";
        public string WorkPhone = "(503) 333-1222";
        public DateTime Entered = DateTime.Now;
        public decimal Value = 123.12M;
        public bool Custom = true;
    }
}