示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Merchandise a = new Merchandise();

            if (textBox1.Text == string.Empty ||
                textBox10.Text == string.Empty ||
                textBox2.Text == string.Empty ||
                textBox3.Text == string.Empty ||
                textBox4.Text == string.Empty ||
                textBox9.Text == string.Empty ||
                textBox6.Text == string.Empty ||
                textBox7.Text == string.Empty ||
                textBox8.Text == string.Empty)
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            if (Merchandise.IsAnEntryExist(Datebass.user_ifms.ID, textBox8.Text, textBox7.Text, textBox6.Text) == false)
            {
                MessageBox.Show("原货物信息输入有误!");
                return;
            }
            if (Merchandise.IsWarehouseBelongToMerchant(textBox10.Text, Datebass.user_ifms.ID) == false)
            {
                MessageBox.Show("新仓库ID输入有误,该仓库不属于此商家!");
                return;
            }
            if (a.IsWarehouseIDSame(Datebass.user_ifms.ID, textBox2.Text, textBox3.Text, textBox4.Text, textBox10.Text))
            {
                if (a.UpdateWhenIDSame(Datebass.user_ifms.ID, textBox8.Text, textBox7.Text, textBox6.Text, Convert.ToDouble(textBox1.Text)))
                {
                    a.UpdateAnEntry(Datebass.user_ifms.ID, textBox8.Text, textBox2.Text, textBox7.Text, textBox3.Text, textBox6.Text, textBox4.Text, textBox9.Text, Convert.ToDouble(textBox1.Text), textBox10.Text);
                    MessageBox.Show("修改成功!");
                    DataSet ds = new DataSet();
                    ds = Merchandise.ShowAllMerchandiseInfo(Datebass.user_ifms.ID);
                    dataGridView1.DataSource = ds;
                    dataGridView1.DataMember = "merchandise";
                }
            }
            else
            {
                if (a.UpdateNewCapacity(Datebass.user_ifms.ID, textBox2.Text, textBox3.Text, textBox4.Text, Convert.ToDouble(textBox1.Text), textBox10.Text))
                {
                    a.UpdateOldCapacity(Datebass.user_ifms.ID, textBox8.Text, textBox7.Text, textBox6.Text);
                    a.UpdateAnEntry(Datebass.user_ifms.ID, textBox8.Text, textBox2.Text, textBox7.Text, textBox3.Text, textBox6.Text, textBox4.Text, textBox9.Text, Convert.ToDouble(textBox1.Text), textBox10.Text);
                    MessageBox.Show("修改成功!");
                    DataSet ds = new DataSet();
                    ds = Merchandise.ShowAllMerchandiseInfo(Datebass.user_ifms.ID);
                    dataGridView1.DataSource = ds;
                    dataGridView1.DataMember = "merchandise";
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == String.Empty)  //输入不能为空
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            DataSet ds = new DataSet();

            ds = Merchandise.SearchByName(Datebass.user_ifms.ID, textBox2.Text);
            dataGridView1.DataSource = ds;
            dataGridView1.DataMember = "merchandise";
        }
        private void button1_Click(object sender, EventArgs e)  //商家货物信息查询
        {
            merchandise_count form = new merchandise_count();

            DataSet ds = new DataSet();

            ds = Merchandise.ShowAllMerchandiseInfo(Datebass.user_ifms.ID);
            form.MerchandiseCountShowAllInfo(ds);

            ds = Merchandise.ShowAllMerchandiseNumber(Datebass.user_ifms.ID);
            form.MerchandiseCountShowNumber(ds);

            this.Hide();
            form.ShowDialog();
            this.Close();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == string.Empty ||
                textBox3.Text == string.Empty ||
                textBox4.Text == string.Empty ||
                textBox5.Text == string.Empty)
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            Merchandise a = new Merchandise();

            if (Merchandise.IsAnEntryExist(Datebass.user_ifms.ID, textBox5.Text, textBox3.Text, textBox4.Text) == false)
            {
                MessageBox.Show("输入有误,不存在该货物表项!");
                return;
            }
            if (Merchandise.IsMerchandiseEnough(Datebass.user_ifms.ID, textBox5.Text, textBox3.Text, textBox4.Text, Convert.ToDouble(textBox1.Text)) < 0)
            {
                MessageBox.Show("货物剩余量不足!");
                return;
            }
            if (a.PickUpMerchandise(Datebass.user_ifms.ID, textBox5.Text, textBox3.Text, textBox4.Text, Convert.ToDouble(textBox1.Text)))
            {
                MessageBox.Show("取货成功!");
                string name = a.GetName(Datebass.user_ifms.ID, textBox5.Text, textBox3.Text, textBox4.Text);
                textBox2.Text = name;
                DataSet ds = new DataSet();
                ds = Merchandise.SearchByName(Datebass.user_ifms.ID, name);
                dataGridView1.DataSource = ds;
                dataGridView1.DataMember = "merchandise";
                return;
            }
            else
            {
                MessageBox.Show("取货失败!");
                return;
            }
        }