///<summary>
        ///Obtiene una lista de tareas recurrentes
        ///</summary>
        public List <RecurringJobViewModel> GetRecurringJobs()
        {
            List <RecurringJobDto>       recurringJobs     = JobStorage.Current.GetConnection().GetRecurringJobs();
            List <RecurringJobViewModel> recurringJobsView = new List <RecurringJobViewModel>();

            foreach (RecurringJobDto recurringJob in recurringJobs)
            {
                RecurringJobViewModel recurringJobViewModel = new RecurringJobViewModel()
                {
                    CreatedAt     = recurringJob.CreatedAt,
                    Cron          = recurringJob.Cron,
                    Error         = recurringJob.Error,
                    Id            = recurringJob.Id,
                    LastExecution = recurringJob.LastExecution,
                    LastJobId     = recurringJob.LastJobId,
                    LastJobState  = recurringJob.LastJobState,
                    NextExecution = recurringJob.NextExecution,
                    Queue         = recurringJob.Queue,
                    Removed       = recurringJob.Removed,
                    TimeZoneId    = recurringJob.TimeZoneId
                };
                recurringJobsView.Add(recurringJobViewModel);
            }
            return(recurringJobsView);
        }
Beispiel #2
0
        /// <summary>
        /// Obtiene una tarea recurrente
        /// </summary>
        /// <param name="name">Nombre de la tarea recurrente</param>
        /// <returns>Una tarea recurrente</returns>
        public RecurringJobViewModel GetRecurringJob(string name)
        {
            string result = _serviceApi.CallGetApi("", $"{_urlRecurringJobApi}/{name}", _token);
            RecurringJobViewModel resultObject = JsonConvert.DeserializeObject <RecurringJobViewModel>(result);

            return(resultObject);
        }
        ///<summary>
        ///Obtiene una tarea recurrente
        ///</summary>
        ///<param name="id">nombre de la tarea recurrente</param>
        public RecurringJobViewModel GetRecurringJobs(string id)
        {
            RecurringJobViewModel recurringJob = GetRecurringJobs().FirstOrDefault(item => item.Id.Equals(id));

            return(recurringJob);
        }