/// <summary> /// Method for getting all Items in ItemsDesc table /// </summary> /// <returns>Observable Collection of Item objects</returns> public ObservableCollection <clsItem> getItems() { try { string sSQL = clsSQL.GetAllItems(); int iRet = 0; ds = clsDA.ExecuteSQLStatement(sSQL, ref iRet); ObservableCollection <clsItem> ItemList = new ObservableCollection <clsItem>(); foreach (DataRow dr in ds.Tables[0].Rows) { ItemList.Add(new clsItem { sItemCode = dr[0].ToString(), sItemDesc = dr[1].ToString(), sCost = dr[2].ToString() }); } return(ItemList); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " ->" + ex.Message); } }
/// <summary> /// Default Constructor /// </summary> public clsItemsLogic() { try { SQL = new clsItemsSQL(); //Initialize the items collection to all the items _Items = SQL.GetAllItems(); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// Refreshes the items in the Item Collection /// </summary> public void RefreshItems() { try { _Items.Clear(); foreach (Item i in SQL.GetAllItems()) { _Items.Add(i); } } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }