internal void RemoveItemOrder(TableRow tableRow) { int i = 0; foreach (Item item in itemsOrdered) { if (item.GetName() == tableRow.GetContent(TableRow.TABLE_ORDER, TableRow.GET_ITEM_NAME)) { break; } else { i++; } } System.Diagnostics.Debug.WriteLine(itemsOrdered.Count()); itemsOrdered.RemoveAt(i); System.Diagnostics.Debug.WriteLine(itemsOrdered.Count()); }
private void ItemSelected(TableRow tableRow) { selectedRow = tableRow; TextBlock_ItemName.Text = tableRow.GetContent(TableRow.ADD_ITEM, TableRow.GET_ITEM_NAME); Button_DecreaseQty.IsEnabled = false; Button_IncreaseQty.IsEnabled = true; TextBlock_ItemQuantity.Text = "1"; Button_AddItem.IsEnabled = true; }
private void Table_Loaded(object sender, RoutedEventArgs e) { table = new Collection<TableRow>(); //Create Row Header TableRow tableRowHeader = new TableRow(TableRow.ADD_ITEM, 0); //Add Content / Text tableRowHeader.SetContent(TableRow.ADD_ITEM, "NO,ITEM,PRICE"); table.Add(tableRowHeader); //Special case for ITEM Header & ITEM Content left justification TextBlock[] itemTextBlocks = GetItemTextBlock(); foreach (TextBlock tb in itemTextBlocks) { tb.HorizontalAlignment = HorizontalAlignment.Left; tb.Padding = new Thickness(10, 0, 0, 0); } //Create 11 Row(s) for (int i = 1; i < 12; i++) { TableRow tableRow = new TableRow(TableRow.ADD_ITEM, i); table.Add(tableRow); } //InitializeUIElement InitializeUIElement(); }
internal void DeleteItemFromTableOrder(TableRow tableRow) { //remove item from TableOrder int tableNumber = Int32.Parse(fTableOrder.TextBlock_TableNum.Text.Replace("TABLE ", "")); TableOrder tableOrder = GetTableOrderFromTableNumber(tableNumber); tableOrder.RemoveItemOrder(tableRow); //UpdateUIElements fTableOrder.TableTableOrder.ConvertTableOrderToTableRow(tableOrder); fTableOrder.UpdateSumTaxTotal(tableOrder.GetSumTaxTotal()); fTableOrder.TogglePrintDraftButtonState(); if (tableOrder.GetItemsOrdered().Count < 1) { tableOrder.SetTableStatus(TableOrder.TABLE_EMPTY); } }
private void ItemSelected(TableRow tableRow) { Button_DeleteItem.IsEnabled = true; selectedTableRow = tableRow; }
internal void InitializeTable() { table = new Collection<TableRow>(); //Create Row Header TableRow tableRowHeader = new TableRow(TableRow.TABLE_ORDER, 0); //Add Content / Text tableRowHeader.SetContent(TableRow.TABLE_ORDER, "NO,ITEM,QTY,PRICE,SUBTOTAL"); table.Add(tableRowHeader); //Special case for ITEM Header & ITEM Content left justification TextBlock[] itemTextBlocks = GetItemTextBlock(); foreach (TextBlock tb in itemTextBlocks) { tb.HorizontalAlignment = HorizontalAlignment.Left; tb.Padding = new Thickness(10, 0, 0, 0); } //Create 11 Row(s) for (int i = 1; i < 12; i++) { TableRow tableRow = new TableRow(TableRow.TABLE_ORDER, i); table.Add(tableRow); } foreach (TableRow tableRow in table) { int rowIndex = tableRow.GetRowIndex(); int numberOfColumns = tableRow.GetColumnCount(); Border[,] border2D = GetBorder2D(); TextBlock[,] textBlock2D = GetTextBlock2D(); for (int column = 0; column < numberOfColumns; column++) { //Update Border (Background) border2D[rowIndex, column].Style = (Style)FindResource(tableRow.GetBackgroundStyle()); border2D[rowIndex, column].MouseLeftButtonDown += TableRow_Click; //Update TextBlock (Content) textBlock2D[rowIndex, column].Style = (Style)FindResource(tableRow.GetTextStyle()); textBlock2D[rowIndex, column].IsHitTestVisible = false; textBlock2D[rowIndex, column].Text = tableRow.GetContent(TableRow.TABLE_ORDER, column); } } }