git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C80
This commit is contained in:
parent
7ef10b9289
commit
e89b94b9ab
13 changed files with 304 additions and 77 deletions
|
|
@ -15,7 +15,13 @@ namespace AYA.SlnSinort.WCF
|
||||||
[ServiceContract]
|
[ServiceContract]
|
||||||
public interface ISinort
|
public interface ISinort
|
||||||
{
|
{
|
||||||
|
[OperationContract]
|
||||||
|
ProyectoNormativoJSON GuardarProyectoNormativo(ProyectoNormativoJSON model);
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
ProyectoNormativoJSON GuardarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model);
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,22 +19,85 @@ namespace AYA.SlnSinort.WCF
|
||||||
|
|
||||||
public class Sinort : ISinort
|
public class Sinort : ISinort
|
||||||
{
|
{
|
||||||
Log log = new Log("ForoDAL");
|
Log log = new Log("SinortWCF");
|
||||||
|
|
||||||
#region ProyectoNormativo
|
#region ProyectoNormativo
|
||||||
//public List<Mantenimiento> ObtenerSitios()
|
public ProyectoNormativoJSON GuardarProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
//{
|
{
|
||||||
// List<Mantenimiento> respuesta = null;
|
try
|
||||||
// try
|
{
|
||||||
// {
|
if (model.ProyectoNormativo == null)
|
||||||
// respuesta = new MantenimientoDAL().ObtenerSitios();
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos del proyecto normativo";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
// }
|
model = new ProyectoNormativoDAL().GuardarProyectoNormativo(model);
|
||||||
// catch (Exception ex)
|
}
|
||||||
// {
|
catch (Exception ex)
|
||||||
// throw;
|
{
|
||||||
// }
|
log.Error(ex);
|
||||||
// return respuesta;
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
//}
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProyectoNormativoJSON GuardarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (model.ProyectoNormativo == null)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos del proyecto normativo";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.ProyectoNormativo.ConvocatoriaProyectoNormativo == null || model.ProyectoNormativo.ConvocatoriaProyectoNormativo == null || model.ProyectoNormativo.ConvocatoriaProyectoNormativo.Count == 0)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos asociados a la convocatoria del proyecto normativo";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
model = new ConvocatoriaDAL().GuardarConvocatoriaProyectoNormativo(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (model.ProyectoNormativo == null)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos del proyecto normativo";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.Convocado == null)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos del usuario";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
model = new ConvocatoriaDAL().EliminarConvocatoriaProyectoNormativo(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace AYA.SlnSinort.WCF
|
||||||
{
|
{
|
||||||
public class SinortCatalogos : ISinortCatalogos
|
public class SinortCatalogos : ISinortCatalogos
|
||||||
{
|
{
|
||||||
Log log = new Log("ForoDAL");
|
Log log = new Log("SinortCatalogosWCF");
|
||||||
|
|
||||||
#region Mantenimiento
|
#region Mantenimiento
|
||||||
public List<Mantenimiento> ObtenerMantenimientoCatalogos()
|
public List<Mantenimiento> ObtenerMantenimientoCatalogos()
|
||||||
|
|
@ -137,7 +137,7 @@ namespace AYA.SlnSinort.WCF
|
||||||
return respuesta;
|
return respuesta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Rol
|
#region Rol
|
||||||
|
|
@ -175,17 +175,17 @@ namespace AYA.SlnSinort.WCF
|
||||||
#region Pantallas
|
#region Pantallas
|
||||||
public List<Pantallas> ObtenerPantallas(CatalogosPostJSON model)
|
public List<Pantallas> ObtenerPantallas(CatalogosPostJSON model)
|
||||||
{
|
{
|
||||||
List<Pantallas> respuesta = new List<Pantallas>();
|
List<Pantallas> respuesta = new List<Pantallas>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
respuesta= new PantallasDAL().ObtenerPantallas(model);
|
respuesta = new PantallasDAL().ObtenerPantallas(model);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
||||||
log.Error(ex);
|
log.Error(ex);
|
||||||
}
|
}
|
||||||
return respuesta;
|
return respuesta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RolesPantallas> ObtenerPantallasRol(CatalogosPostJSON model)
|
public List<RolesPantallas> ObtenerPantallasRol(CatalogosPostJSON model)
|
||||||
|
|
@ -193,7 +193,7 @@ namespace AYA.SlnSinort.WCF
|
||||||
List<RolesPantallas> respuesta = null;
|
List<RolesPantallas> respuesta = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
respuesta = new PantallasDAL().ObtenerPantallasRol(model);
|
respuesta = new PantallasDAL().ObtenerPantallasRol(model);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +210,7 @@ namespace AYA.SlnSinort.WCF
|
||||||
var rolesDAL = new RolesDAL();
|
var rolesDAL = new RolesDAL();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach(var rolPantalla in model.ListaRolesPantallas)
|
foreach (var rolPantalla in model.ListaRolesPantallas)
|
||||||
rolesDAL.InsertarActualizarRolesPantallas(rolPantalla);
|
rolesDAL.InsertarActualizarRolesPantallas(rolPantalla);
|
||||||
|
|
||||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||||
|
|
@ -273,12 +273,12 @@ namespace AYA.SlnSinort.WCF
|
||||||
return respuesta;
|
return respuesta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RolesUsuarioJSON InsertarActualizarRolesUsuario(RolesUsuarioJSON model)
|
public RolesUsuarioJSON InsertarActualizarRolesUsuario(RolesUsuarioJSON model)
|
||||||
{
|
{
|
||||||
var usuarioDAL = new UsuarioDAL();
|
var usuarioDAL = new UsuarioDAL();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach(var rolUsuario in model.ListaRolesUsuarios )
|
foreach (var rolUsuario in model.ListaRolesUsuarios)
|
||||||
usuarioDAL.InsertarActualizarRolesUsuarios(rolUsuario);
|
usuarioDAL.InsertarActualizarRolesUsuarios(rolUsuario);
|
||||||
|
|
||||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||||
|
|
@ -291,51 +291,52 @@ namespace AYA.SlnSinort.WCF
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region WCFAYA
|
#region WCFAYA
|
||||||
public List<Usuario> ObtenerUsuariosAyA()
|
public List<Usuario> ObtenerUsuariosAyA()
|
||||||
{
|
{
|
||||||
List<Usuario> respuesta = null;
|
List<Usuario> respuesta = null;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
DataSet ds = new DataSet();
|
|
||||||
ServiciosUsuariosWCF.ServicioUsuariosClient respuestaAyA = new ServiciosUsuariosWCF.ServicioUsuariosClient();
|
|
||||||
ds = respuestaAyA.obtenerUsuariosActiveDirectory();
|
|
||||||
|
|
||||||
}
|
DataSet ds = new DataSet();
|
||||||
catch (Exception ex)
|
ServiciosUsuariosWCF.ServicioUsuariosClient respuestaAyA = new ServiciosUsuariosWCF.ServicioUsuariosClient();
|
||||||
{
|
ds = respuestaAyA.obtenerUsuariosActiveDirectory();
|
||||||
throw;
|
|
||||||
}
|
|
||||||
return respuesta;
|
|
||||||
}
|
|
||||||
public async Task<UsuariosAyAJSON> ActualizarUsuarios(UsuariosAyAJSON model)
|
|
||||||
{
|
|
||||||
|
|
||||||
var usuarioDAL = new UsuarioDAL();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string dominio = "@aya.go.cr";
|
|
||||||
DataSet ds = new DataSet();
|
|
||||||
ServiciosUsuariosWCF.ServicioUsuariosClient respuestaAyA = new ServiciosUsuariosWCF.ServicioUsuariosClient();
|
|
||||||
ds = respuestaAyA.obtenerUsuariosActiveDirectory();
|
|
||||||
model.ListaUsuariosAyA = ds.Tables[0].AsEnumerable().Select(dataRow => new Usuario { UsuarioSistema = dataRow.Field<string>("Login"), NombreUsuario = dataRow.Field<string>("Nombre"),EmailUsuario =dataRow.Field<string>("Login") + dominio, Estado = true, FechaCreacion = System.DateTime.Now }).ToList();
|
|
||||||
await usuarioDAL.ActualizarUsuarios(model);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
throw;
|
||||||
throw;
|
}
|
||||||
}
|
return respuesta;
|
||||||
|
}
|
||||||
|
public async Task<UsuariosAyAJSON> ActualizarUsuarios(UsuariosAyAJSON model)
|
||||||
|
{
|
||||||
|
|
||||||
|
var usuarioDAL = new UsuarioDAL();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string dominio = "@aya.go.cr";
|
||||||
|
DataSet ds = new DataSet();
|
||||||
|
ServiciosUsuariosWCF.ServicioUsuariosClient respuestaAyA = new ServiciosUsuariosWCF.ServicioUsuariosClient();
|
||||||
|
ds = respuestaAyA.obtenerUsuariosActiveDirectory();
|
||||||
|
model.ListaUsuariosAyA = ds.Tables[0].AsEnumerable().Select(dataRow => new Usuario { UsuarioSistema = dataRow.Field<string>("Login"), NombreUsuario = dataRow.Field<string>("Nombre"), EmailUsuario = dataRow.Field<string>("Login") + dominio, Estado = true, FechaCreacion = System.DateTime.Now }).ToList();
|
||||||
|
await usuarioDAL.ActualizarUsuarios(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,13 +100,6 @@ this.AgregarUsuario = function () {
|
||||||
$('#txtUsuario').val('');
|
$('#txtUsuario').val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#tableParticipantes').on('click', 'button', function () {
|
|
||||||
|
|
||||||
var data = $('#tableParticipantes').DataTable().row($(this).parents('tr')).data();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#tableUsuarios').on('click', 'button', function () {
|
$('#tableUsuarios').on('click', 'button', function () {
|
||||||
|
|
||||||
var data = $('#tableUsuarios').DataTable().row($(this).parents('tr')).data();
|
var data = $('#tableUsuarios').DataTable().row($(this).parents('tr')).data();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<form id="formCatalogo" class="form-horizontal" role="form">
|
<form id="formCatalogo" class="form-horizontal" role="form">
|
||||||
<div class="panel-body"> <h3> <i class="fa fa-briefcase"></i> Detalle Propuesta </h3> </div>
|
<div class="panel-body"> <h3> <i class="fa fa-briefcase"></i> Detalle Propuesta - [$Propuesta] </h3> </div>
|
||||||
<div class="panel panel-success">
|
<div class="panel panel-success">
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<li><a href="#tabs-1">Información General</a></li>
|
<li><a href="#tabs-1">Información General</a></li>
|
||||||
<li><a href="#tabs-2">Usuarios</a></li>
|
<li><a href="#tabs-2">Usuarios</a></li>
|
||||||
<li><a href="#tabs-3">Foro</a></li>
|
<li><a href="#tabs-3">Foro</a></li>
|
||||||
|
<li><a href="#tabs-4">Matriz Cambios</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
@* Informacion General *@
|
@* Informacion General *@
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@
|
||||||
<Compile Include="Sinort\PantallasDAL.cs" />
|
<Compile Include="Sinort\PantallasDAL.cs" />
|
||||||
<Compile Include="Sinort\PermisosUsuarioDAL.cs" />
|
<Compile Include="Sinort\PermisosUsuarioDAL.cs" />
|
||||||
<Compile Include="Sinort\PlantillaEmailDAL.cs" />
|
<Compile Include="Sinort\PlantillaEmailDAL.cs" />
|
||||||
|
<Compile Include="Sinort\ProyectoNormativoDAL.cs" />
|
||||||
<Compile Include="Sinort\RolesDAL.cs" />
|
<Compile Include="Sinort\RolesDAL.cs" />
|
||||||
<Compile Include="Sinort\TipoDocumentoDAL.cs" />
|
<Compile Include="Sinort\TipoDocumentoDAL.cs" />
|
||||||
<Compile Include="Sinort\TipoEmisorDAL.cs" />
|
<Compile Include="Sinort\TipoEmisorDAL.cs" />
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
using Atesa.Utilitarios;
|
using Atesa.Utilitarios;
|
||||||
|
using AYA.SlnSinortModel.Constantes;
|
||||||
|
using AYA.SlnSinortModel.Entidades;
|
||||||
|
using AYA.SlnSinortModel.Sinort;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Entity.Validation;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -10,5 +14,77 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
public class ConvocatoriaDAL
|
public class ConvocatoriaDAL
|
||||||
{
|
{
|
||||||
Log log = new Log("ConvocatoriaDAL");
|
Log log = new Log("ConvocatoriaDAL");
|
||||||
|
|
||||||
|
public ProyectoNormativoJSON GuardarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SinortContex Conn = new SinortContex())
|
||||||
|
{
|
||||||
|
foreach (var Convocado in model.ProyectoNormativo.ConvocatoriaProyectoNormativo)
|
||||||
|
{
|
||||||
|
if (!Conn.ConvocatoriaProyectoNormativo.Any(x => x.IdProyectoNormativo == model.ProyectoNormativo.IdProyectoNormativo && x.UsuarioSistema == Convocado.UsuarioSistema))
|
||||||
|
{
|
||||||
|
Convocado.FechaCreacion = DateTime.Now;
|
||||||
|
Convocado.Estado = false;
|
||||||
|
Conn.ConvocatoriaProyectoNormativo.Add(Convocado);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Convocado.FechaModificacion = DateTime.Now;
|
||||||
|
Conn.Entry(Convocado).State = System.Data.Entity.EntityState.Detached;
|
||||||
|
Conn.ConvocatoriaProyectoNormativo.Attach(Convocado);
|
||||||
|
Conn.Entry(Convocado).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Conn.SaveChanges();
|
||||||
|
Conn.Commit();
|
||||||
|
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 ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SinortContex Conn = new SinortContex())
|
||||||
|
{
|
||||||
|
var ConvocadoEliminar = Conn.ConvocatoriaProyectoNormativo.FirstOrDefault(x => x.IdProyectoNormativo == model.ProyectoNormativo.IdProyectoNormativo && x.UsuarioSistema == model.Convocado.UsuarioSistema);
|
||||||
|
|
||||||
|
if(ConvocadoEliminar != null)
|
||||||
|
Conn.Entry(ConvocadoEliminar).State = System.Data.Entity.EntityState.Deleted;
|
||||||
|
|
||||||
|
Conn.SaveChanges();
|
||||||
|
Conn.Commit();
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
using Atesa.Utilitarios;
|
||||||
|
using AYA.SlnSinortModel.Constantes;
|
||||||
|
using AYA.SlnSinortModel.Entidades;
|
||||||
|
using AYA.SlnSinortModel.Sinort;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Entity.Validation;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
|
{
|
||||||
|
public class ProyectoNormativoDAL
|
||||||
|
{
|
||||||
|
Log log = new Log("ProyectoNormativoDAL");
|
||||||
|
|
||||||
|
public ProyectoNormativoJSON GuardarProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SinortContex Conn = new SinortContex())
|
||||||
|
{
|
||||||
|
|
||||||
|
model.ProyectoNormativo.ClearProperties();
|
||||||
|
|
||||||
|
if (!Conn.ProyectoNormativo.Any(x => x.IdProyectoNormativo == model.ProyectoNormativo.IdProyectoNormativo))
|
||||||
|
{
|
||||||
|
int? Next_id = Conn.ProyectoNormativo.Max(t => (int?)t.IdProyectoNormativo);
|
||||||
|
model.ProyectoNormativo.IdProyectoNormativo = (Next_id == null) ? 1 : Next_id.Value + 1;
|
||||||
|
model.ProyectoNormativo.FechaCreacion = DateTime.Now;
|
||||||
|
Conn.ProyectoNormativo.Add(model.ProyectoNormativo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
model.ProyectoNormativo.FechaModificacion = DateTime.Now;
|
||||||
|
Conn.Entry(model.ProyectoNormativo).State = System.Data.Entity.EntityState.Detached;
|
||||||
|
Conn.ProyectoNormativo.Attach(model.ProyectoNormativo);
|
||||||
|
Conn.Entry(model.ProyectoNormativo).State = System.Data.Entity.EntityState.Modified;
|
||||||
|
}
|
||||||
|
Conn.SaveChanges();
|
||||||
|
Conn.Commit();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,7 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
{
|
{
|
||||||
public List<RolesUsuario> ListaRolesUsuarios { get; set; }
|
public List<RolesUsuario> ListaRolesUsuarios { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UsuariosAyAJSON : BaseJson
|
public class UsuariosAyAJSON : BaseJson
|
||||||
{
|
{
|
||||||
public List<Usuario> ListaUsuariosAyA { get; set; }
|
public List<Usuario> ListaUsuariosAyA { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using AYA.SlnSinortModel.Sinort;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
@ -11,4 +12,10 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
public string CodigoRespuesta { get; set; }
|
public string CodigoRespuesta { get; set; }
|
||||||
public string DescripcionRespuesta { get; set; }
|
public string DescripcionRespuesta { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ProyectoNormativoJSON : BaseJson
|
||||||
|
{
|
||||||
|
public ProyectoNormativo ProyectoNormativo { get; set; }
|
||||||
|
public ConvocatoriaProyectoNormativo Convocado { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[Column(Order = 0)]
|
[Column(Order = 0)]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
[StringLength(200)]
|
||||||
public int IdUsuario { get; set; }
|
public string UsuarioSistema { get; set; }
|
||||||
|
|
||||||
[Key]
|
[Key]
|
||||||
[Column(Order = 1)]
|
[Column(Order = 1)]
|
||||||
|
|
@ -21,6 +21,11 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
|
|
||||||
public DateTime? FechaCreacion { get; set; }
|
public DateTime? FechaCreacion { get; set; }
|
||||||
|
|
||||||
|
public bool? Estado { get; set; }
|
||||||
|
|
||||||
|
[StringLength(500)]
|
||||||
|
public string Justificación { get; set; }
|
||||||
|
|
||||||
[StringLength(200)]
|
[StringLength(200)]
|
||||||
public string UsuarioCreacion { get; set; }
|
public string UsuarioCreacion { get; set; }
|
||||||
|
|
||||||
|
|
@ -29,6 +34,8 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
[StringLength(200)]
|
[StringLength(200)]
|
||||||
public string UsuarioModificacion { get; set; }
|
public string UsuarioModificacion { get; set; }
|
||||||
|
|
||||||
|
public virtual Usuario Usuario { get; set; }
|
||||||
|
|
||||||
public virtual ProyectoNormativo ProyectoNormativo { get; set; }
|
public virtual ProyectoNormativo ProyectoNormativo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
|
|
||||||
public partial class SinortContex : Contex
|
public partial class SinortContex : Contex
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public virtual DbSet<Aplicacion> Aplicacion { get; set; }
|
public virtual DbSet<Aplicacion> Aplicacion { get; set; }
|
||||||
public virtual DbSet<Categoria> Categoria { get; set; }
|
public virtual DbSet<Categoria> Categoria { get; set; }
|
||||||
public virtual DbSet<Emisor> Emisor { get; set; }
|
public virtual DbSet<Emisor> Emisor { get; set; }
|
||||||
|
|
@ -264,6 +262,11 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
.Property(e => e.UsuarioModificacion)
|
.Property(e => e.UsuarioModificacion)
|
||||||
.IsUnicode(false);
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Usuario>()
|
||||||
|
.HasMany(e => e.ConvocatoriaProyectoNormativo)
|
||||||
|
.WithRequired(e => e.Usuario)
|
||||||
|
.WillCascadeOnDelete(false);
|
||||||
|
|
||||||
modelBuilder.Entity<BitacoraDocumentos>()
|
modelBuilder.Entity<BitacoraDocumentos>()
|
||||||
.Property(e => e.UsuarioCreacion)
|
.Property(e => e.UsuarioCreacion)
|
||||||
.IsUnicode(false);
|
.IsUnicode(false);
|
||||||
|
|
@ -386,6 +389,10 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
.Property(e => e.UsuarioModificacion)
|
.Property(e => e.UsuarioModificacion)
|
||||||
.IsUnicode(false);
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<ConvocatoriaProyectoNormativo>()
|
||||||
|
.Property(e => e.UsuarioSistema)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
modelBuilder.Entity<ConvocatoriaProyectoNormativo>()
|
modelBuilder.Entity<ConvocatoriaProyectoNormativo>()
|
||||||
.Property(e => e.UsuarioCreacion)
|
.Property(e => e.UsuarioCreacion)
|
||||||
.IsUnicode(false);
|
.IsUnicode(false);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
public Usuario()
|
public Usuario()
|
||||||
{
|
{
|
||||||
RolesUsuario = new HashSet<RolesUsuario>();
|
RolesUsuario = new HashSet<RolesUsuario>();
|
||||||
|
ConvocatoriaProyectoNormativo = new HashSet<ConvocatoriaProyectoNormativo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Key]
|
[Key]
|
||||||
|
|
@ -39,5 +40,8 @@ namespace AYA.SlnSinortModel.Sinort
|
||||||
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||||
public virtual ICollection<RolesUsuario> RolesUsuario { get; set; }
|
public virtual ICollection<RolesUsuario> RolesUsuario { get; set; }
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||||
|
public virtual ICollection<ConvocatoriaProyectoNormativo> ConvocatoriaProyectoNormativo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue