/// <summary> /// Returns a list of all of the invoices in the database /// </summary> /// <returns></returns> public ObservableCollection <clsMainLogic> GetInvoices() { ObservableCollection <clsMainLogic> result = new ObservableCollection <clsMainLogic>(); try { int iRet = 0; DataSet ds = dataAccess.ExecuteSQLStatement(sql.SelectAllInvoices(), ref iRet); for (int i = 0; i < iRet; ++i) { clsMainLogic invoice = new clsMainLogic(); invoice.InvoiceNum = Convert.ToInt32(ds.Tables[0].Rows[i][0].ToString()); invoice.InvoiceDate = Convert.ToDateTime(ds.Tables[0].Rows[i][1].ToString()); invoice.TotalCharge = Convert.ToDecimal(ds.Tables[0].Rows[i][2].ToString()); result.Add(invoice); } } catch (Exception ex) { //Just throw the exception throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } return(result); }