Exemple #1
0
        private void SummarizeOrderForm_Load(object sender, EventArgs e)
        {
            decimal orderValue = _orderHelpers.CalculateOrderValue(_appState.DishesInOrder);

            labelTotalPrice.Text = orderValue.ToString("c", new CultureInfo("PL"));
            dataGridViewDishesToOrder.DataSource = GetOrderedDishesToDisplay();
            dataGridViewDishesToOrder.Columns["Extras"].DefaultCellStyle.WrapMode = DataGridViewTriState.True;

            dataGridViewDishesToOrder.Columns["DishName"].HeaderText   = "Danie";
            dataGridViewDishesToOrder.Columns["Quantity"].HeaderText   = "Ilość";
            dataGridViewDishesToOrder.Columns["Extras"].HeaderText     = "Wybrane dodatki";
            dataGridViewDishesToOrder.Columns["TotalPrice"].HeaderText = "Cena";
            dataGridViewDishesToOrder.Columns["TotalPrice"].DefaultCellStyle.FormatProvider = new CultureInfo("PL");
            dataGridViewDishesToOrder.Columns["TotalPrice"].DefaultCellStyle.Format         = "c";


            var deleteButtonColumn = new DataGridViewButtonColumn
            {
                Name       = "dataGridViewDeleteButton",
                HeaderText = "Usuń z zamówienia",
                Text       = "X",
                UseColumnTextForButtonValue = true
            };

            dataGridViewDishesToOrder.Columns.Add(deleteButtonColumn);
        }
Exemple #2
0
        private void OnCurrentOrderChanged(object sender, NotifyCollectionChangedEventArgs args)
        {
            decimal orderValue = _orderHelpers.CalculateOrderValue(_appState.DishesInOrder);

            labelCurrentValue.Text = orderValue.ToString("c", new CultureInfo("PL"));
        }