Exemplo n.º 1
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);
        }