/// <summary> /// Check to see if new item is duplicate item code. /// </summary> /// <param name="sItemCode"></param> /// <returns></returns> public bool CheckItemData(string sItemCode) { try { //Populate Line items list with database rows. itemDescList = itemsSQL.SelectItemDescData(); //Check list of Line items for (int i = 0; i < itemDescList.Count; i++) { if (itemDescList[i].sItemCode == sItemCode) { //Item code matches a item in list return(true); } } return(false); } 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); } }
/// <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); } }