示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlParameter[] ps = new SqlParameter[16];
            ps[0]  = new SqlParameter("@紧急程度", comboBox1.Items[comboBox1.SelectedIndex].ToString());
            ps[1]  = new SqlParameter("@解决状态", comboBox2.Items[comboBox1.SelectedIndex].ToString());
            ps[2]  = new SqlParameter("@所属版本", textBox1.Text.ToString());
            ps[3]  = new SqlParameter("@问题分类", comboBox3.Items[comboBox1.SelectedIndex].ToString());
            ps[4]  = new SqlParameter("@使用终端", comboBox4.Items[comboBox1.SelectedIndex].ToString());
            ps[5]  = new SqlParameter("@工作内容", textBox2.Text.ToString());
            ps[6]  = new SqlParameter("@提出人", textBox3.Text.ToString());
            ps[7]  = new SqlParameter("@记录人", comboBox5.Items[comboBox1.SelectedIndex].ToString());
            ps[8]  = new SqlParameter("@责任人", comboBox6.Items[comboBox1.SelectedIndex].ToString());
            ps[9]  = new SqlParameter("@提出时间", textBox4.Text.ToString());
            ps[10] = new SqlParameter("@解决时间", textBox9.Text.ToString());
            ps[11] = new SqlParameter("@解决周期", comboBox7.Items[comboBox1.SelectedIndex].ToString());
            ps[12] = new SqlParameter("@关闭时间", textBox5.Text.ToString());
            ps[13] = new SqlParameter("@解决措施", textBox6.Text.ToString());
            ps[14] = new SqlParameter("@进展情况", textBox7.Text.ToString());
            ps[15] = new SqlParameter("@备注说明", textBox8.Text.ToString());

            string sql = "insert into JDSoft_MES_Problem(紧急程度,解决状态,所属版本,问题分类,使用终端,工作内容,提出人,记录人,责任人,提出时间,解决时间,解决周期,关闭时间,解决措施,进展情况,备注说明)" +
                         "values(@紧急程度,@解决状态,@所属版本,@问题分类,@使用终端,@工作内容,@提出人,@记录人,@责任人,@提出时间,@解决时间,@解决周期,@关闭时间,@解决措施,@进展情况,@备注说明);";
            int rows = ConnectSQL.Execute(sql, ps);

            MessageBox.Show("新增成功" + rows + "行");
        }
示例#2
0
        private void button6_Click(object sender, EventArgs e)
        {
            string sql;

            if (comboBox1.SelectedIndex < 0 & textBox1.Text.ToString().Trim() != "" & textBox2.Text.ToString().Trim() != "" & textBox3.Text.ToString().Trim() != "")
            {
                sql = "select * from JDSoft_MES_Problem where 提出时间 like '%" + textBox1.Text.ToString().Trim() + "%' and 解决时间 like '%" + textBox2.Text.ToString().Trim() +
                      "%' and 关闭时间 like '%" + textBox3.Text.ToString().Trim() + "%'";
            }
            else if (comboBox1.SelectedIndex < 0 & textBox1.Text.ToString().Trim() == "" & textBox2.Text.ToString().Trim() != "" & textBox3.Text.ToString().Trim() != "")
            {
                sql = "select * from JDSoft_MES_Problem where 解决时间 like '%" + textBox2.Text.ToString().Trim() +
                      "%' and 关闭时间 like '%" + textBox3.Text.ToString().Trim() + "%'";
            }
            else if (comboBox1.SelectedIndex < 0 & textBox1.Text.ToString().Trim() == "" & textBox2.Text.ToString().Trim() == "" & textBox3.Text.ToString().Trim() != "")
            {
                sql = "select * from JDSoft_MES_Problem where 关闭时间 like '%" + textBox3.Text.ToString().Trim() + "%'";
            }
            else if (comboBox1.SelectedIndex < 0 & textBox1.Text.ToString().Trim() == "" & textBox2.Text.ToString().Trim() == "" & textBox3.Text.ToString().Trim() == "")
            {
                sql = "select * from JDSoft_MES_Problem";
            }
            else
            {
                sql = "select * from JDSoft_MES_Problem where 解决状态 like '%" + comboBox1.Items[comboBox1.SelectedIndex].ToString() +
                      "%' and 提出时间 like '%" + textBox1.Text.ToString().Trim() + "%' and 解决时间 like '%" + textBox2.Text.ToString().Trim() +
                      "%' and 关闭时间 like '%" + textBox3.Text.ToString().Trim() + "%'";
            }

            DataTable rows = ConnectSQL.Reader(sql);

            dataGridView1.DataSource = rows;
        }
示例#3
0
        private void button5_Click(object sender, EventArgs e) //刷新
        {
            string    sql  = "select * from JDSoft_MES_Problem;";
            DataTable rows = ConnectSQL.Reader(sql);

            dataGridView1.DataSource = rows;
        }
示例#4
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            tabControl1.Visible = false; //显示合成脚本菜单
            tabControl2.Visible = false;
            tabControl3.Visible = false;
            tabControl4.Visible = true;
            tabControl5.Visible = false;
            tabControl4.Dock    = DockStyle.Fill;//填充窗体

            string    sql  = "select * from JDSoft_MES_Problem;";
            DataTable rows = ConnectSQL.Reader(sql);

            dataGridView1.DataSource = rows;
        }
示例#5
0
        private void button4_Click(object sender, EventArgs e) //删除
        {
            try
            {
                int id   = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value);
                int rows = ConnectSQL.Execute("delete from JDSoft_MES_Problem where 任务编号=@任务编号", new SqlParameter("@任务编号", id));
                MessageBox.Show("删除成功" + rows + "行");
            }
            catch
            {
                MessageBox.Show("未选中行!");
            }

            button5_Click(null, null);//刷新
        }