Exemple #1
0
        //添加车列

        private void simpleButton3_Click(object sender, EventArgs e)
        {
            LatheColumnDao dao  = new LatheColumnDao();
            string         name = textEdit2.Text.Trim();

            //控制参数格式
            if (name == "")
            {
                MessageBox.Show("信息不能为空!");
                return;
            }
            string sql1 = "select * from LATHE_COLUMN where COLUMN_NAME = '" + name + "'";

            if (common.SqlHelper.ExcuteSql(sql1) > 0)
            {
                MessageBox.Show("该车列已经被使用,请核查!", "信息提示", MessageBoxButtons.OK);
                return;
            }
            dao.Save(this.textEdit2.Text.Trim());
            FreshForm();
        }
Exemple #2
0
        //保存车列信息
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            LatheColumnDao dao  = new LatheColumnDao();
            string         name = COLUMN_NAME.Text.Trim();

            //控制参数格式
            if (name == "")
            {
                MessageBox.Show("信息不能为空!");
                return;
            }
            switch (strOperationFlag)
            {
            case "add":
                string sql1 = "select * from LATHE_COLUMN where COLUMN_NAME = '" + name + "'";
                if (common.SqlHelper.ExcuteSql(sql1) > 0)
                {
                    MessageBox.Show("该车列已经被使用,请核查!", "信息提示", MessageBoxButtons.OK);
                    return;
                }
                dao.Save(this.COLUMN_NAME.Text.Trim());
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;

            case "modify":
                string sql2 = "select count(*) from LATHE_COLUMN where COLUMN_NAME = '" + name + "' and COLUMN_ID <> '" + COLUMN_ID + "'";
                if (common.SqlHelper.ExcuteSql(sql2) > 0)
                {
                    MessageBox.Show("该车列已经被使用,请核查!", "信息提示", MessageBoxButtons.OK);
                    this.COLUMN_NAME.Focus();
                    return;
                }
                dao.Modify(COLUMN_ID, this.COLUMN_NAME.Text.Trim());
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;
            }
        }