Exemple #1
0
        public void CustomizeAddDone()
        {
            int numberOfTable = selectedTable.NumberOfTable;

            IUsedTable fullTable       = Factory.InstanceUsedTable();
            IProduct   modifiedProduct = Factory.InstanceProduct();

            modifiedProduct.Id         = ((IProduct)productsListBox.SelectedItem).Id;
            modifiedProduct.Category   = ((IProduct)productsListBox.SelectedItem).Category;
            modifiedProduct.CategoryId = ((IProduct)productsListBox.SelectedItem).CategoryId;
            modifiedProduct.Name       = ((IProduct)productsListBox.SelectedItem).Name;
            modifiedProduct.Price      = newFormCustomize.productInForm.Price;
            modifiedProduct.Detail     = newFormCustomize.productInForm.Detail;

            fullTable = tablesInUse.Where(x => x.NumberOfTable == numberOfTable).FirstOrDefault();

            tablesInUse.Remove(fullTable);

            for (int i = 0; i < newFormCustomize.ammount; i++)
            {
                fullTable.Products.Add(modifiedProduct);
            }

            fullTable.ShowOccupied = "Occupied";

            tablesInUse.Add(fullTable);

            tablesListBox.DataSource    = null;
            tablesListBox.DataSource    = fullTable.Products;
            tablesListBox.DisplayMember = "DisplayText";

            payAllButton.Enabled     = true;
            payPartialButton.Enabled = true;
        }
Exemple #2
0
        private void removeItemButton_Click(object sender, EventArgs e)
        {
            if (tablesListBox.SelectedItem is IProduct)
            {
                int numberOfTable = selectedTable.NumberOfTable;

                IUsedTable fullTable = Factory.InstanceUsedTable();

                fullTable = tablesInUse.Where(x => x.NumberOfTable == numberOfTable).FirstOrDefault();

                tablesInUse.Remove(fullTable);
                fullTable.Products.Remove((IProduct)tablesListBox.SelectedItem);

                if (fullTable.Products.Count == 0)
                {
                    payAllButton.Enabled     = false;
                    payPartialButton.Enabled = false;
                    removeItemButton.Enabled = false;
                    (tables.Where(x => x.NumberOfTable == numberOfTable).FirstOrDefault()).ShowOccupied = "";
                }
                else
                {
                    tablesInUse.Add(fullTable);
                }

                tablesListBox.DataSource    = null;
                tablesListBox.DataSource    = fullTable.Products;
                tablesListBox.DisplayMember = "DisplayText";
            }
        }
Exemple #3
0
        private void tablesListBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (tablesListBox.SelectedItem is ITable)
            {
                selectedTable = (ITable)tablesListBox.SelectedItem;

                tablesListBox.DataSource = null;

                if (tablesInUse.Where(x => x.NumberOfTable == selectedTable.NumberOfTable).FirstOrDefault() == null)
                {
                    IUsedTable fullTable = Factory.InstanceUsedTable();
                    fullTable.Id            = selectedTable.Id;
                    fullTable.NumberOfTable = selectedTable.NumberOfTable;
                    fullTable.ShowOccupied  = selectedTable.ShowOccupied;
                    fullTable.Area          = selectedTable.Area;
                    fullTable.AreaId        = selectedTable.AreaId;

                    tablesInUse.Add(fullTable);
                }

                tablesListBox.DataSource    = tablesInUse.Where(x => x.NumberOfTable == selectedTable.NumberOfTable).FirstOrDefault().Products;
                tablesListBox.DisplayMember = "DisplayText";

                if (productsListBox.Items.Count > 0)
                {
                    addButton.Enabled       = true;
                    customizeButton.Enabled = true;
                }

                if (tablesListBox.SelectedItem is IProduct)
                {
                    removeItemButton.Enabled = true;
                }
            }
        }
Exemple #4
0
        public void SendData(IUsedTable table)
        {
            tableActual = table;

            tablePartial.Id            = table.Id;
            tablePartial.NumberOfTable = table.NumberOfTable;
            tablePartial.AreaId        = table.AreaId;

            UpdateLists();
        }
Exemple #5
0
        private void payPartialButton_Click(object sender, EventArgs e)
        {
            int numberOfTable = selectedTable.NumberOfTable;

            IUsedTable table = tablesInUse.Where(x => x.NumberOfTable == numberOfTable).FirstOrDefault();

            newFormPayPartial = new PayPartial(this);
            newFormPayPartial.SendData(table);
            newFormPayPartial.FormBorderStyle = FormBorderStyle.FixedDialog;
            newFormPayPartial.MaximizeBox     = false;
            newFormPayPartial.MinimizeBox     = false;
            newFormPayPartial.StartPosition   = FormStartPosition.CenterScreen;
            newFormPayPartial.ShowDialog();
        }
Exemple #6
0
        public void SendData(IUsedTable table)
        {
            decimal total = 0;

            this.tableActual = table;

            foreach (Product product in table.Products)
            {
                total += product.Price;
            }

            totalListBox.DataSource    = null;
            totalListBox.DataSource    = table.Products;
            totalListBox.DisplayMember = "DisplayText";

            totalValueBox.Text = $"{total:C}";
        }
Exemple #7
0
        private void addButton_Click(object sender, EventArgs e)
        {
            int numberOfTable = selectedTable.NumberOfTable;

            IUsedTable fullTable = Factory.InstanceUsedTable();

            fullTable = tablesInUse.Where(x => x.NumberOfTable == numberOfTable).FirstOrDefault();

            tablesInUse.Remove(fullTable);
            fullTable.Products.Add((IProduct)productsListBox.SelectedItem);

            fullTable.ShowOccupied = "Occupied";
            tables.Where(x => x.Id == fullTable.Id).FirstOrDefault().ShowOccupied = "Occupied";

            tablesInUse.Add(fullTable);

            tablesListBox.DataSource    = null;
            tablesListBox.DataSource    = fullTable.Products;
            tablesListBox.DisplayMember = "DisplayText";

            payAllButton.Enabled     = true;
            payPartialButton.Enabled = true;
        }