Exemplo n.º 1
0
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                //状態
                if (e.Value != null && e.Value is int)
                {
                    TaskState state = (TaskState)((int)e.Value);
                    e.FormattingApplied = true;
                    switch (state)
                    {
                    case TaskState.NotExecute:
                        e.Value = RSM.GetMessage(RS.StringTable.TaskState_NotExecute);
                        break;

                    case TaskState.Executed:
                        e.Value = RSM.GetMessage(RS.StringTable.TaskState_Executed);
                        break;

                    case TaskState.ExecutFailed:
                        e.Value = RSM.GetMessage(RS.StringTable.TaskState_ExecutFailed);
                        break;

                    default:
                        e.Value = string.Empty;
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateInputs())
         {
             return;
         }
         //入力値を変更
         //表示名
         this._targetView.DisplayName = this.txtViewTitle.Text;
         //変換対象
         this._targetView.IsTarget = this.rdbConvert.Checked;
         //アイテム数
         this._targetView.RowLimit = (int)this.numLimitRow.Value;
         //既定のビュー
         this._targetView.IsTarget = this.chkDefault.Checked;
         //チェックボックス表示
         this._targetView.ShowChecked = this.chkDefault.Checked;
         using (SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor())
         {
             sqlAccessor.UpdateMigrateView(this._targetView);
         }
         Log.Write(this.TargetView.TaskId, RSM.GetMessage(RS.Informations.ViewSetted, this.TargetView.Name));
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 削除ボタンを押す処理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     if (this.TaskList.SelectedRows == null || this.TaskList.SelectedRows.Count == 0)
     {
         return;
     }
     try
     {
         var seleRow = this.TaskList.SelectedRows[0];
         var item    = seleRow.DataBoundItem as DataRowView;
         if (item == null)
         {
             return;
         }
         string taskId   = item["TASK_ID"] as string;
         string taskName = item["TASK_NAME"] as string;
         using (SqlAccessor accessor = Accessor.AccessorFactory.GetSqlAccessor())
         {
             accessor.DeleteMigrateTask(taskId);
         }
         Log.Write(taskId, RSM.GetMessage(RS.Informations.DatabaseDeleted, taskName, taskId));
         InitNotesSettingList();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 処理ステップ設定
        /// </summary>
        /// <param name="stepRate"></param>
        /// <param name="stepCount"></param>
        public void SetStep(double stepRate, int stepCount, Enum messageId, params string[] args)
        {
            this._processPercentage = (int)(this._processPercentage + this._stepRate);
            this._stepCount         = stepCount;
            this._stepRate          = stepRate;
            this._processCount      = 0;
            this._sucessCount       = 0;
            string message = string.Empty;

            if (this._reportHandler == null)
            {
                return;
            }
            if (args == null || args.Length == 0)
            {
                message = RSM.GetMessage(messageId);
            }
            else
            {
                message = RSM.GetMessage(messageId, args);
            }
            int             parcent   = this._processPercentage + (int)(this._stepRate * StepPercentage / 100);
            ReportEventArgs eventArgs = new ReportEventArgs(
                this._taskName, parcent, this.SetpCount, this._sucessCount, this._processCount, message);

            this._reportHandler(this, eventArgs);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 進歩報告
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="messageId"></param>
        /// <param name="isSucess"></param>
        /// <param name="args"></param>
        public void ReportStep(Enum messageId, bool isSucess, params string[] args)
        {
            if (this._reportHandler == null)
            {
                return;
            }
            string message = string.Empty;

            if (args == null || args.Length == 0)
            {
                message = RSM.GetMessage(messageId);
            }
            else
            {
                message = RSM.GetMessage(messageId, args);
            }
            this._processCount++;
            if (isSucess)
            {
                this._sucessCount++;
            }
            int             parcent   = this._processPercentage + (int)(this._stepRate * StepPercentage / 100);
            ReportEventArgs eventArgs = new ReportEventArgs(
                this._taskName, parcent, this.SetpCount, this._sucessCount, this._processCount, message);

            this._reportHandler(this, eventArgs);
        }
Exemplo n.º 6
0
 /// <summary>
 /// データ保存する
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (!this.ValidateInputs())
         {
             return;
         }
         //入力値を設定する
         this._taskInfo.TaskName         = this.txtTaskName.Text;
         this._taskInfo.DisplayName      = this.txtDisplayName.Text;
         this._taskInfo.ListName         = this.txtListName.Text;
         this._taskInfo.Description      = this.txtDescription.Text;
         this._taskInfo.IsUseDefaultIcon = this.rdoDefaultIcon.Checked;
         string     strType = Convert.ToString(this.cmbSPType.SelectedValue);
         SPListType sptype  = SPListType.GenericList;
         if (Enum.TryParse(strType, true, out sptype))
         {
             this._taskInfo.ListType = sptype;
         }
         using (SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor())
         {
             sqlAccessor.InsertMigrate(this._taskInfo);
         }
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         Log.Write(this._taskInfo.TaskId,
                   RSM.GetMessage(RS.Informations.DataBaseSetted, this._taskInfo.TaskName, this._taskInfo.TaskId));
         this.Close();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 画面初期化する
        /// </summary>
        private void InitDatabaseInfo()
        {
            this.txtTaskName.Text = this._taskInfo.TaskName;
            string server = string.IsNullOrEmpty(this._taskInfo.NotesServer) ? "Local" : this._taskInfo.NotesServer;

            this.txtServer.Text      = server;
            this.txtFileName.Text    = this._taskInfo.NotesFilePath;
            this.txtListName.Text    = this._taskInfo.ListName;
            this.txtDisplayName.Text = this._taskInfo.DisplayName;
            this.txtDescription.Text = this._taskInfo.Description;
            this.txtWebSite.Text     = this._taskInfo.SPSiteUrl;
            //状態
            switch (this._taskInfo.State)
            {
            case TaskState.NotExecute:
                this.lblStatus.Text = RSM.GetMessage(RS.StringTable.TaskState_NotExecute);
                break;

            case TaskState.Executed:
                this.lblStatus.Text = RSM.GetMessage(RS.StringTable.TaskState_Executed);
                break;

            case TaskState.ExecutFailed:
                this.lblStatus.Text = RSM.GetMessage(RS.StringTable.TaskState_ExecutFailed);
                break;

            default:
                this.lblStatus.Text = string.Empty;
                break;
            }
            //既定のアイコン
            this.rdoDefaultIcon.Checked = this._taskInfo.IsUseDefaultIcon;
            this.rdoNotDefIcon.Checked  = !this._taskInfo.IsUseDefaultIcon;
            //実行日時
            if (this._taskInfo.LastExecuteTime.HasValue)
            {
                this.lblConvertDate.Text = this._taskInfo.LastExecuteTime.Value.ToString("yyyy/MM/dd HH:mm:ss");
            }
            //フォーム一覧
            InitForms();
            //ビュー一覧
            InitViews();
            int pos = this.cmbSPType.FindString(this._taskInfo.ListType.ToString());

            if (pos > -1)
            {
                this.cmbSPType.SelectedIndex = pos;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// アイコンを出力する
        /// </summary>
        /// <param name="nsAccessor"></param>
        /// <param name="task"></param>
        /// <param name="databaseDir"></param>
        private void ExportDBIcon(NotesAccessor nsAccessor, IMigrateTask task, string databaseDir)
        {
            Image rawIcon   = nsAccessor.ExportIcon(task.CurrentDb);
            Image smallIcon = nsAccessor.GetSmallIcon(rawIcon);
            Image LargeIcon = nsAccessor.GetLargeNotesIcon(rawIcon, task.NotesDbTitle);
            //元アイコン
            string iconFile = System.IO.Path.Combine(databaseDir, RSM.GetMessage(RS.StringTable.DBIconName));

            rawIcon.Save(iconFile, ImageFormat.Png);
            //Smallアイコン
            iconFile = System.IO.Path.Combine(databaseDir, RSM.GetMessage(RS.StringTable.DBSmallIconName));
            smallIcon.Save(iconFile, ImageFormat.Png);
            //大きいアイコン
            iconFile = System.IO.Path.Combine(databaseDir, RSM.GetMessage(RS.StringTable.DBLargeIconName));
            LargeIcon.Save(iconFile, ImageFormat.Png);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 設定を保存する
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateInputs())
         {
             return;
         }
         using (SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor())
         {
             sqlAccessor.UpdateMigrateForm(this.TargetForm);
         }
         Log.Write(RSM.GetMessage(RS.Informations.FormSetted, this.TargetForm.Name));
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemplo n.º 10
0
        /// <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;
                    }
                }
            }
        }
Exemplo n.º 11
0
 private string GetLocalizedString()
 {
     return(RSM.GetMessage(this._Key));
 }
Exemplo n.º 12
0
 protected override string GetLocalizedString(string value)
 {
     return(RSM.GetMessage(this._Key));
 }