コード例 #1
0
        /// <summary>
        /// This function returns a list of clsItem object
        /// </summary>
        /// <returns></returns>
        public BindingList <clsItem> populateChooseItem()
        {
            try
            {
                DataSet ds   = new DataSet();
                int     iRet = 0;
                ds = db.ExecuteSQLStatement(SQLQueries.SelectAllItems(), ref iRet);

                BindingList <clsItem> ItemList = new BindingList <clsItem>();

                for (int i = 0; i < iRet; i++)
                {
                    clsItem Item = new clsItem();
                    Item.ItemCode = ds.Tables[0].Rows[i][0].ToString();
                    Item.ItemDesc = ds.Tables[0].Rows[i][1].ToString();
                    Item.Cost     = Convert.ToDecimal(ds.Tables[0].Rows[i][2].ToString());
                    ItemList.Add(Item);
                }
                return(ItemList);
            }
            catch (Exception ex)
            {
                //Just throw the exception
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }
        }