Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e) //查询摊位信息
        {
            if (textBox1.Text == String.Empty)                 //输入不能为空
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            string stall_id = textBox1.Text.ToString();
            Stall  stall    = new Stall();

            if (stall.stallexist(stall_id))
            {
                sForm5_search_result f5 = new sForm5_search_result();
                bool result             = stall.showStall(stall_id);
                if (result)
                {
                    {
                        f5.Form5showStall(stall_id, stall.merchant_id, stall.staff_id, stall.area, stall.start_time, stall.end_time, stall.rent_money, stall.price);
                    }
                    this.Hide();
                    f5.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("failed");
                }
            }
            else
            {
                MessageBox.Show("该摊位不存在");
            }
        }
        private void button4_Click(object sender, EventArgs e) //保存更改
        {
            string   stall_id = textBox1.Text.ToString();
            Stall    stall    = new Stall();
            Merchant merchant = new Merchant();

            if (merchant.merchantexist(textBox2.Text.ToString()) && stall.staffexist(textBox3.Text.ToString()))
            {
                if (Convert.ToInt32(textBox3.Text) >= 600000 && Convert.ToInt32(textBox3.Text) <= 699999)
                {
                    bool result = stall.updateStall(stall_id, textBox2.Text.ToString(), textBox3.Text.ToString(), textBox4.Text.ToString(), textBox5.Text.ToString(), textBox6.Text.ToString(), textBox7.Text.ToString());
                    if (result)
                    {
                        stall.showStall(stall_id);
                        textBox1.Text = stall_id;
                        textBox2.Text = stall.merchant_id;
                        textBox3.Text = stall.staff_id;
                        textBox4.Text = stall.area;
                        textBox5.Text = stall.start_time;
                        textBox6.Text = stall.end_time;
                        textBox7.Text = stall.rent_money;
                        textBox8.Text = stall.price;
                        MessageBox.Show("sucessful");
                    }
                    else
                    {
                        MessageBox.Show("failed");
                    }
                }
                else
                {
                    MessageBox.Show("请输入摊位管理员工id");
                }
            }
            else
            {
                MessageBox.Show("请输入正确的商家和员工id");
            }
        }