コード例 #1
0
        /// <summary>
        /// gets all the invoices()
        /// </summary>
        /// <returns></returns>
        public List <clsLineItems> ListItems()
        {
            try
            {
                List <clsLineItems> lstItems = new List <clsLineItems>();

                int rows = 0;

                DataSet rawdata = db.ExecuteSQLStatement(Query.GetItems(), ref rows);


                for (int x = 0; x < rows; x++)
                {
                    Double.TryParse(rawdata.Tables[0].Rows[x][2].ToString(), out double total);

                    lstItems.Add(new clsLineItems
                    {
                        ItemCode = rawdata.Tables[0].Rows[x][0].ToString(),
                        ItemDesc = rawdata.Tables[0].Rows[x][1].ToString(),
                        Cost     = total
                    });
                }

                return(lstItems);
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType + "." +
                                    MethodInfo.GetCurrentMethod().Name + "->" + ex.Message);
            }
        }
コード例 #2
0
ファイル: clsItemsSQL.cs プロジェクト: AlexHamlet/CS3280Group
        /// <summary>
        /// get the items table for the dattagrid
        /// </summary>
        /// <returns>table from database</returns>
        public DataSet GetItems()
        {
            try
            {
                SQL = "SELECT * FROM ItemDesc";

                return(db.ExecuteSQLStatement(SQL, ref rows));
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }
        }