コード例 #1
0
ファイル: clsItemsSQL.cs プロジェクト: AlexHamlet/CS3280Group
 /// <summary>
 /// add items to the itemdesc table
 /// </summary>
 /// <param name="cost"></param>
 /// <param name="desc"></param>
 public void AddItems(int cost, string desc)
 {
     try
     {
         SQL = "INSERT INTO ItemDesc (ItemDesc, Cost) " +
               "VALUES ('" + desc + "', " + cost + ")";
         int test = db.ExecuteNonQuery(SQL);
     }
     catch (Exception ex)
     {
         throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
     }
 }
コード例 #2
0
        /// <summary>
        /// creates a new invoice
        /// </summary>
        /// <param name="date"></param>
        /// <param name="Line"></param>
        public int CreateInvoice(string date, string cost, List <clsLineItems> lstItems)
        {
            try
            {
                db.ExecuteNonQuery(Query.CreateInvoice(date, cost));


                Int32.TryParse(db.ExecuteScalarSQL(Query.GetInsertedInvoiceId(date, cost)), out int id);
                InsertLineItems(id, lstItems);
                return(id);
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType + "." +
                                    MethodInfo.GetCurrentMethod().Name + "->" + ex.Message);
            }
        }