Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     Form2.Form1 form1 = new Form2.Form1();
     form1.ShowDialog();
     if (form1.DialogResult == DialogResult.OK)
     {
         //Order m = form1.returnOrder();
         //b.addOrder(form1.returnOrder());
         form1.Dispose();
         Order m = new Order(form1.textBox1.Text, form1.textBox2.Text, form1.textBox3.Text, form1.textBox4.Text, form1.textBox6.Text, form1.textBox5.Text);
         b.addOrder(m);
         this.orderServiceBindingSource1.DataSource = new BindingList <Order>(b.orderList);
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form2.Form1 form1 = new Form2.Form1();
            form1.ShowDialog();
            int t = 1;

            while (t == 1)
            {
                t = 0;
                if (form1.DialogResult == DialogResult.OK)
                {
                    //Order m = form1.returnOrder();
                    //b.addOrder(form1.returnOrder());
                    foreach (Order c in b.orderList)
                    {
                        if (c.orderNum == form1.textBox1.Text)
                        {
                            t = 1; break;
                        }
                    }
                    if (t == 0)
                    {
                        form1.Dispose();
                        Order m = new Order(form1.textBox1.Text, form1.textBox2.Text, form1.textBox3.Text, form1.textBox7.Text, form1.textBox4.Text, form1.textBox6.Text, form1.textBox5.Text);
                        b.addOrder(m);
                        this.orderServiceBindingSource1.DataSource = new BindingList <Order>(b.orderList);
                    }
                    else
                    {
                        Error.Form1 formn = new Error.Form1();
                        formn.label1.Text = "订单号重复,请重新输入";
                        formn.ShowDialog();
                        if (formn.DialogResult == DialogResult.OK)
                        {
                            form1.textBox1.Text = "";
                            form1.ShowDialog();
                        }
                    }
                }
            }
        }