Ejemplo n.º 1
0
        //添加测点
        private void button1_Click(object sender, EventArgs e)
        {
            string pointName = textBox1.Text;

            if (pointName == "")
            {
                Show("请输入点名");
                return;
            }

            PointInfoBLL bll = new PointInfoBLL();

            if (bll.PointIsExist(pointName))
            {
                Show("点名" + pointName + "已存在");
                textBox1.Text = "";
                return;
            }

            PointInfo model = new PointInfo()
            {
                pointName = pointName
            };

            if (bll.AddPoint(model))
            {
                textBox1.Text = "";
                Show("添加点名" + pointName + "成功");
            }
            else
            {
                Show("添加点名" + pointName + "失败");
            }
        }
Ejemplo n.º 2
0
        //删除测点
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentCell == null)
            {
                Show("请选择要删除的测点");
                return;
            }
            string pointName = GetPort(dataGridView1.CurrentCell.RowIndex);

            if (Ask("确定删除测点 " + pointName) != DialogResult.OK)
            {
                return;
            }

            PointInfoBLL bll   = new PointInfoBLL();
            PointInfo    model = new PointInfo()
            {
                pointName = pointName
            };

            if (bll.DeletePoint(model))
            {
                Initial();
                Show("删除成功");
            }
            else
            {
                Show("删除点名 " + pointName + "失败");
            }
        }