Esempio n. 1
0
        internal void Button_AddItem_Click(object sender, RoutedEventArgs e)
        {
            String itemDetails = "";

            itemDetails += TextBlock_ItemName.Text + "," + TextBlock_ItemQuantity.Text + "," +
                           selectedRow.GetContent(TableRow.ADD_ITEM, TableRow.GET_ITEM_PRICE);

            addItemButtonClicked(itemDetails); //itemName,itemQuantity,itemPrice
        }
Esempio n. 2
0
 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;
 }
        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);
                }
            }
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        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());

        }
Esempio n. 6
0
        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;

        }
        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);
                }
            }

        }