private void cmbTaskList_SelectedIndexChanged(object sender, EventArgs e) { if (this.cmbTaskList.SelectedItem == null) { return; } try { DataRowView row = (DataRowView)this.cmbTaskList.SelectedItem; string taskId = Utility.DBToString(row["TASK_ID"]); MigrateTask task = null; using (SqlAccessor accessor = Accessor.AccessorFactory.GetSqlAccessor()) { task = accessor.GetMigrateTaskById(taskId, SqlAccessor.DataKind.ViewOnly); } if (task == null) { return; } this._selectedTask = task; this.InitViewList(task); } catch (Exception ex) { Log.Write(ex); RSM.ShowMessage(this, ex); } }
/// <summary> /// 設定を編集する /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditButton_Click(object sender, EventArgs e) { if (this.TaskList.SelectedRows == null || this.TaskList.SelectedRows.Count == 0) { return; } var seleRow = this.TaskList.SelectedRows[0]; var item = seleRow.DataBoundItem as DataRowView; if (item == null) { return; } string taskId = item["TASK_ID"] as string; MigrateTask taskInfo = null; using (SqlAccessor accessor = Accessor.AccessorFactory.GetSqlAccessor()) { taskInfo = accessor.GetMigrateTaskById(taskId, SqlAccessor.DataKind.All); } if (taskInfo == null) { return; } using (DataBaseSeting dbSetting = new DataBaseSeting()) { dbSetting.TaskInfo = taskInfo; dbSetting.ShowDialog(this.Owner); } InitNotesSettingList(); }
/// <summary> /// ワーカーを実行する /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Accessor.Convertor convert = new Accessor.Convertor(); List <string> taskIds = (List <string>)e.Argument; MigrateTask task = null; using (SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor()) { foreach (string id in taskIds) { //開始時間 DateTime sdate = DateTime.Now; try { task = sqlAccessor.GetMigrateTaskById(id, SqlAccessor.DataKind.All); ProgressReporter reporter = new ProgressReporter(task.TaskName, OnReported); convert.DoConvert(task, reporter); //終了時間 DateTime edate = DateTime.Now; sqlAccessor.UpdateMigrate(task, true); Log.Write(task, RSM.GetMessage(RS.Informations.ConvertCompleted, task.TaskName), true, sdate, edate); } catch (Exception) { if (task != null) { sqlAccessor.UpdateMigrate(task, false); } //終了時間 DateTime edate = DateTime.Now; Log.Write(task, RSM.GetMessage(RS.Informations.ConvertFailed, task.TaskName), true, sdate, edate); throw; } } } }