/// <summary> /// Contructor to initialize variables /// </summary> public clsItemsLogic() { try { //SQL logic for implementation. itemsSQL = new clsItemsSQL(); //Object to access sql statements //Lists need in implementation. lineItemsList = new List <clsLineItemsObj>(); //New list of line items objects. itemDescList = new List <clsItemDescObj>(); //New list of item description objects. invoicesConnectedToItem = new List <clsLineItemsObj>(); //Keep track of item connected to invoice //Populate Line items list with database rows. lineItemsList = itemsSQL.SelectLineItemData(); //Populate item Desc list with database rows. itemDescList = itemsSQL.SelectItemDescData(); } catch (Exception ex) { //This is the top level method so we want to handle the exception HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Check if item is in a invoice. /// </summary> /// <param name="sItemCode"></param> /// <returns>false if not found</returns> public bool CheckInvoiceData(string sItemCode) { try { //Populate Line items list with database rows. lineItemsList = itemsSQL.SelectLineItemData(); //Clear list of connected items to invoices invoicesConnectedToItem.Clear(); //Boolean to keep track if invoice is in invoice bool bIsItInInvoice = false; //Check list of Line items for (int i = 0; i < lineItemsList.Count; i++) { if (lineItemsList[i].sItemCode == sItemCode) { invoicesConnectedToItem.Add(lineItemsList[i]); bIsItInInvoice = true; } } return(bIsItInInvoice); } catch (Exception ex) { //This is the top level method so we want to handle the exception HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); return(false); } }