private void button1_Click(object sender, EventArgs e)
        {
            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)
            {
                MessageBox.Show("输入不能为空!");
                return;
            }
            Merchandise a = new Merchandise();

            if (Merchandise.IsWarehouseBelongToMerchant(textBox10.Text, Datebass.user_ifms.ID) == false)
            {
                MessageBox.Show("仓库ID输入有误,该仓库不属于此商家!");
                return;
            }
            if (Merchandise.IsWarehouseCapacityEnough(textBox10.Text, Convert.ToDouble(textBox1.Text)) < 0)
            {
                MessageBox.Show("仓库剩余容量不足!");
                return;
            }
            if (a.AddAnEntry(Datebass.user_ifms.ID, textBox2.Text, textBox3.Text, textBox4.Text, textBox9.Text, Convert.ToDouble(textBox1.Text), textBox10.Text))
            {
                MessageBox.Show("存货成功!");
                return;
            }
            else
            {
                MessageBox.Show("输入有误,存货失败!");
                return;
            }
        }
Example #2
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";
                }
            }
        }