/// <summary>
        /// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
        /// fires that is associated with the <see cref="IJob" />.
        /// </summary>
        /// <remarks>
        /// The implementation may wish to set a  result object on the 
        /// JobExecutionContext before this method exits.  The result itself
        /// is meaningless to Quartz, but may be informative to 
        /// <see cref="IJobListener" />s or 
        /// <see cref="ITriggerListener" />s that are watching the job's 
        /// execution.
        /// </remarks>
        /// <param name="context">The execution context.</param>
        public void Execute(IJobExecutionContext context)
        {
            logger.Debug("RestfulServiceJob starts.");
            JobDataMap dataMap = context.MergedJobDataMap;  // Note the difference from the previous example

            string baseUrl = dataMap.GetString("baseUrl");
            string authenticationUrl = dataMap.GetString("authenticationUrl");
            string taskUrl = dataMap.GetString("taskUrl");
            string application = dataMap.GetString("application");
            string userName = dataMap.GetString("userName");
            string password = dataMap.GetString("password");
            if(!string.IsNullOrEmpty(password))
            {
                TripleDesProtectedConfigurationProvider cryptographyProvider = new TripleDesProtectedConfigurationProvider();
                password=cryptographyProvider.DecryptString(password);
            }
            CallWebService(baseUrl, authenticationUrl, taskUrl, application, userName, password);
            logger.Debug("RestfulServiceJob run finished.");
        }
Esempio n. 2
0
 private void btnEncrypt_Click(object sender, EventArgs e)
 {
     btnDecrypt.Enabled = false;
     btnEncrypt.Enabled = false;
     tbInput.Enabled = false;
     try
     {
         TripleDesProtectedConfigurationProvider provider =
         new TripleDesProtectedConfigurationProvider();
         tbOutput.Text=provider.EncryptString(tbInput.Text);
     }
     catch (Exception oEx)
     { tbOutput.Text = "Error: " + oEx.Message; }
     finally
     {
         btnDecrypt.Enabled = true;
         btnEncrypt.Enabled = true;
         tbInput.Enabled = true;
     }
 }