/// <summary> /// checkInvoices checks all invoices to see if the item exists in any of the invoices /// </summary> public bool checkInvoices(Item item, clsItemsLogic itemsLogic) { try { ObservableCollection <clsInvoices> invoicesList = new ObservableCollection <clsInvoices>(); ObservableCollection <clsInvoices> itemsList = new ObservableCollection <clsInvoices>(); clsMainSQL mainSQL = new clsMainSQL(); bool itemExistsInInvoices = false; string sSQL; int iRet = 0; //Number of return values int iRet2 = 0; //Number of return values int result = 0; DataSet ds = new DataSet(); //Holds the return values DataSet ds2 = new DataSet(); //Holds the return values //Create the SQL statement to extract the invoices sSQL = mainSQL.SelectInvoiceNumAndCostOnDate(); // sql statement to get all current invoices //Extract the invoices and put them into the DataSet ds = db.ExecuteSQLStatement(sSQL, ref iRet); //Loop through the data and create an Invoice class for (int i = 0; i < iRet; i++) //for the length of all invoices { sSQL = mainSQL.SelectLineItemsOnInvoiceNum(ds.Tables[0].Rows[i][0] .ToString()); //grab the current invoice and select all the items within the invoice ds2 = db.ExecuteSQLStatement(sSQL, ref iRet2); for (int j = 0; j < iRet2; j++) //for the length of items { if (ds2.Tables[0].Rows[j][0].ToString() == item.itemCode ) //if our item code matches the current item selected, return true { itemsLogic.invoicesWithItemToDelete.Add(ds.Tables[0].Rows[i][0].ToString()); itemExistsInInvoices = true; } } } if (itemExistsInInvoices) { return(true); } else { return(false); } return(false); } catch (Exception ex) { throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + "->" + ex.Message); } }
/// <summary> /// wndEditItem is the edit item window /// </summary> public wndEditItem(clsItemsLogic itemsLogic) { try { InitializeComponent(); this.itemsLogic = itemsLogic; } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// wndItems is our window for Items /// </summary> public wndItems() { try { InitializeComponent(); itemsLogic = new clsItemsLogic(); itemsDataGrid.ItemsSource = itemsLogic.getItems();//populate the datagrid with the items returned from getItems() } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Constructor for item window /// </summary> public wndItems() { try { InitializeComponent(); itemsLogic = new clsItemsLogic(); selectedItem = null; //Starting Mode RefreshUI(); } catch (Exception ex) { HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name, MethodInfo.GetCurrentMethod().Name, ex.Message); } }
/// <summary> /// Constructor for Window Items. /// </summary> public wndItems() { try { InitializeComponent(); // initialize the clsSearchLogic class itemsLogic = new clsItemsLogic(); //Load all the items into data grid dgLineItems.ItemsSource = itemsLogic.itemDescListGet; } 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); } }
public wndItems() { InitializeComponent(); try { //Initialize objects to access respective classes itemsLogic = new clsItemsLogic(); itemsSQL = new clsItemsSQL(); DA = new clsDataAccess(); LineItem = itemsLogic.GetLineItems(itemsSQL.GetLineItems()); FillBox(); } catch (Exception ex) { //Just throw the exception throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message); } }
/// <summary> /// wndAddItem is the add item window /// </summary> public wndAddItem(clsItemsLogic itemsLogic) { InitializeComponent(); this.itemsLogic = itemsLogic; }