From e6cac49bed097a608e4f209c038cb025ac3c50de Mon Sep 17 00:00:00 2001 From: jnunez Date: Thu, 14 Jun 2018 21:05:04 +0000 Subject: [PATCH] git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C49 --- .../AYA.SlnSynor.WCF/ISinortCatalogos.cs | 11 ++- .../AYA.SlnSynor.WCF/SinortCatalogos.svc.cs | 29 +++++- .../AYA.SlnSynor/AYA.SlnSinort.csproj | 2 - AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css | 1 + .../AYA.SlnSynor/Scripts/_references.js | Bin 587620 -> 587496 bytes .../AYA.SlnSynor/Sinort-Scripts/Rol.js | 91 ++++++++++++++---- .../Sinort-Scripts/RolesPantallas.js | 46 --------- .../AYA.SlnSynor/Views/Catalogos/Rol.cshtml | 27 +++--- .../Views/Catalogos/RolesPantallas.cshtml | 40 -------- .../AYA.SlnSynor/Views/Shared/_Layout.cshtml | 8 +- .../AYA.SlnSinortModel.DAL.csproj | 8 +- .../Sinort/AplicacionDAL.cs | 6 +- .../AYA.SlnSynorModel.DAL/Sinort/EmisorDAL.cs | 6 +- .../Sinort/PantallasDAL.cs | 32 +++++- .../AYA.SlnSynorModel.DAL/Sinort/RolesDAL.cs | 63 +++++++++++- .../AYA.SlnSynorModel.DAL/packages.config | 1 + .../AYA.SlnSinortModel.csproj | 1 + .../Entidades/CatalogosJSON.cs | 15 ++- .../AYA.SlnSynorModel/Sinort/Pantallas.cs | 9 ++ .../AYA.SlnSynorModel/Sinort/SinortContex.cs | 16 +-- .../AYA.SlnSynorModel/Sinort/sysdiagrams.cs | 24 +++++ .../NewtonsoftJsonDispatchFormatter.cs | 38 +++++--- 22 files changed, 314 insertions(+), 160 deletions(-) delete mode 100644 AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js delete mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/RolesPantallas.cshtml create mode 100644 AYA.SlnSynor/AYA.SlnSynorModel/Sinort/sysdiagrams.cs diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs index 46e43ead0..760ec3ef5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinortCatalogos.cs @@ -48,8 +48,17 @@ namespace AYA.SlnSinort.WCF #region Pantallas [OperationContract] - List ObtenerPantallas(Usuario model); + List ObtenerPantallas(CatalogosPostJSON model); + + [OperationContract] + List ObtenerPantallasRol(CatalogosPostJSON model); + #endregion + #region RolesPantallas + [OperationContract] + RolesPantallasJSON InsertarActualizarRolesPantallas(RolesPantallasJSON model); + #endregion + } } diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs index fed42f71b..7eb5695d5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/SinortCatalogos.svc.cs @@ -132,7 +132,7 @@ namespace AYA.SlnSinort.WCF #endregion #region Pantallas - public List ObtenerPantallas(Usuario model) + public List ObtenerPantallas(CatalogosPostJSON model) { List respuesta = new List(); try @@ -146,6 +146,33 @@ namespace AYA.SlnSinort.WCF } return respuesta; } + + public List ObtenerPantallasRol(CatalogosPostJSON model) + { + return new PantallasDAL().ObtenerPantallasRol(model); + } + #endregion + + #region RolesPantallas + + public RolesPantallasJSON InsertarActualizarRolesPantallas(RolesPantallasJSON model) + { + var rolesDAL = new RolesDAL(); + try + { + foreach(var rolPantalla in model.ListaRolesPantallas) + rolesDAL.InsertarActualizarRolesPantallas(rolPantalla); + + model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO; + } + catch (Exception ex) + { + model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + throw; + } + + return model; + } #endregion } diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index 4e3aaac17..e181f82f9 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7680,7 +7680,6 @@ - Web.config @@ -7712,7 +7711,6 @@ - diff --git a/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css b/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css index f5bf1ebfd..1fe4b8baf 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css +++ b/AYA.SlnSynor/AYA.SlnSynor/Content/toastr.css @@ -27,6 +27,7 @@ -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); filter: alpha(opacity=80); } + .toast-close-button:hover, .toast-close-button:focus { color: #000000; diff --git a/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js b/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js index 6ec38e4279b175630e3c74f0c36fe8e503cb50e7..27444dbe2151ce9d42596a706768b21d5bc1598d 100644 GIT binary patch delta 25 hcmaFzPWi=K<%Sl<7N!>F7M2#)7Pc1lEgUbt0RWY03cvsW delta 63 zcmaFyR{6<0<%Sl<7N!>F7M2#)7Pc1lEgUbtO`afbFx}uAhuriF-#FNWQyGdG3K$X@ R@)$~hWDXD}PJYNE3IHUB7DWI6 diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js index 90f2e52da..271360696 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js @@ -1,7 +1,7 @@ //$("#formCatalogo").EnableValidationToolTip(); var DataCatalogo; var id_column = 1; -var Item = {}; +var model = {}; //#region READY @@ -40,8 +40,9 @@ this.getDataModel = function () { }); $('#TableItems').TableInit(0, false, true, true, false, null, null); + $('#GridRolesPantallas').TableInit(0, false, true, true, false, null, null); ObtenerRoles(); - + } this.CargarGridRoles = function (data) { @@ -56,6 +57,7 @@ this.CargarGridRoles = function (data) { var pantallas = $("#ucbtnVistaPantallas").html(); var usuarios = $("#ucbtnVistaUsuarios").html(); option = replaceAll("[$CodItem]", item.IdRol, option); + pantallas = replaceAll("[$CodItem]", item.IdRol, pantallas); var stateIcon = $("#ucItemsIcon").html(); @@ -216,33 +218,82 @@ this.LimpiarControles = function () { $('#lbTituloAccion').append('Ingresar Nuevo Rol'); } -this.AbrirRolesPantallas = function () { +this.AbrirRolesPantallas = function (id) { $("#modalRolesPantallas").modal('show'); - CargarPantallas(); + CargarPantallas(id); } -this.CargarPantallas = function () { +this.CargarPantallas = function (id) { + + $('#hiddenIdRol').val(id) + var uri = CatalogosWCF + '/api/ObtenerPantallasRol'; + model = { + codigo: id + }; + + AjaxPostData(uri, model, true, false, CargarTablaPantallas, null, null); - var uri = CatalogosWCF + '/api/ObtenerPantallas'; - AjaxPostData(uri, Item, true, false, CargarTablaPantallas, null, null); } this.CargarTablaPantallas = function (data) { - if (data != null) { - lista = data; - var Seleccionar = $("#ucbtnCheck").html(); - var columnDefinition = [ - { "data": "Descripcion" }, - { "data": null, className: "center", defaultContent: Seleccionar } - ]; + var TableItems = $('#GridRolesPantallas').DataTable(); + TableItems.clear().draw(); + var lista = data; + + $.each(lista, function (key, item) { + + var pantallas = $("#ucbtnCheck").html(); + var id = item.IdPantalla; + + TableItems.row.add([id, + item.Descripcion, + '']).draw(); + }); + + ENDREQUEST(); + +} + +this.GuardarRolesPantallas = function () { + + if (!confirm("Va registrar las pantallas.\n ¿Desea continuar?")) + { return; } + + TablePantallas = $('#GridRolesPantallas').DataTable(); + var IdRoles = $('#hiddenIdRol').val(); + var ArrayRolesPantallas = []; + var data = TablePantallas + .rows() + .data(); + + $.each(data, function (key, item) { + + + var cheched = $("#chkSeleccionar_" + item[0]).prop("checked") ? true : false + + + RolesPantallas = { + IdRol: IdRoles, + IdPantalla: item[0], + Estado: cheched + + } + ArrayRolesPantallas.push(RolesPantallas); + }); + + var uri = CatalogosWCF + '/api/InsertarActualizarRolesPantallas'; + var model = { + ListaRolesPantallas: ArrayRolesPantallas + }; + + AjaxPostData(uri, model, true, true, null, null, null); + + + + ENDREQUEST(); + - $('#GridRolesPantallas').TableInit(1, true, true, true, true, columnDefinition, lista); - if ($.fn.DataTable.isDataTable('#GridRolesPantallas')) { - $('#GridRolesPantallas').DataTable().search('').draw(); - ENDREQUEST(); - } - } } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js deleted file mode 100644 index 989961ec7..000000000 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/RolesPantallas.js +++ /dev/null @@ -1,46 +0,0 @@ - -var Item = {}; -jQuery(document).ready(function () { - CargarPantallas(); -}); - - -this.CargarPantallas = function () { - - var uri = CatalogosWCF + '/api/ObtenerPantallas'; - AjaxPostData(uri, Item, true, false, CargarTablaPantallas, null, null); -} - -this.CargarTablaPantallas = function (data) { - - if (data != null) { - lista = data; - var Seleccionar = $("#ucbtnVista").html(); - var columnDefinition = [ - { "data": "Descripcion" }, - { "data": null, className: "center", defaultContent: Seleccionar } - ]; - - $('#tablePantallas').TableInit(1, true, true, true, true, columnDefinition, lista); - - if ($.fn.DataTable.isDataTable('#tablePantallas')) { - - $('#tablePantallas').DataTable().search('').draw(); - ENDREQUEST(); - } - } -} - -$('#tablePantallas').on('click', 'button', function () { - - var data = $('#tablePantallas').DataTable().row($(this).parents('tr')).data(); - - var mtzView = data.Vista.split('/') - - url = $("#hiddenHref").val(); - url = url.replace("View", mtzView[1]); - url = url.replace("Controller", mtzView[0]); - - document.location.href = url; - -}); \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml index a0e08420b..5e0a973f6 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml @@ -7,11 +7,13 @@
+