public static ObservableCollection<cls_Invoice> GetData() { ObservableCollection<cls_Invoice> list = new ObservableCollection<cls_Invoice>(); cls_Customer customer = new cls_Customer("Bob", 27); cls_Product product = new cls_Product(14, "Bike", 85.63); DateTime date = new DateTime(2015,12,1); cls_Invoice invoice = new cls_Invoice(1,customer, product, date); list.Add(invoice); customer = new cls_Customer("Tom", 85); product = new cls_Product(10, "Snowboard", 105.99); date = new DateTime(2015, 11, 30); invoice = new cls_Invoice(2, customer, product, date); list.Add(invoice); customer = new cls_Customer("Jared", 10); product = new cls_Product(17, "Kyak", 242.13); date = new DateTime(2015, 11, 22); invoice = new cls_Invoice(3, customer, product, date); list.Add(invoice); return list; }
/// <summary> /// Constructs an invoice with multiple products /// </summary> /// <param name="cus">Customer</param> /// <param name="prodList">List of Products Purchased</param> public cls_Invoice(int id, cls_Customer cust, List<cls_Product> prodList, DateTime d) { try { i_invId = id; customer = cust; productList = prodList; date = d; } catch (Exception ex) { //Just throw the exception throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }