Esempio n. 1
0
 public static List<LXJHGLInstance> ImportTasks(string filename)
 {
     List<LXJHGLInstance> tasks = new List<LXJHGLInstance>();
     using (FileStream fs = File.OpenRead(filename))
     {
         IWorkbook wb = WorkbookFactory.Create(fs);
         var sheet = wb.GetSheetAt(0);
         for (int i = sheet.FirstRowNum + 1; i <= sheet.LastRowNum; i++)
         {
             IRow row = sheet.GetRow(i);
             ICell cell = row == null ? null : row.GetCell(0);
             if (cell != null && !string.IsNullOrEmpty(cell.StringCellValue))              
             {
                 var task = new LXJHGLInstance();
                 task.Id = cell.StringCellValue;
                 task.Name = row.GetCell(1).StringCellValue;
                 cell = row == null ? null : row.GetCell(2);
                 if(cell.CellType == CellType.String)
                 task.Version = int.Parse(row.GetCell(2).StringCellValue);
                 if (cell.CellType == CellType.Numeric)
                     task.Version = (int)(row.GetCell(2).NumericCellValue);
                 task.Releaser = row.GetCell(3).StringCellValue;
                 task.Releasetime = DateTime.ParseExact(row.GetCell(4).StringCellValue, 
                     "yyyy年MM月dd日", CultureInfo.InvariantCulture);
                 task.Type = row.GetCell(5).StringCellValue;
                 task.Creator = row.GetCell(6) == null ? string.Empty : row.GetCell(6).StringCellValue;
                 task.Status = LXJHGLStatus.未分配;
                 task.Taskcreatime = DateTime.Now;
                 tasks.Add(task);
             }
         }
     }
     return tasks;
 }
Esempio n. 2
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;
        }
Esempio n. 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;
 }
Esempio n. 4
0
        public static List <LXJHGLInstance> ImportTasks(string filename)
        {
            List <LXJHGLInstance> tasks = new List <LXJHGLInstance>();

            using (FileStream fs = File.OpenRead(filename))
            {
                IWorkbook wb    = WorkbookFactory.Create(fs);
                var       sheet = wb.GetSheetAt(0);
                for (int i = sheet.FirstRowNum + 1; i <= sheet.LastRowNum; i++)
                {
                    IRow  row  = sheet.GetRow(i);
                    ICell cell = row == null ? null : row.GetCell(0);
                    if (cell != null && !string.IsNullOrEmpty(cell.StringCellValue))
                    {
                        var task = new LXJHGLInstance();
                        task.Id   = cell.StringCellValue;
                        task.Name = row.GetCell(1).StringCellValue;
                        cell      = row == null ? null : row.GetCell(2);
                        if (cell.CellType == CellType.String)
                        {
                            task.Version = int.Parse(row.GetCell(2).StringCellValue);
                        }
                        if (cell.CellType == CellType.Numeric)
                        {
                            task.Version = (int)(row.GetCell(2).NumericCellValue);
                        }
                        task.Releaser    = row.GetCell(3).StringCellValue;
                        task.Releasetime = DateTime.ParseExact(row.GetCell(4).StringCellValue,
                                                               "yyyy年MM月dd日", CultureInfo.InvariantCulture);
                        task.Type         = row.GetCell(5).StringCellValue;
                        task.Creator      = row.GetCell(6) == null ? string.Empty : row.GetCell(6).StringCellValue;
                        task.Status       = LXJHGLStatus.未分配;
                        task.Taskcreatime = DateTime.Now;
                        tasks.Add(task);
                    }
                }
            }
            return(tasks);
        }
Esempio n. 5
0
 internal List<LXJHGLInstance> GetAllTasks()
 {
     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";
     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;
 }