// Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            try
            {
                SPContext.Current.Web.AllowUnsafeUpdates = true;

                SPAdministrationWebApplication caWebApp = SPAdministrationWebApplication.Local;
                //Delete any existing jobs
                string jobName = "Check License";
                foreach (SPJobDefinition job in caWebApp.JobDefinitions)
                {
                    if (job.Name.ToUpper().Equals(jobName.ToUpper()))
                    {
                        job.Delete();
                    }
                }

                //Schedule new job
                SPMonthlySchedule schedule4 = new SPMonthlySchedule();
                schedule4.BeginDay  = 1;
                schedule4.EndDay    = 1;
                schedule4.BeginHour = 2;
                schedule4.EndHour   = 6;
                LicenseChecker newJob4 = new LicenseChecker(jobName, caWebApp);
                newJob4.Schedule = schedule4;
                newJob4.Update();
            }
            catch (Exception ex)
            {
                SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(ex.Source, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, ex.Message, ex.Data);
            }
        }