private void button4_Click(object sender, EventArgs e)  //保存信息
        {
            Merchant merchant = new Merchant();
            Stall    stall    = new Stall();

            if (stall.staffexist(textBox2.Text.ToString()))
            {
                if (Convert.ToInt32(textBox2.Text.ToString()) >= 700000 && Convert.ToInt32(textBox2.Text.ToString()) <= 799999)
                {
                    bool result = merchant.addMerchant(textBox2.Text.ToString(), textBox3.Text.ToString(), textBox4.Text.ToString());
                    if (result)
                    {
                        textBox1.Text = merchant.merchant_id;
                    }
                    else
                    {
                        MessageBox.Show("failed");
                    }
                }
                else
                {
                    MessageBox.Show("请输入商家管理员工id");
                }
            }
            else
            {
                MessageBox.Show("请输入正确的员工id");
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            string   merchant_id = textBox1.Text.ToString();
            Merchant merchant    = new Merchant();
            Stall    stall       = new Stall();

            if (stall.staffexist(textBox2.Text.ToString()))
            {
                if (Convert.ToInt32(textBox2.Text) >= 700000 && Convert.ToInt32(textBox2.Text) <= 799999)
                {
                    bool result = merchant.updateMerchant(merchant_id, textBox2.Text.ToString(), textBox3.Text.ToString(), textBox4.Text.ToString());
                    if (result)
                    {
                        merchant.showMerchant(merchant_id);
                        textBox1.Text = merchant_id;
                        textBox2.Text = merchant.staff_id;
                        textBox3.Text = merchant.name;
                        textBox4.Text = merchant.phone_number;
                        MessageBox.Show("sucessful");
                    }
                    else
                    {
                        MessageBox.Show("failed");
                    }
                }
                else
                {
                    MessageBox.Show("请输入商家管理员工id");
                }
            }
            else
            {
                MessageBox.Show("请输入正确的员工id");
            }
        }
        private void button4_Click(object sender, EventArgs e)      //保存更改
        {
            string    warehouse_id = textBox1.Text;
            Merchant  merchant     = new Merchant();
            Stall     stall        = new Stall();
            Warehouse warehouse    = Warehouse.instance;

            if (merchant.merchantexist(textBox5.Text) == false)
            {
                MessageBox.Show("请输入正确的商家id");
                return;
            }
            if (Convert.ToInt32(textBox6.Text) >= 500000 && Convert.ToInt32(textBox2.Text) <= 599999)
            {
                if (stall.staffexist(textBox6.Text) == false)
                {
                    MessageBox.Show("请输入正确的员工id");
                    return;
                }
            }
            else
            {
                MessageBox.Show("该员工ID无法管理仓库,请输入正确的员工ID");
                return;
            }
            bool result = warehouse.UpdateAnEntry(warehouse_id, Convert.ToDouble(textBox2.Text), Convert.ToDouble(textBox3.Text), Convert.ToDouble(textBox4.Text), textBox5.Text, textBox6.Text);

            if (result)
            {
                warehouse.SearchAnEntryByID(warehouse_id);
                textBox1.Text = warehouse_id;
                textBox2.Text = warehouse.area.ToString();
                textBox3.Text = warehouse.full_capacity.ToString();
                textBox4.Text = warehouse.left_capacity.ToString();
                textBox5.Text = warehouse.merchant_id;
                textBox6.Text = warehouse.staff_id;
                MessageBox.Show("sucessful");
            }
            else
            {
                MessageBox.Show("failed");
            }
        }
        private void button6_Click(object sender, EventArgs e)   //划归员工
        {
            if (textBox9.Text == String.Empty)
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            Stall stall = new Stall();

            if (stall.staffexist(textBox9.Text) == false)
            {
                MessageBox.Show("请输入正确的员工ID!");
                return;
            }
            DataSet ds = new DataSet();

            ds = warehouse.SearchByStaffID(textBox9.Text);
            dataGridView1.DataSource = ds;
            dataGridView1.DataMember = "warehouse";
        }
        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");
            }
        }
示例#6
0
        private void button6_Click(object sender, EventArgs e)   //员工ID
        {
            DataSet ds    = new DataSet();
            Stall   stall = new Stall();

            if (stall.staffexist(textBox9.Text.ToString()))
            {
                if (Convert.ToInt32(textBox9.Text.ToString()) >= 600000 && Convert.ToInt32(textBox9.Text.ToString()) <= 699999)
                {
                    ds = stall.selectStallwithStaff_id(textBox9.Text.ToString());
                    dataGridView1.DataSource = ds;
                    dataGridView1.DataMember = "stall";
                }
                else
                {
                    MessageBox.Show("请输入摊位部门的员工id");
                }
            }
            else
            {
                MessageBox.Show("该员工不存在");
            }
        }
        private void button2_Click(object sender, EventArgs e) //员工ID查询
        {
            DataSet  ds       = new DataSet();
            Merchant merchant = new Merchant();
            Stall    stall    = new Stall();

            if (stall.staffexist(textBox1.Text.ToString()))
            {
                if (Convert.ToInt32(textBox1.Text) >= 700000 && Convert.ToInt32(textBox1.Text) <= 799999)
                {
                    ds = merchant.selectMerchantwithStaff_id(textBox1.Text.ToString());
                    dataGridView1.DataSource = ds;
                    dataGridView1.DataMember = "merchant";
                }
                else
                {
                    MessageBox.Show("请输入商家管理员工id");
                }
            }
            else
            {
                MessageBox.Show("请输入正确员工id");
            }
        }