Пример #1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            ProjectInfo info = new ProjectInfo();

            if (string.IsNullOrEmpty(txt_jcxmbh.Text.Trim()))
            {
                MessageBox.Show("err");
                return;
            }

            if (string.IsNullOrEmpty(txt_m.Text.Trim()))
            {
                MessageBox.Show("err");
                return;
            }
            if (string.IsNullOrEmpty(txt_s.Text.Trim()))
            {
                MessageBox.Show("err");
                return;
            }
            //if (string.IsNullOrEmpty(txt_helper.Text.Trim()))
            //{
            //    MessageBox.Show("err");
            //    return;
            //}
            //if (string.IsNullOrEmpty(txt_cal.Text.Trim()))
            //{
            //    MessageBox.Show("err");
            //    return;
            //}

            info.BH        = txt_jcxmbh.Text;
            info.MTable    = txt_m.Text;
            info.STable    = txt_s.Text;
            info.BZTable   = txt_helper.Text;
            info.YTable    = txt_y.Text;
            info.DataFiled = txtdatafiled.Text;
            //info.Cal = txt_cal.Text;
            int result = _projectInfos.DataInsert(info);

            if (result == -3)
            {
                MessageBox.Show("添加失败,请检测项目编号");
            }
            else if (result == -2)
            {
                MessageBox.Show("添加失败,已存在相同的项目");
            }
            else
            {
                MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK);
                this.Close();
                _formMain.Show();
            }
        }