git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C176
This commit is contained in:
parent
1ebaaaa96f
commit
42f99696a0
12 changed files with 431 additions and 76 deletions
|
|
@ -9,67 +9,67 @@ namespace AYA.SlnSinort.Controllers.Catalogos
|
|||
{
|
||||
public class CatalogosController : BaseController
|
||||
{
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult EmisorPN()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Mantenimiento()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
|
||||
//[LoggingFilter]
|
||||
public ActionResult Aplicacion()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Rol()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Usuario()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Contenido()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult SubCategoriaContenido()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult GrupoTematico()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult SubCategoriaGrupoTematico()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult DocumentoTecnico()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult PalabraClave()
|
||||
{
|
||||
InitControllers();
|
||||
|
|
|
|||
|
|
@ -8,25 +8,25 @@ namespace AYA.SlnSinort.Controllers
|
|||
{
|
||||
public class HomeController : BaseController
|
||||
{
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Index()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Normativa_Reglamentacion_Tecnica()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Proyecto_Normativo()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult TareasPendientes()
|
||||
{
|
||||
InitControllers();
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ namespace AYA.SlnSinort.Controllers.Login
|
|||
{
|
||||
try
|
||||
{
|
||||
Session["UserName"] = model.UserName;
|
||||
Session["FullName"] = model.UserFullName;
|
||||
//Session["UserName"] = model.UserName;
|
||||
//Session["FullName"] = model.UserFullName;
|
||||
Session["UserName"] = "josnunez";
|
||||
Session["FullName"] = "Josue Nuñez Cascante";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,19 +8,19 @@ namespace AYA.SlnSinort.Controllers.PropuestaNormativa
|
|||
{
|
||||
public class PropuestaNormativaController : BaseController
|
||||
{
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Index()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult DetallePropuesta()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
[LoggingFilter]
|
||||
//[LoggingFilter]
|
||||
public ActionResult Foro()
|
||||
{
|
||||
InitControllers();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@ function validarFormulario() {
|
|||
|
||||
if (Contador >= 2) {
|
||||
enviado = true;
|
||||
ObtenerUsuarioAD();
|
||||
//ObtenerUsuarioAD();
|
||||
url = $("#hiddenHref").val();
|
||||
url = url.replace("View", "Index");
|
||||
url = url.replace("Controller", "Home");
|
||||
} else {
|
||||
toastr.warning('Los campos son obligatorio', Message_Warning);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ jQuery(document).ready(function () {
|
|||
|
||||
getDataModel();
|
||||
|
||||
|
||||
Adjuntos
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
|
@ -50,11 +48,22 @@ this.getDataModel = function () {
|
|||
AgregarUsuario();
|
||||
});
|
||||
|
||||
$("#btnBuscarOpcion").unbind("click");
|
||||
$("#btnBuscarOpcion").click(function () {
|
||||
BuscarPantalla();
|
||||
});
|
||||
|
||||
$("#btnAgregarOpcion").unbind("click");
|
||||
$("#btnAgregarOpcion").click(function () {
|
||||
AgregarPantalla();
|
||||
});
|
||||
|
||||
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
||||
$('#GridRolesPantallas').TableInit(0, false, true, true, false, null, null);
|
||||
$('#GridRolesOpciones').TableInit(0, false, true, true, false, null, null);
|
||||
$('#GridRolesUsuarios').TableInit(0, false, true, true, false, null, null);
|
||||
ObtenerRoles();
|
||||
CargarUsuariosSistema();
|
||||
CargarPantallasSistema();
|
||||
|
||||
|
||||
|
||||
|
|
@ -231,9 +240,9 @@ this.LimpiarControles = function () {
|
|||
$('#lbTituloAccion').empty();
|
||||
$('#lbTituloAccion').append('Ingresar Nuevo Rol');
|
||||
}
|
||||
|
||||
//Asignar opciones por rol
|
||||
this.AbrirRolesPantallas = function (id) {
|
||||
$("#modalRolesPantallas").modal('show');
|
||||
$("#modalRolesOpciones").modal('show');
|
||||
CargarPantallas(id);
|
||||
}
|
||||
|
||||
|
|
@ -251,23 +260,41 @@ this.CargarPantallas = function (id) {
|
|||
|
||||
this.CargarTablaPantallas = function (data) {
|
||||
|
||||
var TableItems = $('#GridRolesPantallas').DataTable();
|
||||
TableItems.clear().draw();
|
||||
var GridRolesOpciones = $('#GridRolesOpciones').DataTable();
|
||||
GridRolesOpciones.clear().draw();
|
||||
var lista = data;
|
||||
|
||||
$.each(lista, function (key, item) {
|
||||
|
||||
var checkbox = $("#ucbtnCheck").html();
|
||||
checkbox = replaceAll("[$id]", item.IdPantalla, checkbox);
|
||||
checkbox = replaceAll("[$check]", item.Estado != true ? "" : "checked", checkbox);
|
||||
var option = $("#ucItemsHabiliarOpcion").html();
|
||||
option = replaceAll("[$CodItem]", item.IdRolesPantallas, option);
|
||||
var stateIcon = $("#ucItemsIconOpcion").html();
|
||||
|
||||
if (item.Estado == false) {
|
||||
stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon);
|
||||
stateIcon = replaceAll("[$state_color]", "muted", stateIcon);
|
||||
|
||||
option = replaceAll("[$opcion]", "Habilitar", option);
|
||||
option = replaceAll("[$icon]", "fa-check", option);
|
||||
option = replaceAll("[$value]", "1", option);
|
||||
}
|
||||
else {
|
||||
stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon);
|
||||
stateIcon = replaceAll("[$state_color]", "success", stateIcon);
|
||||
|
||||
option = replaceAll("[$opcion]", "Deshabilitar", option);
|
||||
option = replaceAll("[$icon]", "fa-times", option);
|
||||
option = replaceAll("[$value]", "0", option);
|
||||
}
|
||||
|
||||
|
||||
TableItems.column(0).visible(false);
|
||||
TableItems.column(1).visible(false);
|
||||
TableItems.row.add([item.IdRolesPantallas,
|
||||
item.IdPantalla,
|
||||
GridRolesOpciones.column(1).visible(false);
|
||||
GridRolesOpciones.column(2).visible(false);
|
||||
GridRolesOpciones.row.add([stateIcon,
|
||||
item.IdRolesPantallas,
|
||||
item.Pantallas.IdPantalla,
|
||||
item.Pantallas.Descripcion,
|
||||
checkbox]).draw();
|
||||
option]).draw();
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -277,46 +304,205 @@ this.CargarTablaPantallas = function (data) {
|
|||
|
||||
this.GuardarRolesPantallas = function () {
|
||||
|
||||
if (!confirm("Va registrar las pantallas asociadas.\n ¿Desea continuar?"))
|
||||
if (!confirm("Va registrar las opciones asociadas.\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
TablePantallas = $('#GridRolesPantallas').DataTable();
|
||||
GridRolesOpciones = $('#GridRolesUsuarios').DataTable();
|
||||
var IdRoles = $('#hiddenIdRol').val();
|
||||
var ArrayRolesPantallas = [];
|
||||
var data = TablePantallas
|
||||
var ArrayRolesOpciones= [];
|
||||
var data = GridRolesOpciones
|
||||
.rows()
|
||||
.data();
|
||||
|
||||
$.each(data, function (key, item) {
|
||||
|
||||
|
||||
var cheched = $("#chkSeleccionar_" + item[1]).prop("checked") ? true : false
|
||||
|
||||
|
||||
RolesPantallas = {
|
||||
|
||||
IdRolesPantallas :item[0],
|
||||
IdRolesPantallas: item[1],
|
||||
IdRol: IdRoles,
|
||||
IdPantalla: item[1],
|
||||
Estado: cheched
|
||||
Descripcion: item[2],
|
||||
Estado: true
|
||||
|
||||
}
|
||||
ArrayRolesPantallas.push(RolesPantallas);
|
||||
ArrayRolesOpciones.push(RolesPantallas);
|
||||
});
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarRolesPantallas';
|
||||
var model = {
|
||||
ListaRolesPantallas: ArrayRolesPantallas
|
||||
ListaRolesPantallas: ArrayRolesPantallas
|
||||
};
|
||||
|
||||
AjaxPostData(uri, model, true, true, null, null, null);
|
||||
|
||||
|
||||
|
||||
AjaxPostData(uri, model, false, true, null, null, null);
|
||||
CargarPantallas(IdRoles);
|
||||
ENDREQUEST();
|
||||
|
||||
}
|
||||
|
||||
this.LimpiarOpcion = function () {
|
||||
$('#txtOpcion').val('');
|
||||
}
|
||||
this.HabilitarOpcion = function (id, value) {
|
||||
|
||||
var msg = '¿Está seguro que desea habilitar la opción?';
|
||||
|
||||
if (value == 0) {
|
||||
msg = '¿Está seguro que desea deshabilitar la opción?';
|
||||
}
|
||||
|
||||
if (!confirm(msg)) return;
|
||||
|
||||
var ArrayRolesPantallas = [];
|
||||
|
||||
|
||||
RolesPantallas = {
|
||||
IdRolesPantallas: id,
|
||||
Estado: value
|
||||
|
||||
|
||||
}
|
||||
ArrayRolesPantallas.push(RolesPantallas);
|
||||
|
||||
var model = {
|
||||
ListaRolesPantallas: RolesPantallas
|
||||
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarRolesPantallas';
|
||||
AjaxPostData(uri, model, false, true, null, null, null);
|
||||
CargarPantallas($('#hiddenIdRol').val());
|
||||
ENDREQUEST();
|
||||
|
||||
}
|
||||
|
||||
this.CargarPantallasSistema = function (filtro) {
|
||||
|
||||
var uri = CatalogosWCF + '/api/ObtenerPantallas';
|
||||
AjaxPostData(uri, null, false, false, CargarGridPantallas, null, null);
|
||||
|
||||
}
|
||||
|
||||
this.CargarGridPantallas = function (data) {
|
||||
|
||||
if (data != null) {
|
||||
|
||||
var Seleccionar = $("#ucBtnSeleccionarOpcion").html();
|
||||
var columnDefinition = [
|
||||
{ "data": "Descripcion", className: "center" },
|
||||
{ "data": null, className: "center", defaultContent: Seleccionar }
|
||||
];
|
||||
|
||||
$('#tableOpciones').TableInit(0, false, true, true, false, columnDefinition, data, false);
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
||||
}
|
||||
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
this.BuscarPantalla = function () {
|
||||
|
||||
|
||||
if ($.fn.DataTable.isDataTable('#tableOpciones')) {
|
||||
|
||||
LoadMessage();
|
||||
$('#tableOpciones').DataTable().search('').draw();
|
||||
$('#modalOpciones').modal('show');
|
||||
ENDREQUEST();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.AgregarPantalla = function () {
|
||||
|
||||
if (!confirm("¿Desea agregar una nueva opción?")) return;
|
||||
|
||||
var GridRolesOpciones = $('#GridRolesOpciones').DataTable();
|
||||
var option = $("#ucbtnRemoverOpcion").html();
|
||||
var stateIcon = $("#ucItemsIconOpcion").html();
|
||||
stateIcon = replaceAll("[$icon]", "fa-check-circle", stateIcon);
|
||||
stateIcon = replaceAll("[$state_color]", "muted", stateIcon);
|
||||
|
||||
GridRolesOpciones.row.add(
|
||||
[stateIcon,
|
||||
0,
|
||||
$("#hiddenOpcion").val(),
|
||||
$("#txtOpcion").val(),
|
||||
option])
|
||||
.draw();
|
||||
|
||||
toastr.success(Message_Default, Message_Success);
|
||||
$('#hiddenOpcion').val('');
|
||||
$('#txtOpcion').val('');
|
||||
}
|
||||
$('#tableOpciones').on('click', 'button', function () {
|
||||
|
||||
var data = $('#tableOpciones').DataTable().row($(this).parents('tr')).data();
|
||||
|
||||
$('#hiddenOpcion').val(data.IdPantalla);
|
||||
$('#txtOpcion').val(data.Descripcion);
|
||||
|
||||
$('#modalOpciones').modal('hide');
|
||||
|
||||
});
|
||||
this.LimpiarOpcion = function () {
|
||||
$('#hiddenOpcion').val('');
|
||||
$('#txtOpcion').val('');
|
||||
}
|
||||
|
||||
$('#GridRolesOpciones').on('click', 'button', function () {
|
||||
var data = $('#GridRolesOpciones').DataTable().row($(this).parents('tr')).data();
|
||||
if (data[1] == 0) {
|
||||
var GridRolesOpciones = $('#GridRolesOpciones').DataTable();
|
||||
GridRolesOpciones.row($(this).parents('tr')).remove().draw();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//this.GuardarRolesPantallas = function () {
|
||||
|
||||
// if (!confirm("Va registrar las pantallas asociadas.\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[1]).prop("checked") ? true : false
|
||||
|
||||
|
||||
// RolesPantallas = {
|
||||
|
||||
// IdRolesPantallas :item[0],
|
||||
// IdRol: IdRoles,
|
||||
// IdPantalla: item[1],
|
||||
// Estado: cheched
|
||||
|
||||
// }
|
||||
// ArrayRolesPantallas.push(RolesPantallas);
|
||||
// });
|
||||
|
||||
// var uri = CatalogosWCF + '/api/InsertarActualizarRolesPantallas';
|
||||
// var model = {
|
||||
// ListaRolesPantallas: ArrayRolesPantallas
|
||||
// };
|
||||
|
||||
// AjaxPostData(uri, model, true, true, null, null, null);
|
||||
|
||||
|
||||
|
||||
// ENDREQUEST();
|
||||
|
||||
//}
|
||||
//Asignar usuarios por rol
|
||||
this.AbrirRolesUsuario = function (id) {
|
||||
|
||||
$("#modalRolesUsuario").modal('show');
|
||||
|
|
@ -419,10 +605,10 @@ this.LimpiarUsuario = function(){
|
|||
}
|
||||
this.HabilitarUsuario = function (id, value) {
|
||||
|
||||
var msg = '¿Está seguro que desea habilitar el rol?';
|
||||
var msg = '¿Está seguro que desea habilitar el usuario?';
|
||||
|
||||
if (value == 0) {
|
||||
msg = '¿Está seguro que desea deshabilitar el rol?';
|
||||
msg = '¿Está seguro que desea deshabilitar el usuario?';
|
||||
}
|
||||
|
||||
if (!confirm(msg)) return;
|
||||
|
|
|
|||
|
|
@ -110,8 +110,13 @@
|
|||
<i id="ibtnSeleccionarCatalogo" class="fa fa-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div id="ucBtnSeleccionarOpcion" style="display:none;">
|
||||
<button type="button" id="btnSeleccionarOpcion" class="btn btn-default btn-xs">
|
||||
<i id="ibtnSeleccionarOpcion" class="fa fa-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modalRolesPantallas" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
@*<div class="modal fade" id="modalRolesPantallas" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
<div class="modal-dialog modal-lg" style="width:50%;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
|
@ -142,9 +147,110 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
</div>*@
|
||||
@*---------------------Roles Opciones---------------------------------------------------------*@
|
||||
<div class="modal fade" id="modalRolesOpciones" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
<div class="modal-dialog modal-lg" style="width:50%;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4><i class="fa fa-bars"></i> Opciones</h4>
|
||||
|
||||
</div>
|
||||
<div class="form-group" id="divUsuario">
|
||||
|
||||
<label class="col-lg-2 col-md-2 col-sm-2 col-xs-2 control-label ControlsForms" id="lblOpcion" for="txtBuscarOpcion">Buscar</label>
|
||||
<div class="input-group input-group-sm col-md-6">
|
||||
<input id="hiddenOpcion" type="hidden">
|
||||
<input name="txtOpcion" title="" class="form-control TextBoxCatalogo" id="txtOpcion" type="text" readonly>
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btn-medium" id="btn_eliminarOpcion" type="button" onclick="javascript: LimpiarOpcion()">
|
||||
<i class="fa fa-close"></i>
|
||||
</button>
|
||||
<button class="btn btn-info btn-medium btn-margin-catalogo" id="btnBuscarOpcion" type="button">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
<button class="btn btn-success btn-medium btn-margin-catalogo" id="btnAgregarOpcion" type="button">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="modal-body">
|
||||
<table id="GridRolesOpciones" class="table table-condensed dataTable no-footer">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="col-sm-1"></th>
|
||||
<th class="col-sm-4">ID</th>
|
||||
<th class="col-sm-4">Descripción</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id="ucItemsIconOpcion" style="display:none;">
|
||||
<div class="text-[$state_color]">
|
||||
<i class="fa [$icon] fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ucItemsHabiliarOpcion" style="display:none;">
|
||||
<button type="button" id="btnhabilitarOpcion" class="btn btn-default btn-xs" onclick="javascript: HabilitarOpcion([$CodItem], [$value])">
|
||||
<i class=" fa [$icon]"></i> [$opcion]
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success btn-sm" onclick="javascript: GuardarRolesOpciones()">Guardar</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@*---------------------Opciones---------------------------------------------------------*@
|
||||
<div class="modal fade" id="modalOpciones" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Catálogo Opciones</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<table id="tableOpciones" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-2">ID</th>
|
||||
<th class="col-sm-2">Descripción</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ucbtnRemoverOpcion" style=" display:none;">
|
||||
<button type="button" id="btnRemoverOpcion" class="btn btn-default btn-xs">
|
||||
<i class="fa fa-remove"></i> Remover
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@*---------------------Roles Usuarios---------------------------------------------------------*@
|
||||
<div class="modal fade" id="modalRolesUsuario" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="display: none;">
|
||||
<div class="modal-dialog modal-lg" style="width:50%;">
|
||||
<div class="modal-content">
|
||||
|
|
|
|||
|
|
@ -48,21 +48,8 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
|
||||
if (model != null && !string.IsNullOrWhiteSpace(model.codigo))
|
||||
{
|
||||
if (!db.RolesPantallas.Any(r => r.IdRol.ToString() == model.codigo))
|
||||
{
|
||||
var ListaPantallas = db.Pantallas.ToList();
|
||||
var dal = new RolesDAL();
|
||||
|
||||
foreach (var pantalla in ListaPantallas)
|
||||
dal.InsertarActualizarRolesPantallas(new RolesPantallas()
|
||||
{
|
||||
IdRol = Convert.ToInt32(model.codigo),
|
||||
IdPantalla = pantalla.IdPantalla,
|
||||
Estado = false
|
||||
});
|
||||
}
|
||||
|
||||
registros = db.RolesPantallas.Where(r => r.IdRol.ToString() == model.codigo).Include(p => p.Pantallas).OrderBy(r => r.IdPantalla).AsNoTracking().ToList();
|
||||
registros = db.RolesPantallas.Where(r => r.IdRol.ToString() == model.codigo).Include(u => u.Pantallas).OrderBy(u => u.IdRolesPantallas).AsNoTracking().ToList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -74,5 +61,44 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
|
||||
return registros;
|
||||
}
|
||||
|
||||
//public List<RolesPantallas> ObtenerPantallasRol(CatalogosPostJSON model)
|
||||
//{
|
||||
// List<RolesPantallas> registros = null;
|
||||
// string filtro = model != null ? model.filtro : null;
|
||||
|
||||
// try
|
||||
// {
|
||||
// using (SinortContex db = new SinortContex())
|
||||
// {
|
||||
|
||||
// if (model != null && !string.IsNullOrWhiteSpace(model.codigo))
|
||||
// {
|
||||
// if (!db.RolesPantallas.Any(r => r.IdRol.ToString() == model.codigo))
|
||||
// {
|
||||
// var ListaPantallas = db.Pantallas.ToList();
|
||||
// var dal = new RolesDAL();
|
||||
|
||||
// foreach (var pantalla in ListaPantallas)
|
||||
// dal.InsertarActualizarRolesPantallas(new RolesPantallas()
|
||||
// {
|
||||
// IdRol = Convert.ToInt32(model.codigo),
|
||||
// IdPantalla = pantalla.IdPantalla,
|
||||
// Estado = false
|
||||
// });
|
||||
// }
|
||||
|
||||
// registros = db.RolesPantallas.Where(r => r.IdRol.ToString() == model.codigo).Include(p => p.Pantallas).OrderBy(r => r.IdPantalla).AsNoTracking().ToList();
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// log.Error(ex);
|
||||
// }
|
||||
|
||||
// return registros;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,37 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
{
|
||||
Log log = new Log("PermisosUsuarioDAL");
|
||||
|
||||
public List<Pantallas> ObtenerPermisos(AtesaJSON model)
|
||||
{
|
||||
List<Pantallas> pantallas = new List<Pantallas>();
|
||||
try
|
||||
{
|
||||
using (SinortContex Conn = new SinortContex())
|
||||
{
|
||||
|
||||
var opciones = (from p in Conn.Pantallas
|
||||
join rp in Conn.RolesPantallas on p.IdPantalla equals rp.IdPantalla
|
||||
join ru in Conn.RolesUsuario on rp.IdRol equals ru.IdRol
|
||||
where ru.UsuarioSistema == model.UserName && rp.Estado == true
|
||||
select p).ToList();
|
||||
|
||||
pantallas = opciones.ToList();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (DbEntityValidationException ex)
|
||||
{
|
||||
log.Error(ex);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Error(ex);
|
||||
|
||||
}
|
||||
|
||||
return pantallas;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
using Atesa.Utilitarios;
|
||||
using AYA.SlnSinortModel.Sinort;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -53,7 +54,7 @@ namespace AYA.SlnSinortModel.Entidades
|
|||
public bool allDay { get; set; }
|
||||
}
|
||||
|
||||
public class PermisosJSON : BaseJson
|
||||
public class PermisosJSON : AtesaJSON
|
||||
{
|
||||
public List<Pantallas> Pantallas { get; set; }
|
||||
public RolesPantallas RolesPantallas { get; set; }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Atesa.Utilitarios
|
|||
{
|
||||
public string UserName { get; set; }
|
||||
public string UserFullName { get; set; }
|
||||
|
||||
public List<String> PermisosUsuario { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue