git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C41
This commit is contained in:
parent
cc2573fa53
commit
78716bea31
15 changed files with 646 additions and 191 deletions
|
|
@ -34,5 +34,13 @@ namespace AYA.SlnSinort.WCF
|
|||
[OperationContract]
|
||||
BaseJson InsertarActualizarEmisor(Emisor model);
|
||||
#endregion
|
||||
|
||||
#region Rol
|
||||
[OperationContract]
|
||||
List<Roles> ObtenerRol();
|
||||
|
||||
[OperationContract]
|
||||
BaseJson InsertarActualizarRol(Roles model);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
using AYA.SlnSinortModel.Constantes;
|
||||
using AYA.SlnSinortModel.DAL.Sinort;
|
||||
using AYA.SlnSinortModel.Entidades;
|
||||
using AYA.SlnSinortModel.Sinort;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -14,6 +16,21 @@ namespace AYA.SlnSinort.WCF
|
|||
|
||||
public class Sinort : ISinort
|
||||
{
|
||||
#region ProyectoNormativo
|
||||
//public List<Mantenimiento> ObtenerSitios()
|
||||
//{
|
||||
// List<Mantenimiento> respuesta = null;
|
||||
// try
|
||||
// {
|
||||
// respuesta = new MantenimientoDAL().ObtenerSitios();
|
||||
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// return respuesta;
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,5 +96,37 @@ namespace AYA.SlnSinort.WCF
|
|||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rol
|
||||
public List<Roles> ObtenerRol()
|
||||
{
|
||||
List<Roles> respuesta = null;
|
||||
try
|
||||
{
|
||||
respuesta = new RolesDAL().ObtenerRol();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
return respuesta;
|
||||
}
|
||||
|
||||
public BaseJson InsertarActualizarRol(Roles model)
|
||||
{
|
||||
BaseJson respuesta = new BaseJson();
|
||||
try
|
||||
{
|
||||
respuesta = new RolesDAL().InsertarActualizarRol(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
return respuesta;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7673,6 +7673,8 @@
|
|||
<Content Include="Sinort-Scripts\EmisorPN.js" />
|
||||
<Content Include="Sinort-Scripts\Global.js" />
|
||||
<Content Include="Sinort-Scripts\Mantenimientos.js" />
|
||||
<Content Include="Sinort-Scripts\ProyectoNormativo.js" />
|
||||
<Content Include="Sinort-Scripts\Rol.js" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
|
|
@ -7702,6 +7704,8 @@
|
|||
<Content Include="Views\Catalogos\EmisorPN.cshtml" />
|
||||
<Content Include="Views\Catalogos\Mantenimiento.cshtml" />
|
||||
<Content Include="Views\Catalogos\Aplicacion.cshtml" />
|
||||
<Content Include="Views\Home\Proyecto_Normativo.cshtml" />
|
||||
<Content Include="Views\Catalogos\Rol.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
|
|||
|
|
@ -24,5 +24,11 @@ namespace AYA.SlnSinort.Controllers.Catalogos
|
|||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Rol()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -25,7 +25,7 @@ this.getDataModel = function () {
|
|||
|
||||
|
||||
$('#btnLimpiar').click(function () {
|
||||
limpiar();
|
||||
LimpiarControles();
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
|
@ -39,89 +39,67 @@ this.getDataModel = function () {
|
|||
InsertarItem();
|
||||
});
|
||||
|
||||
|
||||
obtenerItems();
|
||||
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
||||
ObtenerAplicaciones();
|
||||
|
||||
|
||||
}
|
||||
this.CargarGridAplicaciones = function (data) {
|
||||
|
||||
this.obtenerItems = function () {
|
||||
var TableItems = $('#TableItems').DataTable();
|
||||
var lista = data;
|
||||
|
||||
$.each(lista, function (key, item) {
|
||||
|
||||
|
||||
var option = $("#ucItemsCatalogo").html();
|
||||
|
||||
option = replaceAll("[$CodItem]", item.IdAplicacion, option);
|
||||
|
||||
var stateIcon = $("#ucItemsIcon").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.row.add([stateIcon,
|
||||
item.IdAplicacion,
|
||||
item.Descripcion,
|
||||
option]).draw();
|
||||
|
||||
});
|
||||
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.ObtenerAplicaciones = function (data) {
|
||||
|
||||
|
||||
var uri = CatalogosWCF + '/api/ObtenerAplicacion';
|
||||
AjaxPostData(uri, null, false, false, CargarGridAplicaciones, null, null);
|
||||
|
||||
var DTO = JSON.stringify(Item);
|
||||
STARTREQUEST();
|
||||
//$.getJSON(uri).done(function (data) {
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: uri,
|
||||
cache: false,
|
||||
data: DTO,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
|
||||
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
||||
|
||||
var TableItems = $('#TableItems').DataTable();
|
||||
var lista = data;
|
||||
|
||||
$.each(lista, function (key, item) {
|
||||
|
||||
|
||||
var option = $("#ucItemsCatalogo").html();
|
||||
|
||||
option = replaceAll("[$CodItem]", item.IdAplicacion, option);
|
||||
|
||||
var stateIcon = $("#ucItemsIcon").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.row.add([stateIcon,
|
||||
item.IdAplicacion,
|
||||
item.Descripcion,
|
||||
option]).draw();
|
||||
|
||||
});
|
||||
|
||||
ENDREQUEST();
|
||||
}
|
||||
}).fail(function (jqxhr, textStatus, error) {
|
||||
|
||||
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo mas tarde");
|
||||
|
||||
console.log("Request Failed: " + textStatus + ', ' + error);
|
||||
|
||||
ENDREQUEST();
|
||||
|
||||
}).then(function (value) {
|
||||
|
||||
ENDREQUEST();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.EditarItem = function (id) {
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
limpiar();
|
||||
LimpiarControles();
|
||||
var indexes = getRowIndex(TableItems, id_column, id);
|
||||
|
||||
if (indexes != null) {
|
||||
|
|
@ -141,7 +119,6 @@ this.EditarItem = function (id) {
|
|||
$('#btnGuardar').show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.toggleEnabledItem = function (id, value) {
|
||||
|
|
@ -159,54 +136,16 @@ this.toggleEnabledItem = function (id, value) {
|
|||
|
||||
if (!confirm(msg))
|
||||
{ return; }
|
||||
STARTREQUEST();
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Item = {
|
||||
Aplicacion = {
|
||||
IdAplicacion: id,
|
||||
Estado: value,
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarAplicacion';
|
||||
var DTO = JSON.stringify(Item);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: uri,
|
||||
cache: false,
|
||||
data: DTO,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
|
||||
if (data.CodigoRespuesta == "EXITOSO") {
|
||||
toastr.info('Información actualizada con éxito', 'Completado');
|
||||
limpiar();
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
TableItems.clear().draw();
|
||||
obtenerItems();
|
||||
ENDREQUEST();
|
||||
}
|
||||
else {
|
||||
toastr.error("Ha ocurrido un error.");
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
}
|
||||
}).fail(function (jqxhr, textStatus, error) {
|
||||
|
||||
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo.");
|
||||
ENDREQUEST();
|
||||
|
||||
}).then(function (value) {
|
||||
|
||||
ENDREQUEST();
|
||||
|
||||
});
|
||||
AjaxPostData(uri, Aplicacion, true, true, CompletarAccion, null, null);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +158,7 @@ this.ActualizarItem = function () {
|
|||
|
||||
if (!confirm("Se guardarán los cambios.\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
STARTREQUEST();
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Aplicacion = {
|
||||
|
|
@ -229,48 +168,8 @@ this.ActualizarItem = function () {
|
|||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarAplicacion';
|
||||
var DTO = JSON.stringify(Aplicacion);
|
||||
AjaxPostData(uri, Aplicacion, true, true, CompletarAccion, null, null);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: uri,
|
||||
cache: false,
|
||||
data: DTO,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
|
||||
if (data.CodigoRespuesta == "EXITOSO") {
|
||||
toastr.info('Información guardada con éxito', 'Completado');
|
||||
limpiar();
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
$('#lbTituloAccion').empty();
|
||||
$('#lbTituloAccion').append('Ingresar Nueva Aplicación');
|
||||
|
||||
TableItems.clear().draw();
|
||||
obtenerItems();
|
||||
ENDREQUEST();
|
||||
|
||||
}
|
||||
else {
|
||||
toastr.error("Ha ocurrido un error.");
|
||||
ENDREQUEST();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}).fail(function (jqxhr, textStatus, error) {
|
||||
|
||||
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo.");
|
||||
ENDREQUEST();
|
||||
|
||||
}).then(function (value) {
|
||||
|
||||
ENDREQUEST();
|
||||
});
|
||||
}
|
||||
|
||||
this.InsertarItem = function () {
|
||||
|
|
@ -284,7 +183,7 @@ this.InsertarItem = function () {
|
|||
if (!confirm("Va a ingresar una nueva aplicación.\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
STARTREQUEST();
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Aplicacion = {
|
||||
|
|
@ -294,43 +193,19 @@ this.InsertarItem = function () {
|
|||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarAplicacion';
|
||||
var DTO = JSON.stringify(Aplicacion);
|
||||
AjaxPostData(uri, Aplicacion, true, true, CompletarAccion, null, null);
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: uri,
|
||||
cache: false,
|
||||
data: DTO,
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
|
||||
if (data.CodigoRespuesta == "EXITOSO") {
|
||||
toastr.info('Información guardada con exito', 'Completado');
|
||||
limpiar();
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
TableItems.clear().draw();
|
||||
obtenerItems();
|
||||
ENDREQUEST();
|
||||
}
|
||||
else {
|
||||
toastr.error("Ha ocurrido un error.");
|
||||
ENDREQUEST();
|
||||
}
|
||||
}
|
||||
}).fail(function (jqxhr, textStatus, error) {
|
||||
|
||||
toastr.error("Ha ocurrido un error inesperado. Vuela a intentarlo.");
|
||||
ENDREQUEST();
|
||||
|
||||
}).then(function (value) {
|
||||
ENDREQUEST();
|
||||
});
|
||||
}
|
||||
this.CompletarAccion = function () {
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
this.limpiar = function () {
|
||||
TableItems.clear().draw();
|
||||
ObtenerAplicaciones();
|
||||
LimpiarControles();
|
||||
ENDREQUEST();
|
||||
}
|
||||
this.LimpiarControles = function () {
|
||||
|
||||
$('#txtDescripcion').val('');
|
||||
$("#formCatalogo").validateElement("#txtDescripcion");
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ this.ActualizarItem = function () {
|
|||
{ return; }
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
EmisorPN = {
|
||||
IdEmisor: $('#hiddenId').val(),
|
||||
Descripcion: $('#txtDescripcion').val(),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
jQuery(document).ready(function () {
|
||||
|
||||
var Item = {};
|
||||
jQuery(document).ready(function () {
|
||||
CargarMantenimiento();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
//#region READY
|
||||
var Item = {};
|
||||
jQuery(document).ready(function () {
|
||||
CargarSitios();
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
this.CargarSitios = function () {
|
||||
|
||||
var uri = CatalogosWCF + '/api/ObtenerSitios';
|
||||
AjaxPostData(uri, Item, true, false, CargarTablaSitios, null, null);
|
||||
}
|
||||
|
||||
this.CargarTablaSitios = function (data) {
|
||||
|
||||
if (data != null) {
|
||||
lista = data;
|
||||
var Seleccionar = $("#ucbtnVista").html();
|
||||
var columnDefinition = [
|
||||
{ "data": "Nombre" },
|
||||
{ "data": "Tipo" },
|
||||
{ "data": null, className: "center", defaultContent: Seleccionar }
|
||||
];
|
||||
|
||||
$('#tableSitios').TableInit(1, true, true, true, true, columnDefinition, lista);
|
||||
|
||||
if ($.fn.DataTable.isDataTable('#tableSitios')) {
|
||||
|
||||
$('#tableSitios').DataTable().search('').draw();
|
||||
ENDREQUEST();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#tableSitios').on('click', 'button', function () {
|
||||
|
||||
var data = $('#tableSitios').DataTable().row($(this).parents('tr')).data();
|
||||
|
||||
var mtzView = data.Vista.split('/')
|
||||
|
||||
url = $("#hiddenHref").val();
|
||||
url = url.replace("View", mtzView[1]);
|
||||
url = url.replace("Controller", mtzView[0]);
|
||||
|
||||
document.location.href = url;
|
||||
|
||||
});
|
||||
216
AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js
Normal file
216
AYA.SlnSynor/AYA.SlnSynor/Sinort-Scripts/Rol.js
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
//$("#formCatalogo").EnableValidationToolTip();
|
||||
var DataCatalogo;
|
||||
var id_column = 1;
|
||||
var Item = {};
|
||||
|
||||
|
||||
//#region READY
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
|
||||
getDataModel();
|
||||
|
||||
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
this.getDataModel = function () {
|
||||
|
||||
$('#txtDescripcion').attr('size', 50);
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
|
||||
$('#btnLimpiar').click(function () {
|
||||
LimpiarControles();
|
||||
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
});
|
||||
|
||||
$('#btnGuardar').click(function () {
|
||||
ActualizarItem();
|
||||
});
|
||||
|
||||
$('#btnInsertar').click(function () {
|
||||
InsertarItem();
|
||||
});
|
||||
|
||||
$('#TableItems').TableInit(0, false, true, true, false, null, null);
|
||||
ObtenerRoles();
|
||||
|
||||
|
||||
}
|
||||
this.CargarGridRoles = function (data) {
|
||||
|
||||
var TableItems = $('#TableItems').DataTable();
|
||||
var lista = data;
|
||||
|
||||
$.each(lista, function (key, item) {
|
||||
|
||||
|
||||
var option = $("#ucItemsCatalogo").html();
|
||||
|
||||
option = replaceAll("[$CodItem]", item.IdRol, option);
|
||||
|
||||
var stateIcon = $("#ucItemsIcon").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.row.add([stateIcon,
|
||||
item.IdRol,
|
||||
item.Descripcion,
|
||||
option]).draw();
|
||||
|
||||
});
|
||||
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.ObtenerRoles = function (data) {
|
||||
|
||||
|
||||
var uri = CatalogosWCF + '/api/ObtenerRol';
|
||||
AjaxPostData(uri, null, false, false, CargarGridRoles, null, null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.EditarItem = function (id) {
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
LimpiarControles();
|
||||
var indexes = getRowIndex(TableItems, id_column, id);
|
||||
|
||||
if (indexes != null) {
|
||||
|
||||
$('#hiddenId').val(id)
|
||||
$('#txtDescripcion').val(TableItems.cell(indexes, 2).data());
|
||||
|
||||
|
||||
|
||||
$("#formCatalogo").validateElement("#txtDescripcion");
|
||||
|
||||
|
||||
$('#lbTituloAccion').empty();
|
||||
$('#lbTituloAccion').append('Editar Valor de Campo ID: ' + id);
|
||||
|
||||
$('#btnInsertar').hide();
|
||||
$('#btnGuardar').show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.toggleEnabledItem = function (id, value) {
|
||||
|
||||
var msg = '¿Está seguro que desea habilitar el rol?';
|
||||
|
||||
if (value == 0) {
|
||||
msg = '¿Está seguro que desea deshabilitar el rol?';
|
||||
}
|
||||
|
||||
if (id == null || value == null) {
|
||||
toastr.warning("No se pudo obtener el ID del rol seleccionado.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm(msg))
|
||||
{ return; }
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Rol = {
|
||||
IdRol: id,
|
||||
Estado: value,
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarRol';
|
||||
AjaxPostData(uri, Rol, true, true, CompletarAccion, null, null);
|
||||
|
||||
}
|
||||
|
||||
this.ActualizarItem = function () {
|
||||
|
||||
if (!$("#formCatalogo").valid()) {
|
||||
toastr.warning("Ingresar todos los campos que son requeridos.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!confirm("Se guardarán los cambios.\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Rol = {
|
||||
IdRol: $('#hiddenId').val(),
|
||||
Descripcion: $('#txtDescripcion').val(),
|
||||
Estado: 1,
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarRol';
|
||||
AjaxPostData(uri, Rol, true, true, CompletarAccion, null, null);
|
||||
|
||||
}
|
||||
|
||||
this.InsertarItem = function () {
|
||||
|
||||
|
||||
if (!$("#formCatalogo").valid()) {
|
||||
toastr.warning("Ingresar todos los campos que son requeridos.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!confirm("Va a ingresar una nueva aplicación.\n ¿Desea continuar?"))
|
||||
{ return; }
|
||||
|
||||
|
||||
TableItems = $('#TableItems').DataTable();
|
||||
|
||||
Rol = {
|
||||
Descripcion: $("#txtDescripcion").val(),
|
||||
Estado: 1
|
||||
}
|
||||
|
||||
var uri = CatalogosWCF + '/api/InsertarActualizarRol';
|
||||
AjaxPostData(uri, Rol, true, true, CompletarAccion, null, null);
|
||||
|
||||
}
|
||||
this.CompletarAccion = function () {
|
||||
$('#btnGuardar').hide();
|
||||
$('#btnInsertar').show();
|
||||
|
||||
TableItems.clear().draw();
|
||||
ObtenerAplicaciones();
|
||||
LimpiarControles();
|
||||
ENDREQUEST();
|
||||
}
|
||||
this.LimpiarControles = function () {
|
||||
|
||||
$('#txtDescripcion').val('');
|
||||
$("#formCatalogo").validateElement("#txtDescripcion");
|
||||
|
||||
$('#lbTituloAccion').empty();
|
||||
$('#lbTituloAccion').append('Ingresar Nueva Aplicación');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<input type="hidden" id="hiddenId" value="true">
|
||||
<form id="formCatalogo" class="form-horizontal" role="form">
|
||||
<div class="panel-body"> <h3> <i class="fa fa-briefcase"></i> Emisor PN</h3> </div>
|
||||
<div class="panel-body"> <h3> <i class="fa fa-briefcase"></i> Emisor </h3> </div>
|
||||
<div class="panel panel-success">
|
||||
|
||||
<div class="panel-body">
|
||||
|
|
|
|||
100
AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml
Normal file
100
AYA.SlnSynor/AYA.SlnSynor/Views/Catalogos/Rol.cshtml
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
@{
|
||||
ViewBag.Title = "Rol";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<input type="hidden" id="hiddenId" value="true">
|
||||
<form id="formCatalogo" class="form-horizontal" role="form">
|
||||
<h3> <i class="fa fa-briefcase"></i> Roles</h3>
|
||||
<div class="panel panel-success">
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<table id="TableItems" class="display">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="col-sm-1">ID</th>
|
||||
<th class="col-sm-4">Descripción</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id="ucItemsIcon" style="display:none;">
|
||||
<div class="text-[$state_color]">
|
||||
<i class="fa [$icon] fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div id="ucItemsCatalogo" style="display:none;">
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-info dropdown-toggle btn-xs" data-toggle="dropdown">
|
||||
<i class="fa fa-wrench"></i> Opciones <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="javascript: EditarItem([$CodItem]);"><i class="fa fa-wrench"></i> Editar</a></li>
|
||||
<li><a href="javascript: toggleEnabledItem([$CodItem],[$value]);"><i class="fa [$icon]"></i> [$opcion]</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<i class="fa fa-bars"></i> <label id="lbTituloAccion">Ingresar Nuevo Rol</label>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
@*Descripción*@
|
||||
|
||||
<input type="text" class="form-control" id="txtDescripcion">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2"></label>
|
||||
<div class="col-md-4 ">
|
||||
|
||||
<button type="button" class="btn btn-default btn-sm pull-right" id="btnLimpiar">
|
||||
<span class="fa fa-eraser" aria-hidden="true"></span> Limpiar
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-4 ">
|
||||
<button type="button" class="btn btn-default btn-sm pull-right" id="btnInsertar">
|
||||
<span class="fa fa-upload" aria-hidden="true"></span> Insertar
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-sm pull-right" id="btnGuardar">
|
||||
<span class="fa fa-floppy-o" aria-hidden="true"></span> Guardar
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@Scripts.Render("~/Sinort-Scripts/Rol.js")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
@{
|
||||
ViewBag.Title = "Proyecto_Normativo";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<input type="hidden" id="hiddenHref" value="@string.Concat(Url.Action("View", "Controller", null), ViewBag.QueryEncripted)">
|
||||
<form id="formSitios" class="form-horizontal" role="form">
|
||||
<div class="panel-body">
|
||||
<h3> <i class="fa fa-list-ul"></i> Sitios </h3>
|
||||
<br />
|
||||
<br />
|
||||
<div>
|
||||
<table id="tableSitios" class="table table-condensed dataTable no-footer">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-4">Nombre</th>
|
||||
<th class="col-sm-4">Tipo</th>
|
||||
<th>Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div id="ucbtnVista" style=" display:none;">
|
||||
<button type="button" id="btnseleccionar" class="btn btn-default btn-xs">
|
||||
<i class="fa fa-check"></i> Seleccionar
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
@Scripts.Render("~/Sinort-Scripts/ProyectoNormativo.js")
|
||||
|
||||
|
||||
|
|
@ -3,10 +3,116 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AYA.SlnSinortModel;
|
||||
using AYA.SlnSinortModel.Entidades;
|
||||
using AYA.SlnSinortModel.Sinort;
|
||||
using System.Data.Entity.Validation;
|
||||
using Atesa.Utilitarios;
|
||||
using AYA.SlnSinortModel.Constantes;
|
||||
|
||||
namespace AYA.SlnSinortModel.DAL.Sinort
|
||||
{
|
||||
public class RolesDAL
|
||||
{
|
||||
#region ObtenerRol
|
||||
|
||||
public List<CatalogosJSON> ObtenerRol(string filtro = null)
|
||||
{
|
||||
List<CatalogosJSON> registros = null;
|
||||
try
|
||||
{
|
||||
using (SinortContex db = new SinortContex())
|
||||
{
|
||||
registros = (string.IsNullOrWhiteSpace(filtro) ? db.Roles.Where(t => t.Estado == true) : db.Roles.Where(t => t.Estado == true && t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower()) == true))
|
||||
.Select(t => new CatalogosJSON()
|
||||
{
|
||||
codigo = t.IdRol.ToString(),
|
||||
descripcion = t.Descripcion,
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//log.Error(ex);
|
||||
}
|
||||
|
||||
return registros;
|
||||
}
|
||||
|
||||
public List<Roles> ObtenerRol()
|
||||
{
|
||||
List<Roles> respuesta = null;
|
||||
try
|
||||
{
|
||||
using (SinortContex db = new SinortContex())
|
||||
{
|
||||
respuesta = db.Roles.ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//log.Error(ex);
|
||||
}
|
||||
|
||||
return respuesta;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region InsertarActualizar
|
||||
|
||||
public BaseJson InsertarActualizarRol(Roles model)
|
||||
{
|
||||
Roles Actual = new Roles();
|
||||
BaseJson Respuesta = new BaseJson();
|
||||
try
|
||||
{
|
||||
model.ClearProperties();
|
||||
|
||||
using (SinortContex Conn = new SinortContex())
|
||||
{
|
||||
Actual = Conn.Roles.Where(x => x.IdRol == model.IdRol).FirstOrDefault();
|
||||
if (Actual == null)
|
||||
{
|
||||
int? Next_id = Conn.Roles.Max(t => (int?)t.IdRol);
|
||||
model.IdRol = (Next_id == null) ? 1 : Next_id.Value + 1;
|
||||
model.FechaCreacion = DateTime.Now;
|
||||
Conn.Roles.Add(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.FechaModificacion = DateTime.Now;
|
||||
model.FechaCreacion = Actual.FechaCreacion;
|
||||
model.UsuarioCreacion = Actual.UsuarioCreacion;
|
||||
model.Descripcion = string.IsNullOrEmpty(model.Descripcion) ? Actual.Descripcion : model.Descripcion;
|
||||
Conn.Entry(Actual).State = System.Data.Entity.EntityState.Detached;
|
||||
Conn.Roles.Attach(model);
|
||||
Conn.Entry(model).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
Conn.SaveChanges();
|
||||
Conn.Commit();
|
||||
Respuesta.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO.ToString();
|
||||
}
|
||||
}
|
||||
catch (DbEntityValidationException ex)
|
||||
{
|
||||
//logger.Error(exs);
|
||||
Respuesta.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//logger.Error(ex);
|
||||
Respuesta.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR.ToString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Actual = null;
|
||||
}
|
||||
return Respuesta;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue