Exemplo n.º 1
0
        private void ShowPosition(string details, int index)
        {
            Order o = GetOrder(details);

            listBox7.Items.Clear();
            MenuPosition pos = o.Content[index];

            if (pos is Pizza)
            {
                Pizza pp = pos as Pizza;
                foreach (var i in pp.Ingredients)
                {
                    listBox7.Items.Add(i.Name);
                }
            }
            else if (pos is OtherFood)
            {
                OtherFood po = pos as OtherFood;
                foreach (var i in po.Ingredients)
                {
                    listBox7.Items.Add(i.Name);
                }
            }
            else
            {
                Drink d = pos as Drink;
                listBox7.Items.Add(d.Name + " " + d.Volume + "л.");
            }
        }
Exemplo n.º 2
0
        private void ShowMenuPositionEd(MenuPosition mPos)
        {
            Drink     ad = mPos as Drink;
            OtherFood ao = mPos as OtherFood;
            Pizza     ap = mPos as Pizza;

            if (ad != null)
            {
                textBox1.Text        = ad.Name;
                textBox2.Text        = ad.Cost.ToString() + " руб.";
                textBox4.Text        = ad.Volume.ToString() + " л.";
                radioButton2.Checked = true;
            }
            else if (ao != null)
            {
                textBox1.Text        = ao.Name;
                textBox2.Text        = ao.Cost.ToString() + " руб.";
                richTextBox1.Text    = GetTextIngrs(ao.Ingredients);
                textBox3.Text        = ao.RequiredTime + " мин.";
                radioButton3.Checked = true;
            }
            else if (ap != null)
            {
                textBox1.Text        = ap.Name;
                textBox2.Text        = ap.Cost.ToString() + " руб.";
                richTextBox1.Text    = GetTextIngrs(ap.Ingredients);
                textBox3.Text        = ap.RequiredTime + " мин.";
                radioButton1.Checked = true;
            }
        }
Exemplo n.º 3
0
        private void AddNewMenuPos(Menu menu)
        {
            MenuPosition p     = null;
            Form2        form2 = new Form2(PyroPizza);

            form2.ShowDialog();
            p = form2.GetNewPos();
            if (p != null)
            {
                PyroPizza.menu.Add(p);
                LoadMenu(PyroPizza, menus);
                //  listBox1.Items.Add(PyroPizza.menu.Content.Last().Name);
            }
        }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            MenuPosition ai = obj as MenuPosition;

            if (ai == null)
            {
                return(false);
            }
            else if (ai.Cost == Cost && ai.Name == Name)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            double cost;

            if (!Double.TryParse(textBox2.Text, out cost))
            {
                ShowError("Стоимость введена неверно"); return;
            }

            if (radioButton1.Checked)
            {
                if (!CheckFields())
                {
                    return;
                }
                newPos = GeNewPizza(cost);
            }
            else if (radioButton2.Checked)
            {
                if (textBox7.Text == "")
                {
                    ShowError("Введите объем"); return;
                }
                if (textBox1.Text == "")
                {
                    ShowError("Введите название"); return;
                }
                double volume;
                if (!Double.TryParse(textBox7.Text, out volume))
                {
                    ShowError("Объем введен неверно"); return;
                }
                newPos = GeNewDrink(cost, volume);
            }
            else if (radioButton3.Checked)
            {
                if (!CheckFields())
                {
                    return;
                }
                newPos = GeNewOther(cost);
            }

            this.Close();
        }
Exemplo n.º 6
0
        private void AddNewRandPosition(Menu menu)
        {
            MenuPosition mPos = GetRandomPos();

            menu.Add(mPos);
        }
Exemplo n.º 7
0
 public void Add(MenuPosition menuPosition)
 {
     Content.Add(menuPosition);
     menuPosition.SetIndex(count);
     count++;
 }