コード例 #1
0
        /// <summary>
        /// Provides the information for the InventoryWindow from the database
        /// </summary>
        /// <returns></returns>
        public ObservableCollection <clsItemsLogic> theInventory()
        {
            ObservableCollection <clsItemsLogic> inv = new ObservableCollection <clsItemsLogic>();

            try
            {
                int num = 0;
                ds = db.ExecuteSQLStatement(SQLQueries.SelectAllInventory(), ref num);
                for (int i = 0; i < num; i++)
                {
                    clsItemsLogic inventory = new clsItemsLogic();
                    inventory.InventoryLetter = ds.Tables[0].Rows[i][0].ToString();
                    inventory.ItemDesc        = ds.Tables[0].Rows[i][1].ToString();
                    inventory.ItemCost        = Convert.ToDecimal(ds.Tables[0].Rows[i][2].ToString());
                    inv.Add(inventory);
                }
            }
            catch (Exception ex)
            {
                //Just throw the exception
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }

            return(inv);
        }