Exemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (button4.Text == "返回")
            {
                this.Close();
            }
            else if (button4.Text == "退回责任人")
            {
                mysql = $"update task set status='审核退回',substatus=0 where serial='{task.Serial}'";
                var sqlConnection = mySqlCon.GetConnection();
                var cmd           = mySqlCon.getCmd(mysql: mysql, sqlConnection);
                if (cmd.ExecuteNonQuery() != 0)
                {
                    MessageBox.Show("退回成功");

                    sqlConnection.Close();
                    this.Close();
                }

                else
                {
                    MessageBox.Show("服务器正忙,请稍后再试");
                }
            }
        }
Exemplo n.º 2
0
        private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            for (var i = 0; i < dataGridView1.RowCount; i++)
            {
                var dataGridViewRow = dataGridView1.Rows[i];
                var nowTime         = DateTime.Now.ToString("yyMMdd");
                //完成时间小于当天日期,字体显示为红色
                if (int.Parse(Convert.ToDateTime(dataGridViewRow.Cells["完成时间"].Value.ToString()).ToString("yyMMdd")) -
                    int.Parse(DateTime.Now.ToString("yyMMdd")) < 0)
                {
                    dataGridViewRow.DefaultCellStyle.ForeColor          = Color.Red;
                    dataGridViewRow.DefaultCellStyle.SelectionBackColor = Color.Red;

                    /*if (dataGridViewRow.Cells["状态"].Value.ToString() != "已超时")
                     * {
                     *  var sqlCommand =
                     *      mySqlCon.getCmd(
                     *          $"update task set status='已超时' where serial='{dataGridViewRow.Cells["单号"].Value.ToString()}'");
                     *  sqlCommand.ExecuteNonQuery();
                     *  dataGridViewRow.Cells["状态"].Value = "已超时";
                     * }*/
                    var sqlConnection = mySqlCon.GetConnection();
                    var sqlCommand    =
                        mySqlCon.getCmd(
                            $"update task set timeout=1 where serial='{dataGridViewRow.Cells["单号"].Value.ToString()}'", sqlConnection);
                    sqlCommand.ExecuteNonQuery();
                    sqlConnection.Close();
                }
            }
        }
Exemplo n.º 3
0
        /**
         * 提交数据
         */
        private void button3_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox4.Text.Trim()) || String.IsNullOrEmpty(textBox2.Text.Trim()) || String.IsNullOrEmpty(textBox3.Text.Trim()) || String.IsNullOrEmpty(richTextBox1.Text.Trim()) || String.IsNullOrEmpty(comboBox1.Text.Trim()))
            {
                MessageBox.Show("请把表单输入完整!!!");
            }
            else
            {
                var    serial = this.getSerial();
                String status = "待完成";

                //String mysql = "insert into task(faqiren,shenheren,time,zherenren,content,sqtime,bu,serial,subject)"+
                // " values ('"+textBox1.Text+"','"+textBox2.Text+"','"+dateTimePicker1.Value+"','"+textBox3.Text+"','"+richTextBox1.Text+"','"+DateTime.Now+"','"+comboBox1.Text+"','"+serial+"','"+textBox4.Text+"')";
                String mysql =
                    $"insert into task(faqiren,shenheren,time,zherenren,content,sqtime,bu,serial,subject,status,substatus) values ('{textBox1.Text}','{textBox2.Text}','{dateTimePicker1.Value.ToString("yyyy-MM-dd")}','{textBox3.Text}','{richTextBox1.Text}','{DateTime.Now}','{comboBox1.Text}','{serial}','{textBox4.Text}','{status}','0')";
                var        sqlConnection = mySqlCon.GetConnection();
                SqlCommand cmd           = mySqlCon.getCmd(mysql, sqlConnection);
                if (cmd.ExecuteNonQuery() != 0)
                {
                    MessageBox.Show("提交成功");
                    sqlConnection.Close();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("服务器正忙,请稍后再试");
                }
            }
        }
Exemplo n.º 4
0
        public void ChangeTask()
        {
            String mysql = $"update task set changetime='{DateTime.Now}',shenheren='{textBox2.Text.ToString()}'," +
                           $"time='{dateTimePicker1.Value.ToString("yyyy-MM-dd")}',zherenren='{textBox3.Text.ToString()}'," +
                           $"bu='{comboBox1.Text.ToString()}',subject='{textBox4.Text.ToString()}',content='{richTextBox1.Text.ToString()}',substatus=0 " +
                           $"where serial='{task.Serial}'";
            var sqlCon     = new My_SqlCon();
            var connection = sqlCon.GetConnection();
            var sqlCommand = sqlCon.getCmd(mysql, connection);

            if (sqlCommand.ExecuteNonQuery() != 0)
            {
                MessageBox.Show("修改成功");
                connection.Close();
                this.Close();
            }
            else
            {
                MessageBox.Show("服务器正忙,请稍后再试");
            }
            submitted.SetDataView();
        }