Beispiel #1
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (textBox4.Text == "")
            {
                MessageBox.Show("请输入件数!");
                return;
            }
            ListViewItem li    = this.listView1.SelectedItems[0];
            string       pNo   = li.SubItems[0].Text;
            int          price = (int.Parse)(li.SubItems[6].Text);
            string       wNo   = li.SubItems[2].Text;
            int          x;

            try
            {
                x = int.Parse(textBox4.Text);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
                return;
            }
            int amount = Productctrl.sumamount(wNo);
            int volume = int.Parse(li.SubItems[5].Text);

            if (Productctrl.update(x, pNo, wNo, volume, amount) && x > 0)
            {
                MessageBox.Show("产品进货成功!成本为" + price * x + "元");
            }
            button1_Click(null, null);
            if (listView2.Items.Count != 0)
            {
                button2_Click(null, null);
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string pNo   = textBox1.Text;
            string pName = textBox2.Text;

            Productctrl.loadProduct(pNo, pName, listView1);
        }
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            int input, volume;

            if (textBox4.Text == "")
            {
                MessageBox.Show("请输入产品数量!");
                return;
            }
            try
            {
                input  = int.Parse(textBox4.Text);
                volume = int.Parse(label6.Text);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
                return;
            }

            string wName  = comboBox1.Text;
            string wNo    = (string)hs[wName];
            int    amount = Productctrl.sumamount(wNo);

            if (input < 0)
            {
                MessageBox.Show("添加件数不可为负!");
                return;
            }
            if (input + amount > volume)
            {
                MessageBox.Show("添加件数超过仓库容量允许范围");
                return;
            }
            if (this.listView1.SelectedItems.Count != 1)
            {
                MessageBox.Show("请选择一个产品");
                return;
            }
            string pNo   = this.listView1.SelectedItems[0].Text.ToString();
            int    money = 0;

            if (Productctrl.addproduct(pNo, wNo, input, ref money))
            {
                MessageBox.Show("产品添加成功!成本为" + money.ToString() + "元");
            }
            button1_Click(null, null);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string wName = comboBox1.Text;
            string wNo   = (string)hs[wName];

            if (wNo == null)
            {
                MessageBox.Show("请选择仓库地址");
                return;
            }
            int v = 0;

            Productctrl.loadProduct("", wNo, "", listView2, ref v);
            Productctrl.loadunproduct(wNo, listView1);
            label6.Text = v.ToString();
        }
Beispiel #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            int    v   = 0;
            string add = comboBox1.Text;
            string wNo = (string)hs[add];

            Productctrl.loadProduct("", wNo, "", listView2, ref v);
            if (comboBox1.Text != "")
            {
                label7.Text = v.ToString();
            }
            else
            {
                label7.Text = "";
            }
        }
        private void listView2_DoubleClick(object sender, EventArgs e)
        {
            if (listView2.SelectedItems.Count != 1)
            {
                MessageBox.Show("请选择需要删除的产品");
                return;
            }
            string pNo   = this.listView2.SelectedItems[0].Text.ToString();
            string wName = comboBox1.Text;
            string wNo   = (string)hs[wName];

            if (Productctrl.delete(pNo, wNo))
            {
                MessageBox.Show("产品删除成功!");
            }
            button1_Click(null, null);
        }
Beispiel #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems.Count != 1)
            {
                MessageBox.Show("请选择需要修改信息的产品");
                return;
            }
            string pNo   = this.listView1.SelectedItems[0].Text.ToString();
            string pName = textBox5.Text;

            if (Productctrl.productchange(pNo, pName))
            {
                MessageBox.Show("产品信息修改成功");
            }
            else
            {
                MessageBox.Show("请输入产品名称");
            }
            button1_Click(null, null);
        }
Beispiel #8
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            int price;

            if (textBox3.Text == "")
            {
                MessageBox.Show("请输入更改后的价格");
                return;
            }
            try
            {
                price = int.Parse(textBox3.Text);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
                return;
            }
            if (price <= 0)
            {
                MessageBox.Show("产品价格不能为负!");
                return;
            }
            if (this.listView1.SelectedItems.Count != 1)
            {
                MessageBox.Show("请选择需要修改单价产品");
                return;
            }
            string pNo = listView1.SelectedItems[0].Text.ToString();

            if (Productctrl.pricechange(pNo, price))
            {
                MessageBox.Show("单价修改成功");
            }
            button1_Click(null, null);
        }