// Uncomment the method below to handle the event raised after a feature has been activated.
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            var app = properties.Feature.Parent as SPWebApplication;
            RemoveJobIfRegistered(app);

            var clientAccessPolicyJob = new ClientAccessPolicyDeploymentJob(JobName, app);
            var schedule = new SPOneTimeSchedule(DateTime.Now);
            clientAccessPolicyJob.Schedule = schedule;
            clientAccessPolicyJob.Update();

            app.JobDefinitions.Add(clientAccessPolicyJob);
            app.Update();

            clientAccessPolicyJob.RunNow();
        }
        protected void okButton_Click(object sender, EventArgs e)
        {
            var application = GetApplication();

            try
            {
                var xDocument = XDocument.Parse(configuration.Text);
            }
            catch (Exception)
            {
                LabelErrorMessage.Text = "Invalid XML configuration";
                return;
            }

            if (application.Properties.ContainsKey(Constants.PulsusConfigKey))
                application.Properties[Constants.PulsusConfigKey] = configuration.Text;
            else
                application.Properties.Add(Constants.PulsusConfigKey, configuration.Text);

            var configDeploymentJob = new ConfigDeploymentJob(Constants.ConfigDeploymentJobName, application);
            var schedule = new SPOneTimeSchedule(DateTime.Now);
            configDeploymentJob.Schedule = schedule;
            configDeploymentJob.Update();

            foreach (SPJobDefinition job in application.JobDefinitions)
                if (job.Title == Constants.ConfigDeploymentJobName)
                    job.Delete();

            application.JobDefinitions.Add(configDeploymentJob);
            application.Update();

            configDeploymentJob.RunNow();

            ReloadPulsusFeature(application);

            base.EndOperation(0);
        }
 /// <summary>
 /// Submits the job and schedules it to run on every server in the Farm.
 /// </summary>
 public void SubmitJob()
 {
     Schedule = new SPOneTimeSchedule(DateTime.Now);
     Title = "Update Layouts Sitemap (" + _uniqueID + ")";
     Update();
 }
 /// <summary>
 /// Submits the job.
 /// </summary>
 public void SubmitJob(string user, string password, List<string> urls)
 {
     Properties[KEY_USER] = user;
     Properties[KEY_PWD] = password;
     Properties[KEY_URLS] = urls;
     Schedule = new SPOneTimeSchedule(DateTime.Now);
     Update();
 }