Пример #1
0
        private void ImportJobForm_Load(object sender, EventArgs e)
        {
            Cancelled = false;
            //Few changes based on form mode (create or edit)
            Text = ImportJobDetail == null
                ? Resources.Add_import_job
                : string.Format(Resources.Edit_job_0, ImportJobDetail.Key.Name);
            addToolStripButton.Text = ImportJobDetail == null ? Resources.Add_to_schedule : Resources.Edit_job;
            jobName.Enabled         = ImportJobDetail == null;

            jobGroupComboBox.DataSource    = Properties.Settings.Default.JobGroups;
            jobGroupComboBox.ValueMember   = null;
            jobGroupComboBox.DisplayMember = "Name";

            jobGroupComboBox.Enabled = ImportJobDetail == null;

            instanceComboBox.DataSource    = Properties.Settings.Default.Instances;
            instanceComboBox.ValueMember   = null;
            instanceComboBox.DisplayMember = "Name";

            appRegistrationComboBox.DataSource    = Properties.Settings.Default.AadApplications.Where(x => x.AuthenticationType == AuthenticationType.User).ToList();
            appRegistrationComboBox.ValueMember   = null;
            appRegistrationComboBox.DisplayMember = "Name";

            userComboBox.DataSource    = Properties.Settings.Default.Users;
            userComboBox.ValueMember   = null;
            userComboBox.DisplayMember = "Login";

            orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions));

            importJobStartAtDateTimePicker.Value     = DateTime.Now;
            monitoringJobStartAtDateTimePicker.Value = DateTime.Now;

            inputFolderTextBox.Text             = Properties.Settings.Default.UploadInputFolder;
            uploadSuccessFolderTextBox.Text     = Properties.Settings.Default.UploadSuccessFolder;
            uploadErrorsFolderTextBox.Text      = Properties.Settings.Default.UploadErrorsFolder;
            processingSuccessFolderTextBox.Text = Properties.Settings.Default.ProcessingSuccessFolder;
            processingErrorsFolderTextBox.Text  = Properties.Settings.Default.ProcessingErrorsFolder;

            importFromPackageTextBox.Text                 = PackageApiActions.ImportFromPackageActionPath;
            getAzureWriteUrlTextBox.Text                  = PackageApiActions.GetAzureWriteUrlActionPath;
            getExecutionSummaryStatusTextBox.Text         = PackageApiActions.GetExecutionSummaryStatusActionPath;
            getExecutionSummaryPageUrlTextBox.Text        = PackageApiActions.GetExecutionSummaryPageUrlActionPath;
            getImportTargetErrorKeysFileUrlTextBox.Text   = PackageApiActions.GetImportTargetErrorKeysFileUrlPath;
            generateImportTargetErrorKeysFileTextBox.Text = PackageApiActions.GenerateImportTargetErrorKeysFilePath;
            getExecutionErrorsTextBox.Text                = PackageApiActions.GetExecutionErrorsPath;

            if (ImportJobDetail != null)
            {
                jobName.Text = ImportJobDetail.Key.Name;

                var jobGroup = ((IEnumerable <JobGroup>)jobGroupComboBox.DataSource).FirstOrDefault(x => x.Name == ImportJobDetail.Key.Group);
                jobGroupComboBox.SelectedItem = jobGroup;

                jobDescription.Text             = ImportJobDetail.Description;
                useStandardSubfolder.Checked    = false;
                inputFolderTextBox.Text         = ImportJobDetail.JobDataMap.GetString(SettingsConstants.InputDir);
                uploadSuccessFolderTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UploadSuccessDir);
                uploadErrorsFolderTextBox.Text  = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UploadErrorsDir);
                packageTemplateTextBox.Text     = ImportJobDetail.JobDataMap.GetString(SettingsConstants.PackageTemplate);
                legalEntityTextBox.Text         = ImportJobDetail.JobDataMap.GetString(SettingsConstants.Company);
                statusFileExtensionTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.StatusFileExtension);
                dataProject.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.DataProject);
                overwriteDataProjectCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.OverwriteDataProject);
                executeImportCheckBox.Checked        = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.ExecuteImport);
                delayBetweenFilesNumericUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenFiles);
                serviceAuthRadioButton.Checked       = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseServiceAuthentication);

                if (!serviceAuthRadioButton.Checked)
                {
                    User axUser = null;
                    if (!ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserName).IsNullOrWhiteSpace())
                    {
                        axUser = ((IEnumerable <User>)userComboBox.DataSource).FirstOrDefault(x => x.Login == ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserName));
                    }
                    if (axUser == null)
                    {
                        axUser = new User
                        {
                            Login    = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserName),
                            Password = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserPassword)
                        };
                        Properties.Settings.Default.Users.Add(axUser);
                        userComboBox.DataSource = Properties.Settings.Default.Users;
                    }
                    userComboBox.SelectedItem = axUser;
                }
                var application = ((IEnumerable <AadApplication>)appRegistrationComboBox.DataSource).FirstOrDefault(app => app.ClientId == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId));
                if (application == null)
                {
                    if (!serviceAuthRadioButton.Checked)
                    {
                        application = new AadApplication
                        {
                            ClientId           = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(),
                            Name               = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}",
                            AuthenticationType = AuthenticationType.User
                        };
                    }
                    else
                    {
                        application = new AadApplication
                        {
                            ClientId           = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(),
                            Secret             = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientSecret) ?? String.Empty,
                            Name               = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}",
                            AuthenticationType = AuthenticationType.Service
                        };
                    }
                    Properties.Settings.Default.AadApplications.Add(application);
                    appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications;
                }
                appRegistrationComboBox.SelectedItem = application;

                var axInstance = ((IEnumerable <Instance>)instanceComboBox.DataSource).FirstOrDefault(x =>
                                                                                                      (x.AosUri == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AosUri)) &&
                                                                                                      (x.AadTenant == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadTenant)) &&
                                                                                                      (x.AzureAuthEndpoint == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint)));
                if (axInstance == null)
                {
                    axInstance = new Instance
                    {
                        AosUri            = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AosUri),
                        AadTenant         = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadTenant),
                        AzureAuthEndpoint = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint),
                        UseADAL           = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseADAL),
                        Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}"
                    };
                    Properties.Settings.Default.Instances.Add(axInstance);
                    instanceComboBox.DataSource = Properties.Settings.Default.Instances;
                }
                instanceComboBox.SelectedItem = axInstance;

                searchPatternTextBox.Text  = ImportJobDetail.JobDataMap.GetString(SettingsConstants.SearchPattern) ?? "*.*";
                orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions));
                var selectedOrderBy = OrderByOptions.FileName;
                if (!ImportJobDetail.JobDataMap.GetString(SettingsConstants.OrderBy).IsNullOrWhiteSpace())
                {
                    selectedOrderBy = (OrderByOptions)Enum.Parse(typeof(OrderByOptions), ImportJobDetail.JobDataMap.GetString(SettingsConstants.OrderBy));
                }
                orderByComboBox.SelectedItem = selectedOrderBy;

                orderDescendingRadioButton.Checked    = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.ReverseOrder);
                inputFilesArePackagesCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.InputFilesArePackages);
                pauseIndefinitelyCheckBox.Checked     = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.IndefinitePause);

                if (ImportTrigger.GetType() == typeof(SimpleTriggerImpl))
                {
                    var localTrigger = (SimpleTriggerImpl)ImportTrigger;
                    importJobSimpleTriggerRadioButton.Checked = true;
                    importJobHoursDateTimePicker.Value        = DateTime.Now.Date + localTrigger.RepeatInterval;
                    importJobMinutesDateTimePicker.Value      = DateTime.Now.Date + localTrigger.RepeatInterval;
                    importJobStartAtDateTimePicker.Value      = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime();
                }
                else if (ImportTrigger.GetType() == typeof(CronTriggerImpl))
                {
                    var localTrigger = (CronTriggerImpl)ImportTrigger;
                    importJobCronTriggerRadioButton.Checked = true;
                    importJobCronExpressionTextBox.Text     = localTrigger.CronExpressionString;
                }

                retriesCountUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.RetryCount);
                retriesDelayUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.RetryDelay);

                pauseOnExceptionsCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.PauseJobOnException);

                importFromPackageTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.ImportFromPackageActionPath) ?? PackageApiActions.ImportFromPackageActionPath;
                getAzureWriteUrlTextBox.Text  = ImportJobDetail.JobDataMap.GetString(SettingsConstants.GetAzureWriteUrlActionPath) ?? PackageApiActions.GetAzureWriteUrlActionPath;

                multicompanyCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.MultiCompanyImport);
                getLegalEntityFromFilenameRadioButton.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetLegalEntityFromFilename);
                filenameSeparatorTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.FilenameSeparator);

                legalEntityTokenPositionNumericUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.LegalEntityTokenPosition);

                verboseLoggingCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.LogVerbose);

                Properties.Settings.Default.Save();
            }
            if ((ExecutionJobDetail != null) && (ExecutionTrigger != null))
            {
                useMonitoringJobCheckBox.Checked    = true;
                processingSuccessFolderTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.ProcessingSuccessDir);
                processingErrorsFolderTextBox.Text  = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.ProcessingErrorsDir);

                if (ExecutionTrigger.GetType() == typeof(SimpleTriggerImpl))
                {
                    var localTrigger = (SimpleTriggerImpl)ExecutionTrigger;
                    monitoringJobSimpleTriggerRadioButton.Checked = true;
                    monitoringJobHoursDateTimePicker.Value        = DateTime.Now.Date + localTrigger.RepeatInterval;
                    monitoringJobMinutesDateTimePicker.Value      = DateTime.Now.Date + localTrigger.RepeatInterval;
                    monitoringJobStartAtDateTimePicker.Value      = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime();
                }
                else if (ExecutionTrigger.GetType() == typeof(CronTriggerImpl))
                {
                    var localTrigger = (CronTriggerImpl)ExecutionTrigger;
                    monitoringJobCronTriggerRadioButton.Checked = true;
                    monitoringJobCronExpressionTextBox.Text     = localTrigger.CronExpressionString;
                }

                getExecutionSummaryStatusTextBox.Text         = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetExecutionSummaryStatusActionPath) ?? PackageApiActions.GetExecutionSummaryStatusActionPath;
                getExecutionSummaryPageUrlTextBox.Text        = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetExecutionSummaryPageUrlActionPath) ?? PackageApiActions.GetExecutionSummaryPageUrlActionPath;
                getImportTargetErrorKeysFileUrlTextBox.Text   = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetImportTargetErrorKeysFileUrlPath) ?? PackageApiActions.GetImportTargetErrorKeysFileUrlPath;
                generateImportTargetErrorKeysFileTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GenerateImportTargetErrorKeysFilePath) ?? PackageApiActions.GenerateImportTargetErrorKeysFilePath;
                getExecutionErrorsTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetExecutionErrorsPath) ?? PackageApiActions.GetExecutionErrorsPath;

                downloadErrorKeysFileCheckBox.Checked = ExecutionJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetImportTargetErrorKeysFile);
                getExecutionErrorsCheckBox.Checked    = ExecutionJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetExecutionErrors);
                statusCheckDelayNumericUpDown.Value   = ExecutionJobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenStatusCheck);
            }
            FormsHelper.SetDropDownsWidth(this);
        }
        private void ImportJobForm_Load(object sender, EventArgs e)
        {
            Cancelled = false;
            //Few changes based on form mode (create or edit)
            Text = ImportJobDetail == null
                ? Resources.Add_import_job
                : string.Format(Resources.Edit_job_0, ImportJobDetail.Key.Name);
            addJobButton.Text = ImportJobDetail == null ? Resources.Add_to_schedule : Resources.Edit_job;
            jobName.Enabled   = ImportJobDetail == null;

            jobGroupComboBox.DataSource    = Properties.Settings.Default.JobGroups;
            jobGroupComboBox.ValueMember   = null;
            jobGroupComboBox.DisplayMember = "Name";

            jobGroupComboBox.Enabled = ImportJobDetail == null;

            instanceComboBox.DataSource    = Properties.Settings.Default.Instances;
            instanceComboBox.ValueMember   = null;
            instanceComboBox.DisplayMember = "Name";

            var applications            = Properties.Settings.Default.AadApplications.Where(x => x.AuthenticationType == AuthenticationType.User);
            var applicationsBindingList = new BindingList <AadApplication>(applications.ToList());

            aadApplicationComboBox.DataSource    = applicationsBindingList;
            aadApplicationComboBox.ValueMember   = null;
            aadApplicationComboBox.DisplayMember = "Name";

            userComboBox.DataSource    = Properties.Settings.Default.Users;
            userComboBox.ValueMember   = null;
            userComboBox.DisplayMember = "Login";

            orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions));

            upJobStartAtDateTimePicker.Value   = DateTime.Now;
            procJobStartAtDateTimePicker.Value = DateTime.Now;

            inputFolderTextBox.Text             = Properties.Settings.Default.UploadInputFolder;
            uploadSuccessFolderTextBox.Text     = Properties.Settings.Default.UploadSuccessFolder;
            uploadErrorsFolderTextBox.Text      = Properties.Settings.Default.UploadErrorsFolder;
            processingSuccessFolderTextBox.Text = Properties.Settings.Default.ProcessingSuccessFolder;
            processingErrorsFolderTextBox.Text  = Properties.Settings.Default.ProcessingErrorsFolder;

            importFromPackagePath          = OdataActionsConstants.ImportFromPackageActionPath;
            getAzureWriteUrlPath           = OdataActionsConstants.GetAzureWriteUrlActionPath;
            getExecutionSummaryStatusPath  = OdataActionsConstants.GetExecutionSummaryStatusActionPath;
            getExecutionSummaryPageUrlPath = OdataActionsConstants.GetExecutionSummaryPageUrlActionPath;

            if (ImportJobDetail != null)
            {
                jobName.Text = ImportJobDetail.Key.Name;

                var jobGroup =
                    ((IEnumerable <JobGroup>)jobGroupComboBox.DataSource).FirstOrDefault(
                        x => x.Name == ImportJobDetail.Key.Group);
                jobGroupComboBox.SelectedItem = jobGroup;

                jobDescription.Text = ImportJobDetail.Description;

                useStandardSubfolder.Checked = false;
                inputFolderTextBox.Text      = ImportJobDetail.JobDataMap[SettingsConstants.InputDir]?.ToString() ??
                                               string.Empty;
                uploadSuccessFolderTextBox.Text =
                    ImportJobDetail.JobDataMap[SettingsConstants.UploadSuccessDir]?.ToString() ?? string.Empty;

                uploadErrorsFolderTextBox.Text =
                    ImportJobDetail.JobDataMap[SettingsConstants.UploadErrorsDir]?.ToString() ?? string.Empty;

                packageTemplateTextBox.Text =
                    ImportJobDetail.JobDataMap[SettingsConstants.PackageTemplate]?.ToString() ?? string.Empty;

                legalEntityTextBox.Text = ImportJobDetail.JobDataMap[SettingsConstants.Company]?.ToString() ??
                                          string.Empty;
                statusFileExtensionTextBox.Text =
                    ImportJobDetail.JobDataMap[SettingsConstants.StatusFileExtension]?.ToString() ?? ".Status";

                dataProject.Text = ImportJobDetail.JobDataMap[SettingsConstants.DataProject]?.ToString() ??
                                   string.Empty;

                overwriteDataProjectCheckBox.Checked =
                    (ImportJobDetail.JobDataMap[SettingsConstants.OverwriteDataProject] != null) &&
                    Convert.ToBoolean(ImportJobDetail.JobDataMap[SettingsConstants.OverwriteDataProject].ToString());

                executeImportCheckBox.Checked =
                    (ImportJobDetail.JobDataMap[SettingsConstants.ExecuteImport] != null) &&
                    Convert.ToBoolean(ImportJobDetail.JobDataMap[SettingsConstants.ExecuteImport].ToString());

                serviceAuthRadioButton.Checked =
                    (ImportJobDetail.JobDataMap[SettingsConstants.UseServiceAuthentication] != null) &&
                    Convert.ToBoolean(ImportJobDetail.JobDataMap[SettingsConstants.UseServiceAuthentication].ToString());
                if (!serviceAuthRadioButton.Checked)
                {
                    User axUser = null;
                    if (ImportJobDetail.JobDataMap[SettingsConstants.UserName] != null)
                    {
                        axUser =
                            ((IEnumerable <User>)userComboBox.DataSource).FirstOrDefault(
                                x => x.Login == ImportJobDetail.JobDataMap[SettingsConstants.UserName].ToString());
                    }
                    if (axUser == null)
                    {
                        var userName = ImportJobDetail.JobDataMap[SettingsConstants.UserName];
                        if (userName != null)
                        {
                            axUser = new User
                            {
                                Login    = userName.ToString(),
                                Password = ImportJobDetail.JobDataMap[SettingsConstants.UserPassword].ToString()
                            }
                        }
                        ;
                        var disabledUser = new Users {
                            axUser
                        };
                        userComboBox.DataSource = disabledUser;
                        userComboBox.Enabled    = false;
                    }
                    userComboBox.SelectedItem = axUser;
                }
                var application =
                    ((IEnumerable <AadApplication>)aadApplicationComboBox.DataSource).FirstOrDefault(app =>
                                                                                                     app.ClientId == ImportJobDetail.JobDataMap[SettingsConstants.AadClientId].ToString());
                if (application == null)
                {
                    if (ImportJobDetail.JobDataMap[SettingsConstants.AadClientSecret] == null)
                    {
                        application = new AadApplication
                        {
                            ClientId           = ImportJobDetail.JobDataMap[SettingsConstants.AadClientId].ToString(),
                            Name               = Resources.IMPORTED_CHANGE_THIS,
                            AuthenticationType = AuthenticationType.User
                        };
                        Properties.Settings.Default.AadApplications.Add(application);
                        applications =
                            Properties.Settings.Default.AadApplications.Where(x => x.AuthenticationType == AuthenticationType.User);
                        applicationsBindingList              = new BindingList <AadApplication>(applications.ToList());
                        aadApplicationComboBox.DataSource    = applicationsBindingList;
                        aadApplicationComboBox.ValueMember   = null;
                        aadApplicationComboBox.DisplayMember = "Name";
                    }
                    else
                    {
                        application = new AadApplication
                        {
                            ClientId           = ImportJobDetail.JobDataMap[SettingsConstants.AadClientId].ToString(),
                            Secret             = ImportJobDetail.JobDataMap[SettingsConstants.AadClientSecret].ToString(),
                            Name               = Resources.IMPORTED,
                            AuthenticationType = AuthenticationType.Service
                        };
                        var disabledApplication = new AadApplications {
                            application
                        };
                        aadApplicationComboBox.DataSource = disabledApplication;
                        aadApplicationComboBox.Enabled    = false;
                        authMethodPanel.Enabled           = false;
                    }
                }
                aadApplicationComboBox.SelectedItem = application;

                var axInstance = ((IEnumerable <Instance>)instanceComboBox.DataSource).FirstOrDefault(x =>
                                                                                                      (x.AosUri == ImportJobDetail.JobDataMap[SettingsConstants.AosUri].ToString()) &&
                                                                                                      (x.AadTenant == ImportJobDetail.JobDataMap[SettingsConstants.AadTenant].ToString()) &&
                                                                                                      (x.AzureAuthEndpoint == ImportJobDetail.JobDataMap[SettingsConstants.AzureAuthEndpoint].ToString()));
                if (axInstance == null)
                {
                    axInstance = new Instance
                    {
                        AosUri            = ImportJobDetail.JobDataMap[SettingsConstants.AosUri].ToString(),
                        AadTenant         = ImportJobDetail.JobDataMap[SettingsConstants.AadTenant].ToString(),
                        AzureAuthEndpoint = ImportJobDetail.JobDataMap[SettingsConstants.AzureAuthEndpoint].ToString(),
                        Name = Resources.IMPORTED_CHANGE_THIS
                    };
                    Properties.Settings.Default.Instances.Add(axInstance);
                }
                instanceComboBox.SelectedItem = axInstance;

                searchPatternTextBox.Text = ImportJobDetail.JobDataMap[SettingsConstants.SearchPattern]?.ToString() ??
                                            "*.*";
                orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions));
                var selectedOrderBy = OrderByOptions.FileName;
                if (ImportJobDetail.JobDataMap[SettingsConstants.OrderBy] != null)
                {
                    selectedOrderBy =
                        (OrderByOptions)
                        Enum.Parse(typeof(OrderByOptions),
                                   ImportJobDetail.JobDataMap[SettingsConstants.OrderBy].ToString());
                }
                orderByComboBox.SelectedItem = selectedOrderBy;

                orderDescendingRadioButton.Checked = (ImportJobDetail.JobDataMap[SettingsConstants.ReverseOrder] != null) &&
                                                     Convert.ToBoolean(
                    ImportJobDetail.JobDataMap[SettingsConstants.ReverseOrder]
                    .ToString());

                if (ImportTrigger.GetType() == typeof(SimpleTriggerImpl))
                {
                    var localTrigger = (SimpleTriggerImpl)ImportTrigger;
                    upJobSimpleTriggerRadioButton.Checked = true;
                    upJobHoursDateTimePicker.Value        = DateTime.Now.Date + localTrigger.RepeatInterval;
                    upJobMinutesDateTimePicker.Value      = DateTime.Now.Date + localTrigger.RepeatInterval;
                }
                else if (ImportTrigger.GetType() == typeof(CronTriggerImpl))
                {
                    var localTrigger = (CronTriggerImpl)ImportTrigger;
                    upJobCronTriggerRadioButton.Checked = true;
                    upJobCronExpressionTextBox.Text     = localTrigger.CronExpressionString;
                }
                if (ImportJobDetail.JobDataMap[SettingsConstants.RetryCount] != null)
                {
                    retriesCountUpDown.Value = Convert.ToDecimal(ImportJobDetail.JobDataMap[SettingsConstants.RetryCount]);
                }
                if (ImportJobDetail.JobDataMap[SettingsConstants.RetryDelay] != null)
                {
                    retriesDelayUpDown.Value = Convert.ToDecimal(ImportJobDetail.JobDataMap[SettingsConstants.RetryDelay]);
                }
                pauseOnExceptionsCheckBox.Checked =
                    (ImportJobDetail.JobDataMap[SettingsConstants.PauseJobOnException] != null) &&
                    Convert.ToBoolean(ImportJobDetail.JobDataMap[SettingsConstants.PauseJobOnException].ToString());

                importFromPackagePath = ImportJobDetail.JobDataMap[SettingsConstants.ImportFromPackageActionPath]?.ToString() ?? OdataActionsConstants.ImportFromPackageActionPath;
                getAzureWriteUrlPath  = ImportJobDetail.JobDataMap[SettingsConstants.GetAzureWriteUrlActionPath]?.ToString() ?? OdataActionsConstants.GetAzureWriteUrlActionPath;

                Properties.Settings.Default.Save();
            }
            if ((ExecutionJobDetail != null) && (ExecutionTrigger != null))
            {
                useMonitoringJobCheckBox.Checked    = true;
                processingSuccessFolderTextBox.Text =
                    ExecutionJobDetail.JobDataMap[SettingsConstants.ProcessingSuccessDir]?.ToString() ?? string.Empty;
                processingErrorsFolderTextBox.Text =
                    ExecutionJobDetail.JobDataMap[SettingsConstants.ProcessingErrorsDir]?.ToString() ?? string.Empty;

                if (ExecutionTrigger.GetType() == typeof(SimpleTriggerImpl))
                {
                    var localTrigger = (SimpleTriggerImpl)ExecutionTrigger;
                    procJobSimpleTriggerRadioButton.Checked = true;
                    procJobHoursDateTimePicker.Value        = DateTime.Now.Date + localTrigger.RepeatInterval;
                    procJobMinutesDateTimePicker.Value      = DateTime.Now.Date + localTrigger.RepeatInterval;
                }
                else if (ExecutionTrigger.GetType() == typeof(CronTriggerImpl))
                {
                    var localTrigger = (CronTriggerImpl)ExecutionTrigger;
                    procJobCronTriggerRadioButton.Checked = true;
                    procJobCronExpressionTextBox.Text     = localTrigger.CronExpressionString;
                }

                getExecutionSummaryStatusPath  = ExecutionJobDetail.JobDataMap[SettingsConstants.GetExecutionSummaryStatusActionPath]?.ToString() ?? OdataActionsConstants.GetExecutionSummaryStatusActionPath;
                getExecutionSummaryPageUrlPath = ExecutionJobDetail.JobDataMap[SettingsConstants.GetExecutionSummaryPageUrlActionPath]?.ToString() ?? OdataActionsConstants.GetExecutionSummaryPageUrlActionPath;
            }
        }