Beispiel #1
0
        /// <summary>
        /// This method gets all of the items from the
        /// database and passes them back to the UI in a list
        /// </summary>
        /// <returns></returns>
        public List <Item> getItems()
        {
            // initialize variables
            DataSet ds;
            int     iRef = 0;

            items = new List <Item>();

            // call SQL statement
            ds = clsDataAccess.ExecuteSQLStatement(clsItemsSQL.SelectItemCodeDescCost(), ref iRef);

            // loop through and add items to item list
            for (int i = 0; i < iRef; i++)
            {
                Item temp = new Item()
                {
                    itemCode = ds.Tables[0].Rows[i].ItemArray[0].ToString(),
                    itemDesc = ds.Tables[0].Rows[i].ItemArray[1].ToString(),
                    itemCost = ds.Tables[0].Rows[i].ItemArray[2].ToString()
                };

                items.Add(temp);
            }

            // return items
            return(items);
        }