From 4b5e280aaf0cdc829723c4d24e8eebbc8a88ea54 Mon Sep 17 00:00:00 2001 From: jmoya Date: Mon, 23 Jul 2018 21:59:48 +0000 Subject: [PATCH] git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C324 --- AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs | 3 + AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs | 18 ++ .../AYA.SlnSynor/AYA.SlnSinort.csproj | 2 + ...ormativaReglamentacionTecnicaController.cs | 5 + .../AYA.SlnSynor/Scripts/_references.js | Bin 577688 -> 577874 bytes .../AYA.SlnSynor/Sinort-Scripts/Global.js | 8 + .../MisSolicitudes.js | 146 +++++++++++++++ .../VerSolicitudes.js | 45 ++++- .../MisSolicitudes.cshtml | 172 ++++++++++++++++++ .../VerSolicitudes.cshtml | 8 +- .../AYA.SlnSynor/Views/Shared/_Layout.cshtml | 6 +- .../Sinort/SolicitudDAL.cs | 32 +++- .../AYA.SlnSynorModel/Entidades/Json.cs | 2 + 13 files changed, 437 insertions(+), 10 deletions(-) create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/MisSolicitudes.js create mode 100644 AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisSolicitudes.cshtml diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs index 9d896899e..bea1c6916 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs @@ -112,6 +112,9 @@ namespace AYA.SlnSinort.WCF [OperationContract] SolicitudJSON ObtenerSolicitudUsuario(SolicitudJSON model); + + SolicitudJSON ObtenerPorTipo(SolicitudJSON model); + #endregion } diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs index cdfa55765..5574a96cc 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs @@ -740,6 +740,24 @@ namespace AYA.SlnSinort.WCF return registros; } + public SolicitudJSON ObtenerPorTipo(SolicitudJSON model) + { + + SolicitudJSON registros = new SolicitudJSON(); + try + { + registros = new SolicitudDAL().ObtenerPorTipo(model); + } + catch (Exception ex) + { + registros.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + log.Error(ex); + } + return registros; + } + + + public SolicitudJSON GuardarSolicitud(SolicitudJSON model) { try diff --git a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj index d59d5e2ec..43f8702de 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7343,6 +7343,7 @@ + @@ -7442,6 +7443,7 @@ + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs b/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs index 5912140f5..9ca3548cb 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs @@ -32,6 +32,11 @@ namespace AYA.SlnSinort.Controllers.NormativaReglamentacionTecnica InitControllers(); return View(); } + public ActionResult MisSolicitudes() + { + InitControllers(); + return View(); + } } } \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js b/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js index 2faa2584b7209d133323256c9bf3846e82fb4a96..0b2e114b3460bf4e4186122ef12e5354ac985454 100644 GIT binary patch delta 57 zcmV-90LK5Ap(E0wBY=bfgaU*Egam{Iga(8Mv') + .appendTo($(column.header()).empty()) + .on('change', function () { + var val = $.fn.dataTable.util.escapeRegex( + $(this).val() + ); + + column + .search(val ? '^' + val + '$' : '', true, false) + .draw(); + }); + + column.data().unique().sort().each(function (d, j) { + select.append('') + }); + } + + } + ); + } + }); + + + if ($.fn.DataTable.isDataTable('#tableSolicitudes')) { + + $('#tableSolicitudes').DataTable().search('').draw(); + ENDREQUEST(); + } + + } +} + +this.ObtenerSolicitud = function (id) { + var uri = SinortWCF + '/api/ObtenerSolicitud'; + + + + model = { Solicitud: { IdSolicitud: id } } + AjaxPostData(uri, model, false, false, CargarFormulario, null, null); +} +this.CargarFormulario = function (data) { + + var model = data; + + $("#txtUsuarioSistema").val(model.Solicitud.UsuarioSistema); + $("#txtCargoActual").val(model.Solicitud.CargoActual); + $("#txtNombreAreaFuncional").val(model.Solicitud.NombreAreaFuncional); + $("#txtNombreSubgerencia").val(model.Solicitud.NombreSubgerencia); + $("#txtNombreSuperior").val(model.Solicitud.NombreSuperior); + $("#txtNombreDocumentoTecnico").val(model.Solicitud.NombreDocumentoTecnico); + $("#txtAreaAplicacionDocumentoTecnico").val(model.Solicitud.AreaAplicacionDocumentoTecnico.Descripcion); + $("#txtAreaJustifiacion").val(model.Solicitud.JustifiacionSolicitud); + + + + //if (model.Solicitud.DescripcionTipoSolicitud == "Compra") { + + // $('#divEstadoSolicitud').show(); + // $("#txtEstadoSolicitud").val(model.Solicitud.IdEstadoSolicitud); + //} + + ENDREQUEST(); +} + +$('#tableSolicitudes').on('click', 'button', function () { + + + var tabla = $('#tableSolicitudes').DataTable().row($(this).parents('tr')).data(); + + InfoIContenidoRelacionado = tabla.Titulo; + InfoIdProyectoNormativo = tabla.IdSolicitud; + + var solicitud = $("#ucSolicitud").html(); + solicitud = replaceAll('[$Solicitud]', InfoIContenidoRelacionado, solicitud); + $('#solicitudVer').empty(); + $('#solicitudVer').append(solicitud); + + $('#modalVer').modal('show'); + + $("#txtTitulo").val(InfoIContenidoRelacionado); + + + ObtenerSolicitud(InfoIdProyectoNormativo); + + + +}); \ No newline at end of file diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js index a4d225cff..ae7df3e53 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js @@ -3,20 +3,55 @@ var data; var model = {}; var InfoIContenidoRelacionado; var InfoIdProyectoNormativo; +var IdTipoSolicitud; +var DescTipoSolicitud; +var IdSolicitud; jQuery(document).ready(function () { + CargarTipoSolicitud(); CargarSolicitudes(); - }); +this.CargarTipoSolicitud = function () { + IdTipoSolicitud = ObtenerParametros().solicitud; + IdTipoSolicitud = ROT47(IdTipoSolicitud.toString()); + switch (IdTipoSolicitud) { + case '1': + DescTipoSolicitud = Solicitud.Consulta.Descripcion; + break; + case '2': + DescTipoSolicitud = Solicitud.Compra.Descripcion; + break; + case '3': + DescTipoSolicitud = Solicitud.Modificacion.Descripcion; + break; + } + var solicitud; + solicitud = $("#ucTitulo").html(); + + + solicitud = replaceAll('[$titulo]', DescTipoSolicitud, solicitud); + $('#tiposolicitud').empty(); + $('#tiposolicitud').append('Ver Solicitudes de ' + solicitud); + + + + +} this.CargarSolicitudes = function () { - var uri = SinortWCF + '/api/ObtenerSolicitudUsuario'; - var model = { - UsuarioSistema: UsuarioSistema - } + + + var uri = SinortWCF + '/api/ObtenerPorTipo'; + + var model = { + UsuarioSistema: UsuarioSistema, + IdTipoSolicitud: IdTipoSolicitud + } + + AjaxPostData(uri, model, true, true, CargarTablaSolicitudes, null, null); } diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisSolicitudes.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisSolicitudes.cshtml new file mode 100644 index 000000000..dbba0c26f --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/MisSolicitudes.cshtml @@ -0,0 +1,172 @@ + +@{ + ViewBag.Title = "MisSolicitudes"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + + +
+ +

  Mis Solicitudes

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+ + + +@section Modals{ + + + @*---------------------Ver Solicitud---------------------------------------------------------*@ + +} + +@section scripts{ + + @Scripts.Render("~/Sinort-Scripts/NormativaReglamentacionTecnica/MisSolicitudes.js") + +} + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml index 0048e9d25..59e1c12b7 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml @@ -6,7 +6,7 @@
-

   Mis Solicitudes

+

   [$titulo]


@@ -50,6 +50,12 @@
+ + @section Modals{ diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml index 895ce44b6..d3dbda7fa 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml @@ -157,7 +157,7 @@
  • Consulta al administrador
  • Compra de documento técnica
  • Modificación de documento
    técnico
  • -
  • Ver mis solicitudes
  • +
  • Ver mis solicitudes
  • Sitios
  • Encuestas
  • @@ -165,8 +165,8 @@
  • Ficha Técnica
  • Ver fichas técnicas inactivas
  • Ver solicitudes de compra
  • -
  • Ver solicitudes de modificación
  • -
  • Ver solicitudes de consulta
  • +
  • Ver solicitudes de modificación
  • +
  • Ver solicitudes de consulta
  • Configuración de la
    aplicación
  • diff --git a/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs b/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs index 3f1a013e4..1d898a5b1 100644 --- a/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs +++ b/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs @@ -54,7 +54,37 @@ namespace AYA.SlnSinortModel.DAL.Sinort { registros.Solicitudes = db.Solicitud - .Where(x => x.Estado == true || x.UsuarioSistema.ToString() == model.UsuarioSistema).AsNoTracking() + .Where(x => x.Estado == true || x.UsuarioSistema.ToString() == model.UsuarioSistema || + x.IdTipoSolicitud == model.IdTipoSolicitud).AsNoTracking() + .OrderBy(x => x.IdTipoSolicitud) + .ToList(); + + + registros.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO; + } + } + catch (Exception ex) + { + registros.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + log.Error(ex); + } + + return registros; + } + + public SolicitudJSON ObtenerPorTipo(SolicitudJSON model) + { + + SolicitudJSON registros = new SolicitudJSON(); + + try + { + using (SinortContex db = new SinortContex()) + { + + registros.Solicitudes = db.Solicitud + .Where(x => x.UsuarioSistema.ToString() == model.UsuarioSistema && + x.IdTipoSolicitud == model.IdTipoSolicitud).AsNoTracking() .OrderBy(x => x.IdTipoSolicitud) .ToList(); diff --git a/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs b/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs index d04df0dc7..6e1e00e46 100644 --- a/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs +++ b/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs @@ -82,6 +82,8 @@ namespace AYA.SlnSinortModel.Entidades public int? IdSolicitud { get; set; } + public int? IdTipoSolicitud { get; set; } + public string UsuarioSistema { get; set; } }