/// <summary> /// Populates the DataGrid that holds all the items in inventory. /// Calls a sql method to return all items and returns a dataset of all items /// </summary> public void populateItemList() { try { DataSet ds = itemDao.getAllItems(sql.getAllItems()); int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { Item tempItem = new Item(); tempItem.Item_Code = dr["ItemCode"].ToString(); tempItem.Item_Description = dr["ItemDesc"].ToString(); tempItem.Item_Cost = "$" + dr["Cost"].ToString(); itemList.Add(tempItem); i++; } itemsDataGrid.ItemsSource = itemList; } catch (Exception e) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + e.Message); } }