/// <summary> /// Runs the provided SQL string and fills the Line Items List with the results. /// </summary> /// <param name="sSQL"></param> /// <returns></returns> public List <clsLineItems> GetLineItems(string sSQL) { try { DataSet ds = new DataSet(); List <clsLineItems> result = new List <clsLineItems>(); clsLineItems LineItem; int numRows = 0; ds = da.ExecuteSQLStatement(sSQL, ref numRows); for (int i = 0; i < numRows; i++) { LineItem = new clsLineItems(); LineItem.InvoiceNum = Convert.ToInt32(ds.Tables[0].Rows[i][0]); LineItem.LineItemNum = Convert.ToInt32(ds.Tables[0].Rows[i][1]); LineItem.ItemCode = ds.Tables[0].Rows[i][2].ToString(); result.Add(LineItem); } return(result); } catch (Exception ex) { //Just throw the exception throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// Runs SQL to Get Invoice Items through the LineItems DB /// </summary> /// <param name="invoiceNum"></param> /// <returns></returns> public List <clsLineItems> getInvoiceItems(string invoiceNum) { try { DataSet ds = new DataSet(); int iRef = 0; var query = sql.SelectLineItems(invoiceNum); lineItemsResult = new List <clsLineItems>(); ds = db.ExecuteSQLStatement(query, ref iRef); clsLineItems li; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { li = new clsLineItems(); li.InvoiceNum = Convert.ToInt32(ds.Tables[0].Rows[i][0]); li.LineItemNum = Convert.ToInt32(ds.Tables[0].Rows[i][1]); li.ItemCode = ds.Tables[0].Rows[i][2].ToString(); lineItemsResult.Add(li); } } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } return(lineItemsResult); }