Exemple #1
0
        /// <summary>
        /// 検索結果を表示する
        /// </summary>
        /// <param name="logType"></param>
        /// <param name="sdate"></param>
        /// <param name="edate"></param>
        private void BindLogList(LogType logType, DateTime?sdate, DateTime?edate)
        {
            DataSet result = null;

            using (SqlAccessor accessor = Accessor.AccessorFactory.GetSqlAccessor())
            {
                result = accessor.GetLogList(logType, sdate, edate);
            }
            if (result != null || result.Tables.Count > 1)
            {
                //件数
                int count = Utility.DBToInteger(result.Tables[0].Rows[0]["LOGCOUNT"]);
                if (count > MAX_DISPLAY_NUM)
                {
                    RSM.ShowMessage(this, RS.Exclamations.MaxDisplayNumOvered);
                }
                DataTable datasource = result.Tables[1];
                if (logType == LogType.System)
                {
                    this.dtgSystemLog.DataSource = datasource;
                    this.dtgEventLog.DataSource  = null;
                    this.dtgEventLog.Visible     = false;
                    this.dtgSystemLog.Visible    = true;
                }
                else
                {
                    this.dtgEventLog.DataSource  = datasource;
                    this.dtgSystemLog.DataSource = null;
                    this.dtgSystemLog.Visible    = false;
                    this.dtgEventLog.Visible     = true;
                }
            }
        }
Exemple #2
0
 private void EnsureSession()
 {
     if (!this.IsInitialized)
     {
         throw RSM.GetException(RS.Exceptions.SessionNotInitialized);
     }
 }
Exemple #3
0
 /// <summary>
 /// SP接続テスト
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnTryAccessSP_Click(object sender, EventArgs e)
 {
     if (ValidSP())
     {
         RSM.ShowMessage(this, RS.Informations.TryConnectOK);
     }
 }
Exemple #4
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;
                    }
                }
            }
        }
Exemple #5
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);
     }
 }
Exemple #6
0
 /// <summary>
 /// ロジックタイプ変更
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSetLogicType_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.treeCondition.Nodes.Count == 0)
         {
             return;
         }
         TreeNode  root    = this.treeCondition.Nodes[0];
         LogicItem logitem = (LogicItem)root.Tag;
         if (this.rdbAnd.Checked)
         {
             logitem.Type = LogicType.And;
         }
         else
         {
             logitem.Type = LogicType.Or;
         }
         root.Text = logitem.TagName;
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #7
0
 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);
     }
 }
Exemple #8
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);
        }
Exemple #9
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);
        }
Exemple #10
0
 /// <summary>
 /// フィルター条件追加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddFilter_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.cmbFields.SelectedItem == null)
         {
             return;
         }
         if (this.cmbOperator.SelectedItem == null)
         {
             return;
         }
         EnumNameAttribute selectedItem = (EnumNameAttribute)this.cmbOperator.SelectedItem;
         OperatorType      op           = (OperatorType)selectedItem.EnumValue;
         ConditionItem     condiItem    = new ConditionItem(op);
         condiItem.FieldRef = (IFieldRef)this.cmbFields.SelectedItem;
         condiItem.Value    = this.txtValue.Text;
         this._targetView.ViewCondition.Nodes.Add(condiItem);
         InitConditionTree();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #11
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);
     }
 }
Exemple #12
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);
     }
 }
Exemple #13
0
 /// <summary>
 /// DB接続テスト
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnTryAccessDB_Click(object sender, EventArgs e)
 {
     if (this.ValidDatabase())
     {
         RSM.ShowMessage(this, RS.Informations.TryConnectOK);
     }
 }
Exemple #14
0
 /// <summary>
 /// フィルター条件削除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDeleteFilter_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.treeCondition.SelectedNode == null ||
             this.treeCondition.SelectedNode.Tag == null)
         {
             return;
         }
         object selectedItem = this.treeCondition.SelectedNode.Tag;
         if (selectedItem is LogicItem)
         {
             return;
         }
         else if (selectedItem is ConditionItem)
         {
             ConditionItem condiItem = (ConditionItem)selectedItem;
             this._targetView.ViewCondition.Nodes.Remove(condiItem);
         }
         InitConditionTree();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #15
0
 /// <summary>
 /// ログを削除する
 /// </summary>
 /// <param name="type"></param>
 /// <param name="sdate"></param>
 /// <param name="edate"></param>
 private void DeleteLog(LogType type, DateTime?sdate, DateTime?edate)
 {
     using (SqlAccessor accessor = Accessor.AccessorFactory.GetSqlAccessor())
     {
         accessor.DeleteLog(type, sdate, edate);
     }
     RSM.ShowMessage(this, RS.Informations.LogDataDeleted);
     this.BindLogList(type, sdate, edate);
 }
Exemple #16
0
        /// <summary>
        /// SQL Accessorのインスタンスを取得する
        /// </summary>
        /// <returns></returns>
        public static SqlAccessor GetSqlAccessor()
        {
            AuthenticateMode mode = (AuthenticateMode)Config.DBAuthenticateMode;

            if (string.IsNullOrEmpty(Config.SqlServer) || string.IsNullOrEmpty(Config.DataBaseName))
            {
                throw RSM.GetException(RS.Exceptions.NotConfiged);
            }
            return(GetSqlAccessor(mode, Config.SqlServer, Config.DBUserId, Config.DBPassWord, Config.DataBaseName));
        }
Exemple #17
0
 private void NotesSettingList_Load(object sender, EventArgs e)
 {
     try
     {
         InitNotesSettingList();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #18
0
 /// <summary>
 /// フォームロードイベント処理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ViewSetting_Load(object sender, EventArgs e)
 {
     try
     {
         this.InitControls();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #19
0
 private void PreViewForm_Load(object sender, EventArgs e)
 {
     try
     {
         InitHtml(this.NotesForm);
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #20
0
 /// <summary>
 /// ワーカー処理完了
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TaskWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     this.ProgressPanel.Visible = false;
     this.TaskList.Enabled      = true;
     this.btnRun.Enabled        = true;
     this.btnClose.Enabled      = true;
     if (e.Error != null)
     {
         Log.Write(e.Error);
         RSM.ShowMessage(this, e.Error);
     }
     InitNotesSettingList();
 }
Exemple #21
0
 private void CloseButton_Click(object sender, EventArgs e)
 {
     try
     {
         this.Close();
         this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #22
0
 private void ViewSelectDialog_Load(object sender, EventArgs e)
 {
     try
     {
         this.btnOK.Enabled = false;
         InitTaskList();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #23
0
 private void NotesSettingList_Load(object sender, EventArgs e)
 {
     try
     {
         this.ProgressPanel.Visible = false;
         InitNotesSettingList();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #24
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;
            }
        }
Exemple #25
0
        private void btnTryAccessNotes_Click(object sender, EventArgs e)
        {
            string        password   = this.txtNotesPassword.Text;
            NotesAccessor nsAccessor = Accessor.AccessorFactory.GetNotesAccessor();

            if (nsAccessor.TryConnect(password))
            {
                this.lblUserId.Text = nsAccessor.GetCurrentUser();
                RSM.ShowMessage(this, RS.Informations.TryConnectOK);
            }
            else
            {
                RSM.ShowMessage(this, RS.Exclamations.InvalidNotesPassword);
            }
        }
Exemple #26
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);
        }
Exemple #27
0
 /// <summary>
 /// ログを削除する
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ValidateInputs())
         {
             return;
         }
         SearchArgs args = GetSearchArgs();
         this.DeleteLog(args.Type, args.StartDate, args.EndDate);
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #28
0
 /// <summary>
 /// グループ項目削除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDeleteGroup_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.lsvGroupColumns.SelectedItems.Count == 0)
         {
             return;
         }
         IViewColumn column = this.lsvGroupColumns.SelectedItems[0].Tag as IViewColumn;
         this._targetView.GroupColumns.Remove(column);
         InitGroupColumnTab();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #29
0
 /// <summary>
 /// グループ項目追加
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddGroup_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.lsvFieldForGroup.SelectedItems.Count == 0)
         {
             return;
         }
         IFieldRef fld = this.lsvFieldForGroup.SelectedItems[0].Tag as IFieldRef;
         this._targetView.GroupColumns.Add(new ViewColumn(fld));
         InitGroupColumnTab();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
         RSM.ShowMessage(this, ex);
     }
 }
Exemple #30
0
        /// <summary>
        /// 入力内容チェック
        /// </summary>
        /// <returns></returns>
        private bool ValidateInputs()
        {
            //ビュータイトル
            if (string.IsNullOrWhiteSpace(this.txtViewTitle.Text))
            {
                RSM.ShowMessage(this, RS.Exclamations.NotViewTitle);
                FocusControl(this.txtViewTitle);
                return(false);
            }
            //ビュー表示列
            if (this.lsvColumns.Items.Count == 0)
            {
                RSM.ShowMessage(this, RS.Exclamations.NotDisplayColumn);
                FocusControl(this.txtViewTitle);
                return(false);
            }

            return(true);
        }