From 14d8e49f96971e1db09985d0fb21f44b7d6c12c8 Mon Sep 17 00:00:00 2001 From: jmoya Date: Mon, 10 Sep 2018 20:27:11 +0000 Subject: [PATCH] git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C459 --- .../AYA.SlnSynor.WCF/ISinortCatalogos.cs | 3 + .../AYA.SlnSynor.WCF/SinortCatalogos.svc.cs | 15 +++++ .../DetallePropuestaNormativa.js | 62 ++++++++++++------- .../DetallePropuesta.cshtml | 2 +- .../Sinort/UsuarioDAL.cs | 24 +++++++ 5 files changed, 81 insertions(+), 25 deletions(-) diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs index 92685eef5..e6ceaa507 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs @@ -107,6 +107,9 @@ namespace AYA.SlnSinort.WCF [OperationContract] Usuario BuscarUsuario(CatalogosPostJSON model); + [OperationContract] + RolesUsuario BuscarUsuarioRol(CatalogosPostJSON model); + [OperationContract] List ObtenerUsuariosRol(CatalogosPostJSON model); diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs index cba688cf8..894b1a323 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs @@ -476,6 +476,21 @@ namespace AYA.SlnSinort.WCF } return respuesta; } + public RolesUsuario BuscarUsuarioRol(CatalogosPostJSON model) + { + RolesUsuario respuesta = null; + try + { + respuesta = new UsuarioDAL().BuscarUsuarioRol(model); + + } + catch (Exception ex) + { + log.Error(ex); + } + return respuesta; + } + public List ObtenerUsuariosRol(CatalogosPostJSON model) { List respuesta = null; diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js index b42801adb..45ca4866e 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PropuestaNormativa/DetallePropuestaNormativa.js @@ -212,7 +212,7 @@ this.getDataModel = function () { $("#btnAgregarUsuario").unbind("click"); $("#btnAgregarUsuario").click(function () { - AgregarUsuario(); + VerificarRolUsuario(); }); $("#btnAgregarComentario").unbind("click"); @@ -675,11 +675,24 @@ this.BuscarUsuario = function () { } } - -this.AgregarUsuario = function () { +this.VerificarRolUsuario = function () { if ($("#txtUsuario").val() != "") { + model = { + codigo: $('#hiddenUsuario').val() + } + var uri = CatalogosWCF + '/api/BuscarUsuarioRol'; + AjaxPostData(uri, model, false, false, AgregarUsuario, null, null); + } + else { + toastr.warning("Debe seleccionar un usuario", Message_Warning); + } +} +this.AgregarUsuario = function (data) { + + if (data != null) { + if (!confirm("¿Desea convocar a un nuevo usuario?")) return; @@ -690,11 +703,11 @@ this.AgregarUsuario = function () { var repetido = false; - var data = tableParticipantes + var datos = tableParticipantes .rows() .data(); - $.each(data, function (key, item) { + $.each(datos, function (key, item) { if (item[1].toLowerCase() == $("#hiddenUsuario").val()) { repetido = true @@ -725,26 +738,26 @@ this.AgregarUsuario = function () { AjaxPostData(uri, model, false, true, GuardarTareasPendientes, null, null); - } else { - toastr.warning("Debe seleccionar un usuario", Message_Warning); + //participanteConfirmado = replaceAll("[$icon]", "fa-check-circle", participanteConfirmado); + //participanteConfirmado = replaceAll("[$state_color]", "muted", participanteConfirmado); + + //tableParticipantes.row.add( + // [participanteConfirmado, + // $("#hiddenUsuario").val(), + // $("#txtUsuario").val(), + // moment().format('DD-MM-YYYY'), + // option]) + // .draw(); + + //toastr.success(Message_Default, Message_Success); + } + else { + toastr.warning("El usuario seleccionado no tiene ningún rol asignado", Message_Warning); } - - - //participanteConfirmado = replaceAll("[$icon]", "fa-check-circle", participanteConfirmado); - //participanteConfirmado = replaceAll("[$state_color]", "muted", participanteConfirmado); - - //tableParticipantes.row.add( - // [participanteConfirmado, - // $("#hiddenUsuario").val(), - // $("#txtUsuario").val(), - // moment().format('DD-MM-YYYY'), - // option]) - // .draw(); - - //toastr.success(Message_Default, Message_Success); - } + + this.GuardarTareasPendientes = function () { var ArrayConvocados = []; @@ -1170,7 +1183,7 @@ this.GuardarComentarioMatriz = function () { IdDocumento: Iddoc } - AjaxPostData(uri, model, false, false, ComentarioMatrizGuardado, null, null); + AjaxPostData(uri, model, false, true, ComentarioMatrizGuardado, null, null); } @@ -1190,7 +1203,8 @@ this.ComentarioMatrizGuardado = function (data) { $('#modalElemento').modal('hide'); var tableDocMatriz = $('#tableDocMatriz').DataTable(); tableDocMatriz.clear().draw(); - CargarMatriz(); + CargarMatriz(); location.reload(true); + //$('#tabs ul li:nth-child(3) a').addClass("active"); ENDREQUEST(); } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/DetallePropuesta.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/DetallePropuesta.cshtml index f08c6208e..fb2c570c8 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/DetallePropuesta.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/PropuestaNormativa/DetallePropuesta.cshtml @@ -18,7 +18,7 @@ background-image:url(http://AYA-VSRV-APPTT:2525/dist/img/ajax-loader.gif);backgr
-
    +