From 705f4fae55c8433a20d332cbf5511463af5bcb45 Mon Sep 17 00:00:00 2001 From: jnunez Date: Fri, 24 Aug 2018 23:33:36 +0000 Subject: [PATCH] git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C436 --- .../AYA.SlnSynor/Sinort-Scripts/Aplicacion.js | 5 +- .../AYA.SlnSynor/Sinort-Scripts/Contenido.js | 4 +- .../Sinort-Scripts/DocumentoTecnico.js | 2 +- .../AYA.SlnSynor/Sinort-Scripts/EmisorPN.js | 4 +- .../Sinort-Scripts/GrupoTematico.js | 14 +++-- .../Sinort-Scripts/PalabraClave.js | 3 +- .../Sinort-Scripts/SubCategoriaContenido.js | 60 +++++++++++++++++-- .../Views/Catalogos/Aplicacion.cshtml | 6 +- .../Views/Catalogos/Contenido.cshtml | 11 ++-- .../Views/Catalogos/DocumentoTecnico.cshtml | 8 +-- .../Views/Catalogos/GrupoTematico.cshtml | 8 +-- .../Views/Catalogos/PalabraClave.cshtml | 2 +- .../Catalogos/SubCategoriaContenido.cshtml | 10 ++-- .../Sinort/AplicacionDAL.cs | 2 +- .../Sinort/ContenidoDAL.cs | 2 +- .../Sinort/DocumentoTecnicoDAL.cs | 2 +- .../AYA.SlnSynorModel.DAL/Sinort/EmisorDAL.cs | 1 + .../Sinort/GrupoTematicoDAL.cs | 2 +- .../Sinort/PalabraClaveDAL.cs | 1 + .../Sinort/PermisosUsuarioDAL.cs | 2 +- .../AYA.SlnSynorModel.DAL/Sinort/RolesDAL.cs | 1 + .../Sinort/SubCategoriaContenidoDAL.cs | 2 + .../Sinort/SubCategoriaGrupoTematicoDAL.cs | 2 + 23 files changed, 109 insertions(+), 45 deletions(-) diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Aplicacion.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Aplicacion.js index fbd5ed159..945a7dc2b 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Aplicacion.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Aplicacion.js @@ -207,7 +207,7 @@ this.ActualizarItem = function () { $.each(data, function (key, item) { - if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { repetido = true return false; } @@ -225,7 +225,8 @@ this.ActualizarItem = function () { Aplicacion = { IdAplicacion: $('#hiddenId').val(), Descripcion: $('#txtDescripcion').val(), - DescripcionLarga: $('#txtAreaDescripcionLarga').val() + DescripcionLarga: $('#txtAreaDescripcionLarga').val(), + IdTipoAplicacion: 1 } var uri = CatalogosWCF + '/api/InsertarActualizarAplicacion'; diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Contenido.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Contenido.js index b2e3841d4..95f5c253e 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Contenido.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Contenido.js @@ -17,7 +17,7 @@ this.getDataModel = function () { $('#btnInsertar').show(); - $('#btnLimpiarControles').click(function () { + $('#btnLimpiar').click(function () { LimpiarControles(); $('#btnGuardar').hide(); @@ -190,7 +190,7 @@ this.ActualizarItem = function () { $.each(data, function (key, item) { - if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { repetido = true return false; } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js index 57468f0b5..b86ed8e6f 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/DocumentoTecnico.js @@ -194,7 +194,7 @@ this.ActualizarItem = function () { $.each(data, function (key, item) { - if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { repetido = true return false; } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js index 3ecbd7b06..9f5697514 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/EmisorPN.js @@ -160,7 +160,7 @@ this.ActualizarItem = function () { $.each(data, function (key, item) { - if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { repetido = true return false; } @@ -174,7 +174,7 @@ this.ActualizarItem = function () { EmisorPN = { IdEmisor: $('#hiddenId').val(), Descripcion: $('#txtDescripcion').val(), - Estado : 1, + IdTipoEmisor: 1 } var uri = CatalogosWCF + '/api/InsertarActualizarEmisor'; diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GrupoTematico.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GrupoTematico.js index dc5c587bb..52e0dd7ff 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GrupoTematico.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/GrupoTematico.js @@ -1,7 +1,7 @@ var DataCatalogo; var id_column = 1; var Item = {}; - +var ID; jQuery(document).ready(function () { @@ -117,6 +117,7 @@ this.EditarItem = function (id) { if (ValidarPermisos('Modificar catálogos').length > 0) { TableItems = $('#TableItems').DataTable(); LimpiarControles(); + var indexes = getRowIndex(TableItems, id_column, id); if (indexes != null) { @@ -141,6 +142,7 @@ this.EditarItem = function (id) { } this.toggleEnabledItem = function (id, value) { + if (ValidarPermisos('Desactivar / Activar catálogos').length > 0) { var msg = '¿Está seguro que desea habilitar el Grupo Temático?'; @@ -190,7 +192,7 @@ this.ActualizarItem = function () { $.each(data, function (key, item) { - if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { repetido = true return false; } @@ -198,14 +200,14 @@ this.ActualizarItem = function () { }); if (repetido == true) { - toastr.warning('Ya existe un grupo temático con la misma descripción', Message_Warning); + toastr.warning('Ya existe un grupo temático con el mismo título', Message_Warning); return; } GrupoTematico = { IdGrupoTematico: $('#hiddenId').val(), Descripcion: $('#txtDescripcion').val(), - DescripcionLarga: $('#txtAreaDescripcionLarga').val() + DescripcionLarga: $('#txtAreaDescripcionLarga').val(), } @@ -241,7 +243,7 @@ this.InsertarItem = function () { }); if (repetido == true) { - toastr.warning('Ya existe un grupo temático con la misma descripción', Message_Warning); + toastr.warning('Ya existe un grupo temático con el mismo título', Message_Warning); return; } @@ -262,7 +264,7 @@ this.InsertarItem = function () { this.CompletarAccion = function () { $('#btnGuardar').hide(); $('#btnInsertar').show(); - + $('#hiddenId').val(''); TableItems.clear().draw(); ObtenerGrupoTematico(); LimpiarControles(); diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js index f8bce2c1f..b06562474 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/PalabraClave.js @@ -83,6 +83,7 @@ this.CargarGridPalabraClave = function (data) { option = replaceAll("[$value]", "0", option); } TableItems.column(1).visible(false); + TableItems.column(3).visible(false); TableItems.row.add([stateIcon, item.IdPalabraClave, item.Descripcion, @@ -190,7 +191,7 @@ this.ActualizarItem = function () { $.each(data, function (key, item) { - if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { repetido = true return false; } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/SubCategoriaContenido.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/SubCategoriaContenido.js index e6d46bbda..93a685190 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/SubCategoriaContenido.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/SubCategoriaContenido.js @@ -19,6 +19,11 @@ this.getDataModel = function () { $('#btnGuardar').hide(); $('#btnInsertar').show(); + + + $('#btn_eliminarContenido').click(function () { + LimpiarContenido(); + }); $('#btnLimpiarControles').click(function () { LimpiarControles(); @@ -199,11 +204,11 @@ this.toggleEnabledItem = function (id, value) { var msg = '¿Está seguro que desea habilitar la Sub Categoria de Contenido ?'; if (value == 0) { - msg = '¿Está seguro que desea deshabilitar la Sub Categoria de Contenido ?'; + msg = '¿Está seguro que desea deshabilitar la SubCategoría de Contenido ?'; } if (id == null || value == null) { - toastr.warning("No se pudo obtener el ID de la Sub Categoria de Contenido seleccionada."); + toastr.warning("No se pudo obtener el ID de la SubCategoría de Contenido seleccionada."); return; } @@ -236,6 +241,24 @@ this.ActualizarItem = function () { { return; } TableItems = $('#TableItems').DataTable(); + var repetido = false; + var data = TableItems + .rows() + .data(); + + $.each(data, function (key, item) { + + if (item[1] != $('#hiddenId').val() && item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + repetido = true + return false; + } + + }); + + if (repetido == true) { + toastr.warning('Ya existe una subcategoría contenido con la misma descripción', Message_Warning); + return; + } SubCategoriaContenido = { IdContenido: $("#hiddenContenido").val(), @@ -256,11 +279,30 @@ this.InsertarItem = function () { return false; } - if (!confirm("Va a ingresar una nueva Sub Categoria de Contenido .\n ¿Desea continuar?")) + if (!confirm("Va a ingresar una nueva SubCategoría de Contenido .\n ¿Desea continuar?")) { return; } TableItems = $('#TableItems').DataTable(); + var repetido = false; + var data = TableItems + .rows() + .data(); + + $.each(data, function (key, item) { + + if (item[2].toLowerCase() == $("#txtDescripcion").val().toLowerCase()) { + repetido = true + return false; + } + + }); + + if (repetido == true) { + toastr.warning('Ya existe una subcategoría contenido con la misma descripción', Message_Warning); + return; + } + Contenido = { Estado : 1, IdContenido: $("#hiddenContenido").val(), @@ -287,12 +329,20 @@ this.CompletarAccion = function () { } this.LimpiarControles = function () { - + $("#hiddenContenido").val(''); $('#txtDescripcion').val(''); + $("#txtContenido").val(''); $("#formCatalogo").validateElement("#txtDescripcion"); $('#lbTituloAccion').empty(); - $('#lbTituloAccion').append('Ingresar Nueva Sub Categoria de Contenido'); + $('#lbTituloAccion').append('Ingresar Nueva SubCategoría de Contenido'); +} + +this.LimpiarContenido = function () { + $("#hiddenContenido").val(''); + $('#txtContenido').val(''); + } + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Aplicacion.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Aplicacion.cshtml index 3b4ebee4b..58b5e6d82 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Aplicacion.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Aplicacion.cshtml @@ -18,9 +18,9 @@ ID - Descripción + Título Detalle - + Descripción @@ -59,7 +59,7 @@
-
+
diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Contenido.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Contenido.cshtml index ceec0220b..819fd29a5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Contenido.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Contenido.cshtml @@ -21,7 +21,7 @@ ID Título Detalle - + Descripción @@ -59,16 +59,19 @@
-
+
+ +
- + + @*col-lg-7 col-md-7 col-sm-7 col-xs-7">*@ @*--------------------- Descripcion Larga ---------------------------------------------------------*@
- +
diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml index 2aa3e9c7d..a8ae6acd3 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/DocumentoTecnico.cshtml @@ -21,7 +21,7 @@ ID Título Detalle - + Descripción @@ -60,7 +60,7 @@
-
+
@@ -69,7 +69,7 @@
- +
@@ -79,7 +79,7 @@
- diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/GrupoTematico.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/GrupoTematico.cshtml index 05cc5ca50..49a3c162e 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/GrupoTematico.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/GrupoTematico.cshtml @@ -21,7 +21,7 @@ ID Título Detalle - + Descripción @@ -59,7 +59,7 @@
-
+
@@ -68,7 +68,7 @@
- +
@@ -77,7 +77,7 @@
- diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml index b131462cf..e562887e5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/PalabraClave.cshtml @@ -70,7 +70,7 @@
- diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/SubCategoriaContenido.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/SubCategoriaContenido.cshtml index a76033318..45656da73 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/SubCategoriaContenido.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/SubCategoriaContenido.cshtml @@ -8,7 +8,7 @@