public static void UpdateCanvasData(int?idEntidad, InscriptionReturn newInscription) { logger.Info("InscriptionDAL/UpdateCanvasData - Task 'Update inscription data in Canvas' STARTED"); if (newInscription != null) { using (var context = new CANVAS_Model_Entities()) { uniCanvasEnrolamiento newCanvasInscription = context.uniCanvasEnrolamientos.Where(x => x.ID == idEntidad).FirstOrDefault(); if (newInscription.error_message == null) { newCanvasInscription.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Sincronizado.GetHashCode(); newCanvasInscription.Fecha = DateTime.Now; newCanvasInscription.IDCanvas = Int32.Parse(newInscription.id); } else { newCanvasInscription.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Error.GetHashCode(); } newCanvasInscription.Error = newInscription.error_message; context.SaveChanges(); } } logger.Info("InscriptionDAL/UpdateCanvasData - Task 'Update inscription data in Canvas' FINISHED"); }
public static void UpdateCanvasData(int?idEntidad, UserReturn newUser) { logger.Info("UserDAL/UpdateCanvasData - Task 'Update user data from Canvas' STARTED"); if (newUser != null) { using (var context = new CANVAS_Model_Entities()) { uniCanvasUsuario newCanvasUser = context.uniCanvasUsuarios.Where(x => x.IDAcademico == idEntidad).FirstOrDefault(); if (newUser.error_message == null) { newCanvasUser.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Sincronizado.GetHashCode(); newCanvasUser.Fecha = DateTime.Now; newCanvasUser.IDCanvas = Int32.Parse(newUser.id); } else { newCanvasUser.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Error.GetHashCode(); } newCanvasUser.Error = newUser.error_message; context.SaveChanges(); } logger.Info("UserDAL/UpdateCanvasData - Task 'Update user data from Canvas' FINISHED"); } logger.Info("UserDAL/UpdateCanvasData - Task 'Update user data from Canvas' FINISHED"); }
public static void UpdateCanvasData(int?idEntidad, SectionDTO newSection, int?canvasGroupId) { logger.Info("SectionDAL/SectionsToSync - Task 'Get a list with the sections to sync' STARTED"); if (newSection != null) { using (var context = new CANVAS_Model_Entities()) { uniCanvasCursosSeccione newCanvasCourseSection = context.uniCanvasCursosSecciones.Where(x => x.IDAcademico == idEntidad).FirstOrDefault(); if (newSection.error_message == null) { newCanvasCourseSection.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Sincronizado.GetHashCode(); newCanvasCourseSection.Fecha = DateTime.Now; newCanvasCourseSection.IDCanvas = Int32.Parse(newSection.id); newCanvasCourseSection.IDCanvasGrupo = canvasGroupId; } else { newCanvasCourseSection.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Error.GetHashCode(); newCanvasCourseSection.Fecha = DateTime.Now; } newCanvasCourseSection.Error = newSection.error_message; context.SaveChanges(); } } }
public static void UpdateConcludedCourseCanvasData(uniCanvasCurso aux) { // TODO: Enviar solo el ID como parametro using (var context = new CANVAS_Model_Entities()) { try { uniCanvasCurso courseToConclude = context.uniCanvasCursos.Where(x => x.IDAcademico == aux.IDAcademico).FirstOrDefault(); if (courseToConclude != null) { courseToConclude.Concluido = true; context.SaveChanges(); } } catch { //TODO: Loguear la falta del curso en la staging logger.Error("Error al marcar el curso " + aux.IDAcademico + " como concluido."); } } }
public static void UpdateCanvasData(string idEntidad, CourseReturn newCourse) { if (newCourse != null) { using (var context = new CANVAS_Model_Entities()) { uniCanvasCurso newCanvasCourse = context.uniCanvasCursos.Where(x => x.IDAcademico == idEntidad).FirstOrDefault(); if (newCourse.error_message == null) { newCanvasCourse.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Sincronizado.GetHashCode(); newCanvasCourse.Fecha = DateTime.Now; newCanvasCourse.IDCanvas = Int32.Parse(newCourse.id); } else { newCanvasCourse.Estado = CanvasWebApi.Common.ConfigEnum.CanvasState.Error.GetHashCode(); } newCanvasCourse.Error = newCourse.error_message; context.SaveChanges(); } } }