git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C248
This commit is contained in:
parent
8c6f2bbb60
commit
b0452f30c3
6 changed files with 338 additions and 2 deletions
|
|
@ -183,6 +183,17 @@ namespace AYA.SlnSinort.WCF
|
||||||
BaseJson InsertarActualizarPalabraClave(PalabraClave model);
|
BaseJson InsertarActualizarPalabraClave(PalabraClave model);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Area Aplicacion Documento Tecnico
|
||||||
|
[OperationContract]
|
||||||
|
List<AreaAplicacionDocumentoTecnico> ObtenerAreaAplicacionDocumentoTecnico();
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
List<CatalogosJSON> ObtenerAreaAplicacionDocumentoTecnicoPopUp(CatalogosPost model);
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
BaseJson InsertarActualizarAreaAplicacionDocumentoTecnico(AreaAplicacionDocumentoTecnico model);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -739,5 +739,57 @@ namespace AYA.SlnSinort.WCF
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Area Aplicacion Documento Tecnico
|
||||||
|
public List<AreaAplicacionDocumentoTecnico> ObtenerAreaAplicacionDocumentoTecnico()
|
||||||
|
{
|
||||||
|
List<AreaAplicacionDocumentoTecnico> respuesta = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
respuesta = new AreaAplicacionDocumentoTecnicoDAL().ObtenerAreaAplicacionDocumentoTecnico();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
}
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CatalogosJSON> ObtenerAreaAplicacionDocumentoTecnicoPopUp(CatalogosPost model)
|
||||||
|
{
|
||||||
|
List<CatalogosJSON> respuesta = new List<CatalogosJSON>();
|
||||||
|
CatalogosPostJSON CatalogosPostJSON = new CatalogosPostJSON();
|
||||||
|
CatalogosPostJSON.filtro = model.filtro;
|
||||||
|
CatalogosPostJSON.IdTipo = model.IdTipo;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
respuesta = new AreaAplicacionDocumentoTecnicoDAL().ObtenerAreaAplicacionDocumentoTecnico(CatalogosPostJSON);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
}
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseJson InsertarActualizarAreaAplicacionDocumentoTecnico(AreaAplicacionDocumentoTecnico model)
|
||||||
|
{
|
||||||
|
BaseJson respuesta = new BaseJson();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
respuesta = new AreaAplicacionDocumentoTecnicoDAL().InsertarActualizarAreaAplicacionDocumentoTecnico(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
log.Error(ex);
|
||||||
|
}
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ this.CargarTipoSolicitud = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getDataModel = function () {
|
this.getDataModel = function () {
|
||||||
//CargarAreaAplicacion();
|
CargarAreaAplicacion();
|
||||||
CargarSuperior();
|
CargarSuperior();
|
||||||
$('#txtUsuarioSistema').val(UsuarioSistema);
|
$('#txtUsuarioSistema').val(UsuarioSistema);
|
||||||
|
|
||||||
|
|
@ -70,6 +70,24 @@ this.getDataModel = function () {
|
||||||
ENDREQUEST();
|
ENDREQUEST();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#btnBuscarAreaAplicacionDocumentoTecnico").unbind("click");
|
||||||
|
$("#btnBuscarAreaAplicacionDocumentoTecnico").click(function () {
|
||||||
|
|
||||||
|
SelectedCatalog = 'Area';
|
||||||
|
|
||||||
|
if ($.fn.DataTable.isDataTable('#tableAreaAplicacionDocumentoTecnico')) {
|
||||||
|
|
||||||
|
LoadMessage();
|
||||||
|
|
||||||
|
$('#tableAreaAplicacionDocumentoTecnico').DataTable().search('').draw();
|
||||||
|
|
||||||
|
$('#modalAreaAplicacionDocumentoTecnico').modal('show');
|
||||||
|
|
||||||
|
ENDREQUEST();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.CargarEstado = function (filtro) {
|
this.CargarEstado = function (filtro) {
|
||||||
|
|
@ -106,6 +124,7 @@ this.CargarGridEstado = function (data) {
|
||||||
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.CargarSuperior = function (filtro) {
|
this.CargarSuperior = function (filtro) {
|
||||||
|
|
||||||
var uri = CatalogosWCF + '/api/ObtenerUsuario';
|
var uri = CatalogosWCF + '/api/ObtenerUsuario';
|
||||||
|
|
@ -138,6 +157,38 @@ this.CargarGridSuperior = function (data) {
|
||||||
ENDREQUEST();
|
ENDREQUEST();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.CargarAreaAplicacion = function (filtro) {
|
||||||
|
|
||||||
|
var uri = CatalogosWCF + '/api/ObtenerAreaAplicacionDocumentoTecnico';
|
||||||
|
AjaxPostData(uri, null, false, false, CargarGridAreaAplicacion, null, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.CargarGridAreaAplicacion = function (data) {
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
|
||||||
|
listaArea = data;
|
||||||
|
|
||||||
|
var Seleccionar = $("#ucBtnSeleccionarCatalogo").html();
|
||||||
|
var columnDefinition = [
|
||||||
|
{ "data": null, className: "center", defaultContent: Seleccionar },
|
||||||
|
{ "data": "IdAreaAplicacionDocumentoTecnico", className: "center" },
|
||||||
|
{ "data": "Descripcion", className: "center" }
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$('#tableAreaAplicacionDocumentoTecnico').TableInit(0, false, true, true, false, columnDefinition, listaArea, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
|
||||||
|
toastr.error("Ha ocurrido un error inesperado. Vuelva a intentarlo mas tarde", Message_Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
ENDREQUEST();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//tables
|
//tables
|
||||||
$('#tableNombreSuperior').on('click', 'button', function () {
|
$('#tableNombreSuperior').on('click', 'button', function () {
|
||||||
|
|
@ -166,3 +217,16 @@ $('#tableEstado').on('click', 'button', function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#tableAreaAplicacionDocumentoTecnico').on('click', 'button', function () {
|
||||||
|
|
||||||
|
var data = $('#tableAreaAplicacionDocumentoTecnico').DataTable().row($(this).parents('tr')).data();
|
||||||
|
|
||||||
|
if (SelectedCatalog == "Area") {
|
||||||
|
|
||||||
|
$('#hiddenAreaAplicacionDocumentoTecnico').val(data.IdAreaAplicacionDocumentoTecnico);
|
||||||
|
$('#txtAreaAplicacionDocumentoTecnico').val(data.Descripcion);
|
||||||
|
}
|
||||||
|
$('#modalAreaAplicacionDocumentoTecnico').modal('hide');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,93 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
|
@*---------------------Catalogo Area Aplicacion Documento Tecnico-----------------------------------------------------*@
|
||||||
|
<div class="modal fade" id="modalAreaAplicacionDocumentoTecnico" 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">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title">Catálogo Área de aplicación del documento técnico</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
<table id="tableAreaAplicacionDocumentoTecnico" class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>Código</th>
|
||||||
|
<th>Descripción</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
</div>@**@
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-8" style="margin-left:16%">
|
||||||
|
<div class="panel panel-success">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4 class="panel-title">
|
||||||
|
<i class="fa fa-bars"></i> <label id="lbTituloAccion">Especifique su propio ámbito</label>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
@*Descripción*@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label ControlsForms">Descripción</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" id="txtDescripcion" name="txtDescripcion" class="form-control imput-xs" required="required" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>@*----*@
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@section scripts{
|
@section scripts{
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Sinort\AplicacionDAL.cs" />
|
<Compile Include="Sinort\AplicacionDAL.cs" />
|
||||||
|
<Compile Include="Sinort\AreaAplicacionDocumentoTecnicoDAL.cs" />
|
||||||
<Compile Include="Sinort\BitacoraDocumentosDAL.cs" />
|
<Compile Include="Sinort\BitacoraDocumentosDAL.cs" />
|
||||||
<Compile Include="Sinort\CalendarioDAL.cs" />
|
<Compile Include="Sinort\CalendarioDAL.cs" />
|
||||||
<Compile Include="Sinort\CategoriaDAL.cs" />
|
<Compile Include="Sinort\CategoriaDAL.cs" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
using System;
|
||||||
|
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 AreaAplicacionDocumentoTecnicoDAL
|
||||||
|
{
|
||||||
|
Log log = new Log("AreaAplicacionDocumentoTecnicoDAL");
|
||||||
|
|
||||||
|
#region ObtenerAreaAplicacionDocumentoTecnico
|
||||||
|
|
||||||
|
public List<CatalogosJSON> ObtenerAreaAplicacionDocumentoTecnico(CatalogosPostJSON model)
|
||||||
|
{
|
||||||
|
List<CatalogosJSON> registros = null;
|
||||||
|
string filtro = model != null ? model.filtro : null;
|
||||||
|
int? IdAreaAplicacionDocumentoTecnico = model != null ? model.IdTipo : null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SinortContex db = new SinortContex())
|
||||||
|
{
|
||||||
|
registros = db.AreaAplicacionDocumentoTecnico.Where(t => t.Estado == true && t.IdAreaAplicacionDocumentoTecnico == IdAreaAplicacionDocumentoTecnico && (string.IsNullOrEmpty(filtro) || t.Descripcion.Trim().ToLower().Contains(filtro.Trim().ToLower())))
|
||||||
|
.Select(t => new CatalogosJSON()
|
||||||
|
{
|
||||||
|
codigo = t.IdAreaAplicacionDocumentoTecnico.ToString(),
|
||||||
|
descripcion = t.Descripcion,
|
||||||
|
}).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return registros;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AreaAplicacionDocumentoTecnico> ObtenerAreaAplicacionDocumentoTecnico()
|
||||||
|
{
|
||||||
|
List<AreaAplicacionDocumentoTecnico> respuesta = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SinortContex db = new SinortContex())
|
||||||
|
{
|
||||||
|
respuesta = db.AreaAplicacionDocumentoTecnico.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return respuesta;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region InsertarActualizar
|
||||||
|
|
||||||
|
public BaseJson InsertarActualizarAreaAplicacionDocumentoTecnico(AreaAplicacionDocumentoTecnico model)
|
||||||
|
{
|
||||||
|
AreaAplicacionDocumentoTecnico Actual = new AreaAplicacionDocumentoTecnico();
|
||||||
|
BaseJson Respuesta = new BaseJson();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
model.ClearProperties();
|
||||||
|
|
||||||
|
using (SinortContex Conn = new SinortContex())
|
||||||
|
{
|
||||||
|
Actual = Conn.AreaAplicacionDocumentoTecnico.Where(x => x.IdAreaAplicacionDocumentoTecnico == model.IdAreaAplicacionDocumentoTecnico).FirstOrDefault();
|
||||||
|
if (Actual == null)
|
||||||
|
{
|
||||||
|
int? Next_id = Conn.AreaAplicacionDocumentoTecnico.Max(t => (int?)t.IdAreaAplicacionDocumentoTecnico);
|
||||||
|
model.IdAreaAplicacionDocumentoTecnico = (Next_id == null) ? 1 : Next_id.Value + 1;
|
||||||
|
model.FechaCreacion = DateTime.Now;
|
||||||
|
Conn.AreaAplicacionDocumentoTecnico.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.AreaAplicacionDocumentoTecnico.Attach(model);
|
||||||
|
Conn.Entry(model).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
}
|
||||||
|
Conn.SaveChanges();
|
||||||
|
Conn.Commit();
|
||||||
|
Respuesta.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (DbEntityValidationException ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
Respuesta.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR.ToString();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
Respuesta.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR.ToString();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Actual = null;
|
||||||
|
}
|
||||||
|
return Respuesta;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue