Ejemplo n.º 1
0
        /// <summary>
        /// Consulta por las tareas a WebApi y las hace correr asincronicamente
        /// </summary>
        protected void RunTasks()
        {
            EventLog.WriteEntry("RunTasks", EventLogEntryType.Information);

            CanvasApiClient.GetInstance().SetSessionToken(UKSync.Properties.Settings.Default.Token);

            CanvasApiClient.GetInstance().ApiPost <HttpResponseMessage>("api/USER/SYNC", null);
            EventLog.WriteEntry("Sync user", EventLogEntryType.Information);

            CanvasApiClient.GetInstance().ApiPost <HttpResponseMessage>("api/INSCRIPTION/SYNC", null);
            EventLog.WriteEntry("Sync inscription", EventLogEntryType.Information);
        }
Ejemplo n.º 2
0
        protected override void OnStop()
        {
            try
            {
                EventLog.WriteEntry("OnStop", EventLogEntryType.Information);
                logger.Info("Deteniendo el servicio");
                this.runTasks = false;
                CanvasApiClient.GetInstance().Dispose();
                base.OnStop();
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry(String.Concat("OnStop - ", ex.Message), EventLogEntryType.Error);

                logger.Error(ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Consulta por las tareas a WebApi y las hace correr asincronicamente
        /// </summary>
        protected void RunTasks()
        {
            EventLog.WriteEntry("Run Tasks", EventLogEntryType.Information);

            EventLog.WriteEntry("Task: Set token - STARTED", EventLogEntryType.Information);
            try
            {
                CanvasApiClient.GetInstance().SetSessionToken(UKSync.Properties.Settings.Default.Token);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Task: Set token - ERROR: " + e.Message + " - " + e.InnerException, EventLogEntryType.Error);
            }
            EventLog.WriteEntry("Task: Set token - FINISHED WITHOUT ERROR", EventLogEntryType.SuccessAudit);

            EventLog.WriteEntry("Task: Sync User - STARTED", EventLogEntryType.Information);
            try
            {
                CanvasApiClient.GetInstance().ApiPost <HttpResponseMessage>("api/USER/SYNC", null);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Task: Sync User - ERROR: " + e.Message + " - " + e.InnerException, EventLogEntryType.Error);
            }
            EventLog.WriteEntry("Task: Sync User - FINISHED WITHOUT ERROR", EventLogEntryType.Information);

            EventLog.WriteEntry("Task: Sync inscription - STARTED", EventLogEntryType.Information);
            try
            {
                CanvasApiClient.GetInstance().ApiPost <HttpResponseMessage>("api/INSCRIPTION/SYNC", null);
            }
            catch (Exception e)
            {
                EventLog.WriteEntry("Task: Sync inscription - ERROR: " + e.Message + " - " + e.InnerException, EventLogEntryType.Error);
            }
            EventLog.WriteEntry("Task: Sync inscription - FINISHED WITHOUT ERROR", EventLogEntryType.SuccessAudit);
        }