git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C331
This commit is contained in:
parent
f6ed04e480
commit
5c14d697ea
8 changed files with 98 additions and 72 deletions
|
|
@ -51,9 +51,6 @@ namespace AYA.SlnSinort.WCF
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
List<Roles> ObtenerRol();
|
List<Roles> ObtenerRol();
|
||||||
|
|
||||||
//[OperationContract]
|
|
||||||
//List<CatalogosJSON> ObtenerUsuarioExperto();
|
|
||||||
|
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
BaseJson InsertarActualizarRol(Roles model);
|
BaseJson InsertarActualizarRol(Roles model);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
@ -68,6 +65,9 @@ namespace AYA.SlnSinort.WCF
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region RolesPantallas
|
#region RolesPantallas
|
||||||
|
[OperationContract]
|
||||||
|
List<RolesPantallas> ObtenerRolesPantalla(CatalogosPostJSON model);
|
||||||
|
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
RolesPantallasJSON InsertarActualizarRolesPantallas(RolesPantallasJSON model);
|
RolesPantallasJSON InsertarActualizarRolesPantallas(RolesPantallasJSON model);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,21 @@ namespace AYA.SlnSinort.WCF
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RolesPantallas> ObtenerRolesPantalla(CatalogosPostJSON model) {
|
||||||
|
|
||||||
|
List<RolesPantallas> respuesta = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
respuesta = new RolesDAL().ObtenerRolesPantalla(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
}
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Usuario
|
#region Usuario
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ var IdSolicitud;
|
||||||
var DescTipoproyecto;
|
var DescTipoproyecto;
|
||||||
var modelDocumentoAdjunto;
|
var modelDocumentoAdjunto;
|
||||||
|
|
||||||
|
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
|
|
||||||
CargarTipoSolicitud();
|
CargarTipoSolicitud();
|
||||||
|
|
@ -280,32 +281,61 @@ this.GuardarSolicitud = function () {
|
||||||
var uri = SinortWCF + '/api/GuardarSolicitud';
|
var uri = SinortWCF + '/api/GuardarSolicitud';
|
||||||
LeerFormulario();
|
LeerFormulario();
|
||||||
|
|
||||||
AjaxPostData(uri, model, false, true, GuardarTareasPendientes, null, null);
|
AjaxPostData(uri, model, false, true, ObtenerRolPantalla, null, null);
|
||||||
|
|
||||||
//LimpiarSolicitud();
|
//LimpiarSolicitud();
|
||||||
}
|
}
|
||||||
|
this.ObtenerRolPantalla = function (data) {
|
||||||
|
IdSolicitud = data.Solicitud.IdSolicitud;
|
||||||
|
var uri = CatalogosWCF + '/api/ObtenerRolesPantalla';
|
||||||
|
var model = {
|
||||||
|
codigo: 27
|
||||||
|
};
|
||||||
|
|
||||||
|
AjaxPostData(uri, model, false, false, ObtenerUsuarioRol, null, null);
|
||||||
|
|
||||||
////////
|
}
|
||||||
|
this.ObtenerUsuarioRol = function (data) {
|
||||||
|
|
||||||
|
var modelPost = {
|
||||||
|
listaCodigos: []
|
||||||
|
};
|
||||||
|
|
||||||
|
$.each(data, function (key, item) {
|
||||||
|
modelPost.listaCodigos.push(item.IdRol);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (modelPost.listaCodigos.indexOf(1) == -1)
|
||||||
|
modelPost.listaCodigos.push(1);
|
||||||
|
|
||||||
|
var uri = CatalogosWCF + '/api/ObtenerUsuariosRol';
|
||||||
|
AjaxPostData(uri, modelPost, false, false, GuardarTareasPendientes, null, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/////
|
||||||
this.GuardarTareasPendientes = function (data) {
|
this.GuardarTareasPendientes = function (data) {
|
||||||
|
|
||||||
if (data.CodigoRespuesta == 'EXITOSO'){
|
|
||||||
|
//if (data.CodigoRespuesta == 'EXITOSO'){
|
||||||
var ArrayUsuarios = [];
|
var ArrayUsuarios = [];
|
||||||
|
|
||||||
|
|
||||||
|
$.each(data, function (key, item) {
|
||||||
TareaPendiente
|
TareaPendiente
|
||||||
= {
|
= {
|
||||||
Descripcion: 'Registro de solicitud (SINORT): solicitud de ' + DescTipoSolicitud +' #'+ data.Solicitud.IdSolicitud +' realizada por: ' +UsuarioSistema,
|
Descripcion: 'Registro de solicitud (SINORT): solicitud de ' + DescTipoSolicitud + ' #' + IdSolicitud + ' realizada por: ' + UsuarioSistema,
|
||||||
ContenidoRelacionado: 'Solicitud de ' + DescTipoSolicitud +' #'+ data.Solicitud.IdSolicitud + ' realizada por ' +UsuarioSistema,
|
ContenidoRelacionado: 'Solicitud de ' + DescTipoSolicitud + ' #' + IdSolicitud + ' realizada por ' + UsuarioSistema,
|
||||||
Respuesta: false,
|
Respuesta: false,
|
||||||
FechaVencimiento: '2018-7-17',
|
FechaVencimiento: '2018-7-17',
|
||||||
TipoTareaPendiente: 'Solicitud',
|
TipoTareaPendiente: 'Solicitud',
|
||||||
UsuarioAsignado: $("#txtNombreSuperior").val(),
|
UsuarioAsignado: item.Usuario.UsuarioSistema,
|
||||||
IdProyectoNormativo: data.Solicitud.IdSolicitud,
|
IdProyectoNormativo: IdSolicitud,
|
||||||
PromotorProyectoNormativo: UsuarioSistema
|
PromotorProyectoNormativo: UsuarioSistema
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayUsuarios.push(TareaPendiente);
|
ArrayUsuarios.push(TareaPendiente);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var uri = SinortWCF + '/api/InsertarActualizarTareasPendientes2';
|
var uri = SinortWCF + '/api/InsertarActualizarTareasPendientes2';
|
||||||
|
|
@ -318,7 +348,7 @@ this.GuardarTareasPendientes = function (data) {
|
||||||
//EnviarCorreo();
|
//EnviarCorreo();
|
||||||
LimpiarSolicitud();
|
LimpiarSolicitud();
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.EnviarCorreo = function () {
|
this.EnviarCorreo = function () {
|
||||||
|
|
|
||||||
|
|
@ -75,36 +75,11 @@ this.CargarTablaSolicitudes = function (data) {
|
||||||
{ "data": "Usuario1.NombreUsuario"},
|
{ "data": "Usuario1.NombreUsuario"},
|
||||||
{ "data": null, className: "center", defaultContent: Seleccionar }
|
{ "data": null, className: "center", defaultContent: Seleccionar }
|
||||||
];
|
];
|
||||||
var contador = 0;
|
|
||||||
$('#tableSolicitudes').DataTable({
|
$('#tableSolicitudes').DataTable({
|
||||||
|
|
||||||
initComplete: function () {
|
initComplete: function () {
|
||||||
$('#tableSolicitudes').TableInit(1, false, true, true, true, columnDefinition, Solicitudes);
|
$('#tableSolicitudes').TableInit(1, false, true, true, true, columnDefinition, Solicitudes);
|
||||||
|
|
||||||
this.api().columns().every(function () {
|
|
||||||
|
|
||||||
var column = this;
|
|
||||||
if (column.selector.cols == 2) {
|
|
||||||
|
|
||||||
var select = $('<select><option value=""></option></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('<option value="' + d + '">' + d + '</option>')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,12 @@
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-sm-1">ID</th>
|
<th class="col-sm-1">ID</th>
|
||||||
<th class="col-sm-5">Título</th>
|
<th class="col-sm-4">Título</th>
|
||||||
<th class="col-sm-5">Área aplicación</th>
|
<th class="col-sm-4">Área aplicación</th>
|
||||||
<th class="col-sm-3">Creado por</th>
|
<th class="col-sm-4">Creado por</th>
|
||||||
<th class="col-sm-2">Acción</th>
|
<th class="col-sm-2">Acción</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th class="col-sm-1"></th>
|
|
||||||
<th class="col-sm-5"></th>
|
|
||||||
<th class="col-sm-3"></th>
|
|
||||||
<th class="col-sm-4"></th>
|
|
||||||
<th class="col-sm-2"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||||
using AYA.SlnSinortModel;
|
using AYA.SlnSinortModel;
|
||||||
using AYA.SlnSinortModel.Entidades;
|
using AYA.SlnSinortModel.Entidades;
|
||||||
using AYA.SlnSinortModel.Sinort;
|
using AYA.SlnSinortModel.Sinort;
|
||||||
|
using System.Data.Entity;
|
||||||
using System.Data.Entity.Validation;
|
using System.Data.Entity.Validation;
|
||||||
using Atesa.Utilitarios;
|
using Atesa.Utilitarios;
|
||||||
using AYA.SlnSinortModel.Constantes;
|
using AYA.SlnSinortModel.Constantes;
|
||||||
|
|
@ -177,37 +178,38 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Obtener usuarios funcional experto
|
#region ObtenerRolesPantalla
|
||||||
|
|
||||||
public List<CatalogosJSON> ObtenerUsuarioExperto(CatalogosPostJSON model)
|
public List<RolesPantallas> ObtenerRolesPantalla(CatalogosPostJSON model)
|
||||||
{
|
{
|
||||||
List<CatalogosJSON> registros = null;
|
List<RolesPantallas> registros = null;
|
||||||
string filtro = model != null ? model.filtro : null;
|
string filtro = model != null ? model.filtro : null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (SinortContex db = new SinortContex())
|
using (SinortContex db = new SinortContex())
|
||||||
{
|
{
|
||||||
registros = db.Roles.Where(t => t.Estado == true && t.Descripcion == "Usuario funcional experto".ToString() && (string.IsNullOrEmpty(filtro) || t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower())))
|
if (model != null && !string.IsNullOrWhiteSpace(model.codigo))
|
||||||
//.Include(y => y.Usuario)
|
{
|
||||||
.Select(t => new CatalogosJSON()
|
|
||||||
{
|
|
||||||
codigo = t.IdRol.ToString(),
|
|
||||||
descripcion = t.Descripcion,
|
|
||||||
|
|
||||||
})
|
registros = db.RolesPantallas.Where(r => r.IdPantalla.ToString() == model.codigo).Include(u => u.Roles).OrderBy(u => u.IdRol).AsNoTracking()
|
||||||
.ToList();
|
//.Select(t => new RolesPantallas()
|
||||||
|
//{
|
||||||
|
// IdRol = t.IdRol,
|
||||||
|
//})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
||||||
log.Error(ex);
|
log.Error(ex);
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return registros;
|
return registros;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
{
|
{
|
||||||
using (SinortContex db = new SinortContex())
|
using (SinortContex db = new SinortContex())
|
||||||
{
|
{
|
||||||
|
if (model != null && model.ListaCodigos != null && model.ListaCodigos.Count > 0)
|
||||||
|
{
|
||||||
|
registros = db.RolesUsuario.Where(r => model.ListaCodigos.Contains(r.IdRol.Value)).Include(u => u.Usuario).OrderBy(u => u.IdRolesUsuario).AsNoTracking().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
if (model != null && !string.IsNullOrWhiteSpace(model.codigo))
|
if (model != null && !string.IsNullOrWhiteSpace(model.codigo))
|
||||||
{
|
{
|
||||||
|
|
@ -76,16 +80,16 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
using (SinortContex db = new SinortContex())
|
using (SinortContex db = new SinortContex())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
usuario = db.Usuario.Where(r => r.UsuarioSistema.ToString() == model.codigo).FirstOrDefault();
|
usuario = db.Usuario.Where(r => r.UsuarioSistema.ToString() == model.codigo).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.Error(ex);
|
log.Error(ex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return usuario;
|
return usuario;
|
||||||
|
|
@ -98,7 +102,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
{
|
{
|
||||||
RolesUsuario Actual = new RolesUsuario();
|
RolesUsuario Actual = new RolesUsuario();
|
||||||
BaseJson Respuesta = new BaseJson();
|
BaseJson Respuesta = new BaseJson();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
model.ClearProperties();
|
model.ClearProperties();
|
||||||
|
|
@ -115,12 +119,12 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
model.FechaModificacion = DateTime.Now;
|
model.FechaModificacion = DateTime.Now;
|
||||||
model.FechaCreacion = Actual.FechaCreacion;
|
model.FechaCreacion = Actual.FechaCreacion;
|
||||||
model.UsuarioCreacion = Actual.UsuarioCreacion;
|
model.UsuarioCreacion = Actual.UsuarioCreacion;
|
||||||
model.IdRol = Actual.IdRol;
|
model.IdRol = Actual.IdRol;
|
||||||
model.UsuarioSistema =Actual.UsuarioSistema ;
|
model.UsuarioSistema = Actual.UsuarioSistema;
|
||||||
Conn.Entry(Actual).State = System.Data.Entity.EntityState.Detached;
|
Conn.Entry(Actual).State = System.Data.Entity.EntityState.Detached;
|
||||||
Conn.RolesUsuario.Attach(model);
|
Conn.RolesUsuario.Attach(model);
|
||||||
Conn.Entry(model).State = System.Data.Entity.EntityState.Modified;
|
Conn.Entry(model).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
|
@ -177,9 +181,9 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
@ -187,6 +191,6 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,15 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
{
|
{
|
||||||
//public object dataModel { get; set; }
|
//public object dataModel { get; set; }
|
||||||
public string codigo { get; set; }
|
public string codigo { get; set; }
|
||||||
|
public List<int> ListaCodigos { get; set; }
|
||||||
|
|
||||||
|
public List<string> ListaDesc { get; set; }
|
||||||
|
|
||||||
public string filtro { get; set; }
|
public string filtro { get; set; }
|
||||||
public Usuario usuario { get; set; }
|
public Usuario usuario { get; set; }
|
||||||
public int? IdTipo { get; set; }
|
public int? IdTipo { get; set; }
|
||||||
|
|
||||||
|
public int? IdPantalla { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RolesPantallasJSON : BaseJson
|
public class RolesPantallasJSON : BaseJson
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue