Ejemplo n.º 1
0
        private static void ScheduleJob(string name, string description, string data, string metaData, string jobType, TimeSpan?absoluteTimeout, byte queueId, string application, string group, bool suppressHistory, bool deleteWhenDone, SimpleSchedule schedule)
        {
            if (!schedule.StartDailyAt.HasValue)
            {
                schedule.StartDailyAt = new TimeSpan();
            }
            ScheduleJobRequest request = new ScheduleJobRequest
            {
                Application      = application,
                DeleteWhenDone   = deleteWhenDone,
                Description      = description,
                Name             = name,
                QueueId          = queueId,
                Type             = jobType,
                MetaData         = metaData,
                Data             = data,
                AbsoluteTimeout  = absoluteTimeout,
                Group            = group,
                CalendarSchedule = new CalendarSchedule
                {
                    ScheduleType = typeof(global::BackgroundWorkerService.Logic.DataModel.Scheduling.CalendarSchedule).AssemblyQualifiedName,
                    DaysOfWeek   = schedule.DaysOfWeek.ToArray(),
                    StartDailyAt = new TimeOfDay {
                        Hour = schedule.StartDailyAt.Value.Hours, Minute = schedule.StartDailyAt.Value.Minutes, Second = schedule.StartDailyAt.Value.Seconds
                    },
                    RepeatInterval = schedule.RepeatInterval,
                    EndDateTime    = null,
                    StartDateTime  = DateTime.Now,
                },
            };

            using (AccessPointClient client = new AccessPointClient())
            {
                client.ScheduleJob(request);
            }
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     using (AccessPointClient client = new AccessPointClient())
     {
         var job = client.CreateJob(new CreateJobRequest
         {
             Data     = "bob",
             MetaData =
                 JobBuilder.CreateBasicHttpSoap_BasicCallbackJobMetaData(
                     "metaData",
                     "http://*****:*****@b.com", "*****@*****.**"), null, out data, out metadata);
         var job3 = client.ScheduleJob(new ScheduleJobRequest
         {
             Data             = data,
             MetaData         = metadata,
             Type             = typeof(SendMailJob).AssemblyQualifiedName,
             QueueId          = 1,
             CalendarSchedule = new CalendarSchedule
             {
                 ScheduleType = typeof(BackgroundWorkerService.Logic.DataModel.Scheduling.CalendarSchedule).AssemblyQualifiedName,                         //Must set this
                 DaysOfWeek   = new List <DayOfWeek> {
                     DayOfWeek.Monday
                 }.ToArray(),
                 StartDateTime = DateTime.Now,
                 StartDailyAt  = new TimeOfDay {
                     Hour = 0, Minute = 30, Second = 0
                 },
             }
         });
         var job4 = client.CreateJob(new CreateJobRequest
         {
             Data     = "",
             MetaData =
                 JobBuilder.GetWebRequestJobMetaData(
                     "http://localhost:2048/default.aspx",
                     System.Net.HttpStatusCode.OK,
                     true).Serialize(),
             Type            = typeof(WebRequestJob).AssemblyQualifiedName,
             QueueId         = 0,
             DeleteWhenDone  = false,
             SuppressHistory = false,
             Name            = "Ping Service WebUI",
             Description     = "This pings the web ui to check whether it's still running.",
         });
     }
 }