Пример #1
0
        private void InSertButton_Click(object sender, EventArgs e)
        {
            int count = 0;

            listView2.Items.Clear();
            foreach (ListViewItem var in listView1.Items)
            {
                if (var.Selected)
                {
                    count += 1;
                }
            }
            if (count == 1)
            {
                InsertFoodNum isys = new InsertFoodNum(this);
                isys.ShowDialog();
                waiter.MyOrder.InsertOrder(listView1, listView2, num, textBox2.Text);
            }
            else
            {
                MessageBox.Show("请选择菜品");
            }
            float Count;
            float Fprice;
            float Sum = 0;

            foreach (ListViewItem var in listView2.Items)
            {
                float.TryParse(var.SubItems[2].Text, out Fprice);
                float.TryParse(var.SubItems[3].Text, out Count);
                Sum += Count * Fprice;
            }
            textBox1.Text = Sum.ToString();
        }
Пример #2
0
        private void InSertButton_Click(object sender, EventArgs e)
        {
            int count = 0;

            listView2.Items.Clear();
            foreach (ListViewItem var in listView1.Items)
            {
                if (var.Selected)
                {
                    count += 1;
                }
            }
            if (count == 1)
            {
                InsertFoodNum isys = new InsertFoodNum(this);
                isys.ShowDialog();
                waiter.MyOrder.InsertOrder(listView1, listView2, num, textBox2.Text);
            }
            else
            {
                MessageBox.Show("请选择菜品");
            }
        }