diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs index d7243a4ce..9d896899e 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/ISinort.cs @@ -109,6 +109,9 @@ namespace AYA.SlnSinort.WCF [OperationContract] SolicitudJSON ObtenerSolicitud(SolicitudJSON model); + + [OperationContract] + SolicitudJSON ObtenerSolicitudUsuario(SolicitudJSON model); #endregion } diff --git a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs index 72a183f7e..cdfa55765 100644 --- a/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs +++ b/AYA.SlnSynor/AYA.SlnSynor.WCF/Sinort.svc.cs @@ -725,6 +725,21 @@ namespace AYA.SlnSinort.WCF return model; } + public SolicitudJSON ObtenerSolicitudUsuario(SolicitudJSON model) { + + SolicitudJSON registros = new SolicitudJSON(); + try + { + registros = new SolicitudDAL().ObtenerSolicitudUsuario(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 2632d087b..d59d5e2ec 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj +++ b/AYA.SlnSynor/AYA.SlnSynor/AYA.SlnSinort.csproj @@ -7344,6 +7344,7 @@ + @@ -7440,6 +7441,7 @@ + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs b/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs index 9972caf82..5912140f5 100644 --- a/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs +++ b/AYA.SlnSynor/AYA.SlnSynor/Controllers/NormativaReglamentacionTecnicaController.cs @@ -26,5 +26,12 @@ namespace AYA.SlnSinort.Controllers.NormativaReglamentacionTecnica InitControllers(); return View(); } + + public ActionResult VerSolicitudes() + { + 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 2d60fafa6..2faa2584b 100644 Binary files a/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js and b/AYA.SlnSynor/AYA.SlnSynor/Scripts/_references.js differ diff --git a/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js new file mode 100644 index 000000000..a4d225cff --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js @@ -0,0 +1,140 @@ +var Item = {}; +var data; +var model = {}; +var InfoIContenidoRelacionado; +var InfoIdProyectoNormativo; + +jQuery(document).ready(function () { + + CargarSolicitudes(); + + +}); + +this.CargarSolicitudes = function () { + + var uri = SinortWCF + '/api/ObtenerSolicitudUsuario'; + var model = { + UsuarioSistema: UsuarioSistema + } + AjaxPostData(uri, model, true, true, CargarTablaSolicitudes, null, null); +} + +this.CargarTablaSolicitudes = function (data) { + + if (data != null && data.Solicitudes != null) { + Solicitudes = data.Solicitudes; + + + var Seleccionar = $("#ucbtnVista").html(); + $.each(Solicitudes, function (key, item) { + var texto = "Solicitud de " + item.DescripcionTipoSolicitud + " #" + item.IdSolicitud + " realizada por " + item.UsuarioSistema; + item.Titulo = texto; + + }); + + var columnDefinition = [ + { "data": 'IdSolicitud', "visible": false }, + { "data": "Titulo" }, + { "data": "DescripcionTipoSolicitud" }, + { "data": "FechaCreacion", "render": function (value) { return DateFormatNoTime(value); } }, + { "data": null, className: "center", defaultContent: Seleccionar } + ]; + var contador = 0; + $('#tableSolicitudes').DataTable({ + + initComplete: function () { + $('#tableSolicitudes').TableInit(1, false, true, true, true, columnDefinition, Solicitudes); + + this.api().columns().every(function () { + + var column = this; + if (column.selector.cols == 2) { + + var select = $('') + .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/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml new file mode 100644 index 000000000..0048e9d25 --- /dev/null +++ b/AYA.SlnSynor/AYA.SlnSynor/Views/NormativaReglamentacionTecnica/VerSolicitudes.cshtml @@ -0,0 +1,171 @@ + +@{ + ViewBag.Title = "VerSolicitudes"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + +
+ +

   Mis Solicitudes

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+ +
+ + + +@section Modals{ + + +@*---------------------Ver Solicitud---------------------------------------------------------*@ + +} + +@section scripts{ + + @Scripts.Render("~/Sinort-Scripts/NormativaReglamentacionTecnica/VerSolicitudes.js") + +} + diff --git a/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml b/AYA.SlnSynor/AYA.SlnSynor/Views/Shared/_Layout.cshtml index 601259dc3..895ce44b6 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
  • diff --git a/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs b/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs index 84bfd5830..3f1a013e4 100644 --- a/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs +++ b/AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/SolicitudDAL.cs @@ -43,6 +43,60 @@ namespace AYA.SlnSinortModel.DAL.Sinort return model; } + public SolicitudJSON ObtenerSolicitudUsuario(SolicitudJSON model) + { + + SolicitudJSON registros = new SolicitudJSON(); + + try + { + using (SinortContex db = new SinortContex()) + { + + registros.Solicitudes = db.Solicitud + .Where(x => x.Estado == true || x.UsuarioSistema.ToString() == model.UsuarioSistema).AsNoTracking() + .OrderBy(x => x.IdTipoSolicitud) + .ToList(); + + + registros.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO; + } + } + catch (Exception ex) + { + registros.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + log.Error(ex); + } + + return registros; + } + + //public SolicitudJSON ObtenerSolicitudUsuario(SolicitudJSON model) + //{ + // try + // { + // using (SinortContex Conn = new SinortContex()) + // { + // model.Solicitud = Conn.Solicitud + // .FirstOrDefault(q => q.IdSolicitud == model.Solicitud.IdSolicitud || q.UsuarioSistema == model.Solicitud.UsuarioSistema); + + // model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO; + // } + // } + // catch (DbEntityValidationException ex) + // { + // log.Error(ex); + // model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + // } + // catch (Exception ex) + // { + // log.Error(ex); + // model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR; + // } + + // return model; + //} + public SolicitudJSON GuardarSolicitud(SolicitudJSON model) { try diff --git a/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs b/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs index f36e6fced..d04df0dc7 100644 --- a/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs +++ b/AYA.SlnSynor/AYA.SlnSynorModel/Entidades/Json.cs @@ -81,6 +81,8 @@ namespace AYA.SlnSinortModel.Entidades public List ListaTareasPendientes { get; set; } public int? IdSolicitud { get; set; } + + public string UsuarioSistema { get; set; } }