示例#1
0
        /// <summary>プロジェクトの異常処理</summary>
        void App_DispatcherUnhandledException(object sender,
                                              DispatcherUnhandledExceptionEventArgs e)
        {
            if (e.Exception is DBException)
            {
                DBException ex = (DBException)e.Exception;
                LogInfo.WriteErrorLog(ex.MessageID, ex);
                LogInfo.WriteFatalLog(ex.InnerException);
                CommonDialog.ShowErrorDialog(ex.MessageID);
            }
            else if (e.Exception is FileException)
            {
                FileException ex = (FileException)e.Exception;
                LogInfo.WriteErrorLog(ex.MessageID, ex.InnerException);
                CommonDialog.ShowErrorDialog(ex.MessageID);
            }
            else if (e.Exception is BaseException)
            {
                BaseException ex = (BaseException)e.Exception;
                LogInfo.WriteErrorLog(ex.MessageID, ex.InnerException);
                CommonDialog.ShowErrorDialog(ex.MessageID);
            }
            else
            {
                LogInfo.WriteErrorLog(Consts.SYSERR_003, e.Exception);
                CommonDialog.ShowErrorDialog(Consts.SYSERR_003);
            }


            e.Handled = true;
        }
示例#2
0
        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            MessageBoxResult result;

            Exception exception = (Exception)e.ExceptionObject;

            if (exception is DBException)
            {
                DBException ex = (DBException)exception;
                LogInfo.WriteErrorLog(ex.MessageID, ex);
                LogInfo.WriteFatalLog(ex.InnerException);
                result = CommonDialog.ShowErrorDialog(ex.MessageID);
            }
            else if (exception is FileException)
            {
                FileException ex = (FileException)exception;
                LogInfo.WriteErrorLog(ex.MessageID, ex.InnerException);
                result = CommonDialog.ShowErrorDialog(ex.MessageID);
            }
            else if (exception is BaseException)
            {
                BaseException ex = (BaseException)exception;
                LogInfo.WriteErrorLog(ex.MessageID, ex.InnerException);
                result = CommonDialog.ShowErrorDialog(ex.MessageID);
            }
            else
            {
                LogInfo.WriteErrorLog(Consts.SYSERR_003, exception);
                result = CommonDialog.ShowErrorDialog(Consts.SYSERR_003);
            }
            if (result == MessageBoxResult.OK)
            {
                Environment.Exit(ERROR_EXIT_CODE);
            }
        }
 //*******************************************************************
 /// <summary>入力チェック </summary>
 /// <returns>チェック結果</returns>
 //*******************************************************************
 private bool InputCheck()
 {
     // ジョブネット名が未入力の場合
     if (CheckUtil.IsNullOrEmpty(textBox_fileName.Text))
     {
         CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_014);
         return(false);
     }
     return(true);
 }
示例#4
0
        /// <summary>ログイン処理</summary>
        private void login()
        {
            if (!dsnList.Contains <String>(((JobconDBSource)this.comboBox_jobarg.SelectedItem).DBS))
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_LOGIN_005);
                return;
            }
            String    connectStr = ((JobconDBSource)this.comboBox_jobarg.SelectedItem).ConnnectStr;
            DBConnect dbConnect;
            bool      authSuccess = false;

            dbConnect = new DBConnect(connectStr);
            try
            {
                dbConnect.CreateSqlConnect();
            }
            catch (Exception e)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_LOGIN_006);
                return;
            }
            authSuccess = auth(dbConnect);
            if (authSuccess)
            {
                if (!CheckUserStatus(dbConnect))
                {
                    CommonDialog.ShowErrorDialog(Consts.ERROR_LOGIN_002);
                    dbConnect.CloseSqlConnect();
                    return;
                }
                if (LoginSetting.Lang.Equals("ja_jp"))
                {
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP", false);
                }
                else if (LoginSetting.Lang.Equals("ko_kr"))
                {
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo("ko-KR", false);
                }
                else
                {
                    LoginSetting.Lang = "en_us";
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", false);
                }
                JobArrangerWindow jobArrangerWindow = new JobArrangerWindow();
                jobArrangerWindow.Show();
                this.Close();
            }
            else
            {
                dbConnect.CloseSqlConnect();
                CommonDialog.ShowErrorDialog(Consts.ERROR_LOGIN_001);
            }
        }
        /// <summary>展開チェック</summary>
        private void checkInvoid(Object sender, EventArgs e)
        {
            DataTable dt = DBUtil.GetRunJobnetSummary(_innerJobnetId);

            if (dt.Rows.Count > 0)
            {
                //added by YAMA 2014/07/09
                int load_status = (Int32)dt.Rows[0]["load_status"];

                if (load_status == 0)
                {
                    //added by YAMA 2014/07/11
                    int multiple_start_up = (Int32)dt.Rows[0]["multiple_start_up"];
                    // 1:スキップ、2:待ち合せ の時だけ待つ
                    if (multiple_start_up != 0)
                    {
                        //added by YAMA 2014/07/10
                        if (checkInvoid_counter < 1)
                        {
                            checkInvoid_counter++;
                            return;
                        }
                    }

                    checkInvoid_counter = 0;

                    dispatcherTimer.Stop();
                    this.Close();
                    JobnetExecDetail detail = new JobnetExecDetail(_innerJobnetId, false);
                    detail.Topmost = true;
                    detail.Show();
                    return;
                }
                // 遅延起動
                else if (load_status == 2)
                {
                    dispatcherTimer.Stop();
                    this.Close();
                    CommonDialog.ShowErrorDialog(Consts.ERROR_JOBNET_LOAD_002);
                    return;
                }
                // 実行スキップ
                else if (load_status == 3)
                {
                    dispatcherTimer.Stop();
                    this.Close();
                    CommonDialog.ShowErrorDialog(Consts.ERROR_JOBNET_LOAD_003);
                    return;
                }
                //added by YAMA 2014/07/10
                else
                {
                    dispatcherTimer.Stop();
                    this.Close();
                    CommonDialog.ShowErrorDialog(Consts.ERROR_JOBNET_LOAD_001);
                    return;
                }
            }
            DateTime now = DateTime.Now;
            TimeSpan duration;

            duration = now - startTime;
            if (duration.TotalSeconds > TimeOut)
            {
                dispatcherTimer.Stop();
                this.Close();
            }
        }
        //*******************************************************************
        /// <summary>OKボタンクリック</summary>
        /// <param name="sender">源</param>
        /// <param name="e">マウスイベント</param>
        //*******************************************************************
        private void ok_Click(object sender, EventArgs e)
        {
            // 開始ログ
            base.WriteStartLog("ok_Click", Consts.PROCESS_012);

            // 入力チェック
            if (!InputCheck())
            {
                return;
            }
            System.IO.StreamWriter file = null;
            try
            {
                file =
                    new System.IO.StreamWriter(textBox_fileName.Text, false);
                //DataSet ds = DBUtil.Export(_objectId, _objectType, _rows);//org

                if (_rows != null && _rows.Length > 1)
                {
                    for (int i = 0; i < _rows.Length; i++)
                    {
                        DataRow row = _rows[i];
                        _objectId = row["object_id"].ToString();
                    }
                    DataSet ds = DBUtil.Export(_objectId, _objectType, _rows);
                    ds.WriteXml(file);
                }
                else
                {
                    if (_objectId == null && _rows != null)
                    {
                        DataRow row = _rows[0];
                        _objectId = row["object_id"].ToString();
                    }

                    DataSet ds = DBUtil.Export(_objectId, _objectType, _rows);
                    ds.WriteXml(file);
                }

                /* org
                 * ds.WriteXml(file);
                 * file.Close();
                 * this.Close();
                 *
                 * System.IO.DirectoryInfo dirInfoBar = new System.IO.DirectoryInfo(textBox_fileName.Text);
                 * System.IO.DirectoryInfo dirInfo = dirInfoBar.Parent;
                 *
                 * Consts.EXPORT_PATH = dirInfo.FullName;
                 *
                 */
            }
            catch (ArgumentException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_019);
            }
            catch (NotSupportedException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_019);
            }
            catch (DirectoryNotFoundException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_022);
            }
            catch (UnauthorizedAccessException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_023);
            }
            catch (System.IO.IOException ex)
            {
                CommonDialog.ShowErrorDialogFromMessage(ex.Message);
            }
            catch (Exception ex)
            {
                CommonDialog.ShowErrorDialogFromMessage(ex.Message);
            }
            finally
            {
                file.Close();
                this.Close();

                System.IO.DirectoryInfo dirInfoBar = new System.IO.DirectoryInfo(textBox_fileName.Text);
                System.IO.DirectoryInfo dirInfo    = dirInfoBar.Parent;

                Consts.EXPORT_PATH = dirInfo.FullName;
            }
            // 終了ログ
            base.WriteEndLog("ok_Click", Consts.PROCESS_012);
        }
        //*******************************************************************
        /// <summary>OKボタンクリック</summary>
        /// <param name="sender">源</param>
        /// <param name="e">マウスイベント</param>
        //*******************************************************************
        private void ok_Click(object sender, EventArgs e)
        {
            // 開始ログ
            base.WriteStartLog("ok_Click", Consts.PROCESS_013);

            // 入力チェック
            if (!InputCheck())
            {
                return;
            }

            try
            {
                System.IO.FileStream    fs         = new System.IO.FileStream(textBox_fileName.Text, System.IO.FileMode.Open);
                System.IO.DirectoryInfo dirInfoBar = new System.IO.DirectoryInfo(textBox_fileName.Text);
                System.IO.DirectoryInfo dirInfo    = dirInfoBar.Parent;

                Consts.IMPORT_PATH = dirInfo.FullName;

                DataSet ds = new DataSet();
                try
                {
                    ds.ReadXml(fs, XmlReadMode.InferSchema);
                }
                catch (Exception ex)
                {
                    CommonDialog.ShowErrorDialog(Consts.ERROR_IMPORT_001);
                    return;
                }
                try
                {
                    DataTable userInfo = checkUserInfo(ds);
                    if (userInfo == null)
                    {
                        CommonDialog.ShowErrorDialog(Consts.ERROR_IMPORT_002);
                        return;
                    }
                    if (!checkImportAuth(userInfo))
                    {
                        CommonDialog.ShowErrorDialog(Consts.ERROR_IMPORT_003);
                        return;
                    }

                    Consts.ImportResultType result = DBUtil.ImportForm(ds, (bool)CheckBoxOverride.IsChecked);
                    if (result == Consts.ImportResultType.DubleKeyErr)
                    {
                        CommonDialog.ShowErrorDialog(Consts.ERROR_IMPORT_004);
                        return;
                    }
                    if (result == Consts.ImportResultType.RelationErr)
                    {
                        CommonDialog.ShowErrorDialog(Consts.ERROR_IMPORT_005);
                        return;
                    }
                    fs.Close();
                    Close();
                    _jobArrangerWindow.RefreshObjectList();
                }
                catch (Exception ex1)
                {
                    throw ex1;
                }
                finally
                {
                    fs.Close();
                }
            }
            catch (ArgumentException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_019);
            }
            catch (NotSupportedException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_019);
            }
            catch (DirectoryNotFoundException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_022);
            }
            catch (FileNotFoundException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_011);
            }
            catch (UnauthorizedAccessException ex)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_COMMON_023);
            }
            catch (System.IO.IOException ex)
            {
                CommonDialog.ShowErrorDialogFromMessage(ex.Message);
            }
            catch (Exception ex)
            {
                CommonDialog.ShowErrorDialogFromMessage(ex.Message);
            }

            // 終了ログ
            base.WriteEndLog("ok_Click", Consts.PROCESS_013);
        }