Esempio n. 1
0
        public FormBill(List <MyItems> menuItems, Order order)
        {
            InitializeComponent();
            myItems = menuItems;
            data    = new DataClasses1DataContext();
            decimal toPay = 0;

            try
            {
                foreach (var item in menuItems)
                {
                    if (item.type.Equals("Dish"))
                    {
                        var result = (from dishDetail in data.DishDetails
                                      where dishDetail.Id == item.id
                                      select dishDetail).First();

                        listBoxOrder.Items.Insert(0, result.Dish.name + "\t\t" + (Convert.ToDecimal(result.Size.value) / 1000 + " L").Replace("0", string.Empty) + "\t" + result.Kind.text + "\t" + (result.price + " zł").Replace("000", string.Empty));
                        toPay += (decimal)result.price;
                    }
                    else
                    {
                        var result = (from drinkDetail in data.DrinkDetails
                                      where drinkDetail.Id == item.id
                                      select drinkDetail).First();

                        listBoxOrder.Items.Insert(0, result.Drink.name + "\t\t" + (Convert.ToDecimal(result.Size.value) / 1000 + " L").Replace("0", string.Empty) + "\t" + result.Kind.text + "\t" + (result.price + " zł").Replace("000", string.Empty));
                        toPay += (decimal)result.price;
                    }
                }


                labelSum.Text = (toPay + " zł").Replace("000", string.Empty);


                var result2 = from kind in data.Kinds
                              where kind.Id > 50
                              select new { kind.Id, kind.text };

                comboBoxKind.DisplayMember = "text";
                comboBoxKind.ValueMember   = "Id";
                comboBoxKind.DataSource    = result2;
                comboBoxKind.Enabled       = false;

                textBoxOrderDesc.Text = order.Description.decription;

                textBoxOrderDesc.Enabled = false;
                butAdd.Enabled           = false;
                butBack.Enabled          = false;
            }
            catch (Exception ex)
            {
                form1.lostConnection();
            }
        }
Esempio n. 2
0
        private void refresh()
        {
            try
            {
                var result = from size in data.Sizes
                             select size;

                dataGridSize.DataSource = result;
            }
            catch (Exception ex)
            {
                this.Close();
                form1.lostConnection();
            }
        }
Esempio n. 3
0
        private void refresh()
        {
            try
            {
                var result = from kind in data.Kinds
                             select kind;

                dataGridKind.DataSource = result;
            }
            catch (Exception ex)
            {
                this.Close();
                form1.lostConnection();
            }
        }
Esempio n. 4
0
        public FormDish(FormMain form)
        {
            try
            {
                InitializeComponent();
                formHandler = form;
                data        = new DataClasses1DataContext();

                loadDish();

                var result = from size in data.Sizes
                             where size.Id < 10
                             select new { Id = size.Id, text = size.text, value = size.value + " d(cm)" };


                comboBoxSize.DisplayMember = "value";
                comboBoxSize.ValueMember   = "Id";
                comboBoxSize.DataSource    = result;

                var result2 = from kind in data.Kinds
                              where kind.Id < 10
                              select new { Id = kind.Id, text = kind.text };

                comboBoxKind.DisplayMember = "text";
                comboBoxKind.ValueMember   = "Id";
                comboBoxKind.DataSource    = result2;
            }catch (Exception ex)
            {
                form.lostConnection();
            }
        }
Esempio n. 5
0
        public FormDrink(FormMain form)
        {
            try {
                InitializeComponent();
                formHandler = form;
                data        = new DataClasses1DataContext();

                loadDrink();

                var result = from size in data.Sizes
                             where size.Id > 10
                             select new { Id = size.Id, text = size.text, value = (Convert.ToDecimal(size.value) / 1000 + " L").Replace("0", string.Empty) };


                comboBoxSize.DisplayMember = "value";
                comboBoxSize.ValueMember   = "Id";
                comboBoxSize.DataSource    = result;

                var result2 = from kind in data.Kinds
                              where kind.Id > 10
                              select new { Id = kind.Id, text = kind.text };

                comboBoxKind.DisplayMember = "text";
                comboBoxKind.ValueMember   = "Id";
                comboBoxKind.DataSource    = result2;
            }
            catch (Exception ex)
            {
                formHandler.lostConnection();
            }
        }
Esempio n. 6
0
        private void loadDrink()
        {
            try {
                var result = from dish in data.Drinks
                             select new { dish.Id, dish.name, dish.Description.decription, dish.adults };

                dataGridDrink.DataSource = result;

                for (int i = 0; i < dataGridDrink.Columns.Count; i++)
                {
                    dataGridDrink.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
            }
            catch (Exception ex)
            {
                formHandler.lostConnection();
            }
        }