Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                //判断checkbox是否选中
                int count = 0;
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if ((bool)dataGridView1.Rows[i].Cells[0].EditedFormattedValue == true)
                    {
                        count++;
                    }
                }

                if (count == 0)
                {
                    MessageBox.Show("请至少选择一条数据!", "提示");
                    return;
                }
                else
                {
                    if (MessageBox.Show(this, "您要更新数据么?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information).ToString() == "Yes")
                    {
                        List <LXJHGLInstance> updateList = new List <LXJHGLInstance>();
                        var task = new LXJHGLInstance();

                        for (int j = 0; j < dataGridView1.Rows.Count; j++)
                        {
                            if ((bool)dataGridView1.Rows[j].Cells[0].EditedFormattedValue == true)
                            {
                                Tasks[j].Status  = LXJHGLStatus.未接收;
                                Tasks[j].Creator = dataGridView1.Rows[j].Cells[7].Value.ToString();
                                if (dataGridView1.Rows[j].Cells[11].Value != null)
                                {
                                    Tasks[j].Bz = dataGridView1.Rows[j].Cells[11].Value.ToString();
                                }
                                Tasks[j].Difficulty = (int)(dataGridView1.Rows[j].Cells[13].Value);
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            //改变数据库中数据
            LXJHGLCLT.Agent.UpdateTasks(Tasks);
            //重新绑定datagridview
            dataGridView1.DataSource = Tasks;
        }
Exemple #2
0
        internal List <LXJHGLInstance> GetTasksByStatus(LXJHGLStatus status, string userName)
        {
            List <LXJHGLInstance> result = new List <LXJHGLInstance>();

            this.dbParam.Open();
            OracleCommand queryCmd = new OracleCommand();

            queryCmd.Connection  = (OracleConnection)this.dbParam.Connection;
            queryCmd.CommandText = @"SELECT ID,
                                            NAME,
                                            VERSION,
                                            RELEASER,
                                            RELEASETIME,
                                            TYPE,
                                            CREATOR,
                                            PLANEDTIME,
                                            TASKCREATIME,
                                            STATUS,
                                            BZ,
                                            PROCESS,
                                            DIFFICULTY,
                                            COMPLETETIME
                                     FROM dq_route_taskmng 
                                     WHERE STATUS=:status and CREATOR like '%' || :userName || '%' ";
            queryCmd.Parameters.Add(":status", OracleDbType.Int32);
            queryCmd.Parameters[":status"].Value = status;
            queryCmd.Parameters.Add(":userName", OracleDbType.NVarchar2);
            queryCmd.Parameters[":userName"].Value = userName;
            var reader = queryCmd.ExecuteReader();

            while (reader.Read())
            {
                LXJHGLInstance task = new LXJHGLInstance();
                task.Id           = reader.GetOracleString(0).IsNull ? string.Empty : reader.GetOracleString(0).Value;
                task.Name         = reader.GetOracleString(1).IsNull ? string.Empty : reader.GetOracleString(1).Value;
                task.Version      = reader.GetOracleDecimal(2).IsNull ? 0 : reader.GetOracleDecimal(2).ToInt32();
                task.Releaser     = reader.GetOracleString(3).IsNull ? string.Empty : reader.GetOracleString(3).Value;
                task.Releasetime  = reader.GetOracleDate(4).IsNull ? DateTime.MinValue : reader.GetOracleDate(4).Value;
                task.Type         = reader.GetOracleString(5).IsNull ? string.Empty : reader.GetOracleString(5).Value;
                task.Creator      = reader.GetOracleString(6).IsNull ? string.Empty : reader.GetOracleString(6).Value;
                task.Planedtime   = reader.GetOracleDate(7).IsNull ? DateTime.MinValue : reader.GetOracleDate(7).Value;
                task.Taskcreatime = reader.GetOracleDate(8).IsNull ? DateTime.MinValue : reader.GetOracleDate(8).Value;
                task.Status       = reader.GetOracleDecimal(9).IsNull ? (LXJHGLStatus)1 : (LXJHGLStatus)reader.GetOracleDecimal(9).ToInt32();
                task.Bz           = reader.GetOracleString(10).IsNull ? string.Empty : reader.GetOracleString(10).Value;
                task.Process      = reader.GetOracleString(11).IsNull ? string.Empty : reader.GetOracleString(11).Value;
                task.Difficulty   = reader.GetOracleDecimal(12).IsNull ? 0 : reader.GetOracleDecimal(12).ToInt32();
                task.Completetime = reader.GetOracleDate(13).IsNull ? DateTime.MinValue : reader.GetOracleDate(13).Value;
                result.Add(task);
            }
            this.dbParam.Close();
            return(result);
        }
Exemple #3
0
        static LXJHGLInstance CreateTask(string Id, string Name, int Version, string Releaser,
                                         DateTime Releasetime, string Type, string Creator, DateTime Planedtime,
                                         DateTime Taskcreatime, string Bz, string Process, int Difficulty, DateTime Completetime)
        {
            LXJHGLInstance task = new LXJHGLInstance();

            task.Id           = Id;
            task.Name         = Name;
            task.Version      = Version;
            task.Releaser     = Releaser;
            task.Releasetime  = Releasetime;
            task.Type         = Type;
            task.Creator      = Creator;
            task.Planedtime   = Planedtime;
            task.Taskcreatime = Taskcreatime;
            task.Status       = LXJHGLStatus.未分配;
            task.Bz           = Bz;
            task.Process      = Process;
            task.Difficulty   = Difficulty;
            task.Completetime = Completetime;
            return(task);
        }