git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C159
This commit is contained in:
parent
c663818391
commit
3a223e5ce7
9 changed files with 195 additions and 27 deletions
|
|
@ -30,6 +30,8 @@ namespace AYA.SlnSinort.WCF
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
ProyectoNormativoJSON GuardarComentarioProyectoNormativo(ProyectoNormativoJSON model);
|
ProyectoNormativoJSON GuardarComentarioProyectoNormativo(ProyectoNormativoJSON model);
|
||||||
|
|
||||||
|
[OperationContract]
|
||||||
|
ProyectoNormativoJSON GuardarEventoProyectoNormativo(ProyectoNormativoJSON model);
|
||||||
//[OperationContract]
|
//[OperationContract]
|
||||||
//ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model);
|
//ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model);
|
||||||
#region Adjuntos
|
#region Adjuntos
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,35 @@ namespace AYA.SlnSinort.WCF
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProyectoNormativoJSON GuardarEventoProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (model.ProyectoNormativo == null)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos del proyecto normativo";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.Evento == null)
|
||||||
|
{
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
model.DescripcionRespuesta = "No se encontraron datos del nuevo evento";
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
model = new CalendarioDAL().GuardarEvento(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
//public ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model)
|
//public ProyectoNormativoJSON EliminarConvocatoriaProyectoNormativo(ProyectoNormativoJSON model)
|
||||||
//{
|
//{
|
||||||
// try
|
// try
|
||||||
|
|
|
||||||
|
|
@ -114,9 +114,13 @@ this.getDataModel = function () {
|
||||||
|
|
||||||
$("#btnMostrarCalendario").unbind("click");
|
$("#btnMostrarCalendario").unbind("click");
|
||||||
$("#btnMostrarCalendario").click(function () {
|
$("#btnMostrarCalendario").click(function () {
|
||||||
Calendario();
|
Calendario(model.EventosJSON);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#btnGuardarEvento").unbind("click");
|
||||||
|
$("#btnGuardarEvento").click(function () {
|
||||||
|
GuardarEvento();
|
||||||
|
});
|
||||||
|
|
||||||
$("#txtNombreProyecto").readOnly();
|
$("#txtNombreProyecto").readOnly();
|
||||||
$("#txtPromotorProyecto").readOnly();
|
$("#txtPromotorProyecto").readOnly();
|
||||||
|
|
@ -1166,6 +1170,53 @@ function ActualizarUpload() {
|
||||||
|
|
||||||
//Calendario
|
//Calendario
|
||||||
|
|
||||||
|
this.GuardarEvento = function () {
|
||||||
|
|
||||||
|
if (!$("#formEvento").valid()) {
|
||||||
|
toastr.warning("Ingresar todos los campos que son requeridos.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
tableDocEvento = $('#tableDocEvento').DataTable();
|
||||||
|
var Iddoc;
|
||||||
|
var data = tableDocEvento
|
||||||
|
.rows()
|
||||||
|
.data();
|
||||||
|
|
||||||
|
$.each(data, function (key, item) {
|
||||||
|
Iddoc = item[0]
|
||||||
|
});
|
||||||
|
|
||||||
|
var uri = SinortWCF + '/api/GuardarEventoProyectoNormativo';
|
||||||
|
|
||||||
|
model.Evento = {
|
||||||
|
IdProyectoNormativo: model.ProyectoNormativo.IdProyectoNormativo,
|
||||||
|
IdDocumento: Iddoc,
|
||||||
|
Titulo: $("#txtTituloEvento").val(),
|
||||||
|
Descripcion: $("#txtDescripcionEvento").val(),
|
||||||
|
FechaInicio: $("#txtInicioEvento").DateFormatWCF(),
|
||||||
|
FechaFin: $("#txtFinEvento").DateFormatWCF()
|
||||||
|
}
|
||||||
|
|
||||||
|
AjaxPostData(uri, model, false, true, EventoGuardado, null, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.EventoGuardado = function (data) {
|
||||||
|
|
||||||
|
if (data.CodigoRespuesta == "EXITOSO") {
|
||||||
|
model = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#txtTituloEvento").val('');
|
||||||
|
$("#txtDescripcionEvento").val('');
|
||||||
|
$('#modalEvento').modal('hide');
|
||||||
|
$('#tableDocEvento').DataTable.clear().draw();
|
||||||
|
|
||||||
|
CargarForo();
|
||||||
|
ENDREQUEST();
|
||||||
|
}
|
||||||
|
|
||||||
this.ModalEvento = function (inicio,fin) {
|
this.ModalEvento = function (inicio,fin) {
|
||||||
$('#modalEvento').modal('show');
|
$('#modalEvento').modal('show');
|
||||||
|
|
||||||
|
|
@ -1177,18 +1228,20 @@ this.ModalEvento = function (inicio,fin) {
|
||||||
if (fecha != "Invalid date")
|
if (fecha != "Invalid date")
|
||||||
$("#txtFinEvento").val(fecha);
|
$("#txtFinEvento").val(fecha);
|
||||||
|
|
||||||
|
$("#txtInicioEvento").readOnly();
|
||||||
|
$("#txtFinEvento").readOnly();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Calendario = function () {
|
this.Calendario = function (data) {
|
||||||
|
|
||||||
$('#modalCalendario').modal('show');
|
$('#modalCalendario').modal('show');
|
||||||
$('#calendar').fullCalendar('destroy')
|
$('#calendar').fullCalendar('destroy');
|
||||||
|
$('#calendar').fullCalendar('render');
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
selectable: true,
|
selectable: true,
|
||||||
eventLimit: true,
|
eventLimit: true,
|
||||||
//dayClick: function (date) {
|
events:data,
|
||||||
// alert('clicked ' + date.format());
|
|
||||||
//},
|
|
||||||
select: function (startDate, endDate) {
|
select: function (startDate, endDate) {
|
||||||
ModalEvento(startDate.format(), endDate.format());
|
ModalEvento(startDate.format(), endDate.format());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,9 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Sinort\AplicacionDAL.cs" />
|
<Compile Include="Sinort\AplicacionDAL.cs" />
|
||||||
<Compile Include="Sinort\BitacoraDocumentosDAL.cs" />
|
<Compile Include="Sinort\BitacoraDocumentosDAL.cs" />
|
||||||
|
<Compile Include="Sinort\CalendarioDAL.cs" />
|
||||||
<Compile Include="Sinort\CategoriaDAL.cs" />
|
<Compile Include="Sinort\CategoriaDAL.cs" />
|
||||||
<Compile Include="Sinort\ComentariosDAL.cs" />
|
<Compile Include="Sinort\ComentariosDAL.cs" />
|
||||||
<Compile Include="Sinort\ComentariosMatrizDAL.cs" />
|
|
||||||
<Compile Include="Sinort\ContenidoDAL.cs" />
|
<Compile Include="Sinort\ContenidoDAL.cs" />
|
||||||
<Compile Include="Sinort\ConvocatoriaDAL.cs" />
|
<Compile Include="Sinort\ConvocatoriaDAL.cs" />
|
||||||
<Compile Include="Sinort\DocumentosAdjuntosDAL.cs" />
|
<Compile Include="Sinort\DocumentosAdjuntosDAL.cs" />
|
||||||
|
|
|
||||||
67
AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/CalendarioDAL.cs
Normal file
67
AYA.SlnSynor/AYA.SlnSynorModel.DAL/Sinort/CalendarioDAL.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
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 CalendarioDAL
|
||||||
|
{
|
||||||
|
Log log = new Log("CalendarioDAL");
|
||||||
|
|
||||||
|
public ProyectoNormativoJSON GuardarEvento(ProyectoNormativoJSON model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SinortContex Conn = new SinortContex())
|
||||||
|
{
|
||||||
|
int? Next_id = Conn.Calendario.Max(t => (int?)t.IdCalendario);
|
||||||
|
model.Evento.IdCalendario = (Next_id == null) ? 1 : Next_id.Value + 1;
|
||||||
|
model.Evento.UsuarioCreacion = model.AtesaUser;
|
||||||
|
model.Evento.FechaCreacion = DateTime.Now;
|
||||||
|
Conn.Calendario.Add(model.Evento);
|
||||||
|
Conn.SaveChanges();
|
||||||
|
Conn.Commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||||
|
|
||||||
|
if (model.ProyectoNormativo.Calendario != null)
|
||||||
|
model.ProyectoNormativo.Calendario.Add(model.Evento);
|
||||||
|
|
||||||
|
if (model.EventosJSON != null)
|
||||||
|
{
|
||||||
|
var json = new EventosJSON()
|
||||||
|
{
|
||||||
|
allDay = false,
|
||||||
|
start = model.Evento.FechaInicio.HasValue ? model.Evento.FechaInicio.Value.ToString() : string.Empty,
|
||||||
|
end = model.Evento.FechaFin.HasValue ? model.Evento.FechaFin.Value.ToString() : string.Empty,
|
||||||
|
title = model.Evento.Titulo
|
||||||
|
};
|
||||||
|
|
||||||
|
model.EventosJSON.Add(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (DbEntityValidationException ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.Error(ex);
|
||||||
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
using Atesa.Utilitarios;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AYA.SlnSinortModel.DAL.Sinort
|
|
||||||
{
|
|
||||||
public class ComentariosMatrizDAL
|
|
||||||
{
|
|
||||||
Log log = new Log("ComentariosMatrizDAL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -89,12 +89,33 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
using (SinortContex Conn = new SinortContex())
|
using (SinortContex Conn = new SinortContex())
|
||||||
{
|
{
|
||||||
model.ProyectoNormativo = Conn.ProyectoNormativo
|
model.ProyectoNormativo = Conn.ProyectoNormativo
|
||||||
.Include(q=> q.Convocatoria)
|
.Include(q => q.Convocatoria)
|
||||||
.Include(q=> q.ComentariosProyecto)
|
.Include(q => q.ComentariosProyecto)
|
||||||
|
.Include(q => q.Calendario)
|
||||||
.Include("Convocatoria.Usuario")
|
.Include("Convocatoria.Usuario")
|
||||||
.FirstOrDefault(q => q.IdProyectoNormativo == model.ProyectoNormativo.IdProyectoNormativo);
|
.FirstOrDefault(q => q.IdProyectoNormativo == model.ProyectoNormativo.IdProyectoNormativo);
|
||||||
|
|
||||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (model.ProyectoNormativo != null && model.ProyectoNormativo.Calendario != null)
|
||||||
|
{
|
||||||
|
model.EventosJSON = new List<EventosJSON>();
|
||||||
|
|
||||||
|
foreach (var evento in model.ProyectoNormativo.Calendario)
|
||||||
|
{
|
||||||
|
var json = new EventosJSON()
|
||||||
|
{
|
||||||
|
allDay = false,
|
||||||
|
start = evento.FechaInicio.HasValue ? evento.FechaInicio.Value.ToString() : string.Empty,
|
||||||
|
end = evento.FechaFin.HasValue ? evento.FechaFin.Value.ToString() : string.Empty,
|
||||||
|
title = evento.Titulo
|
||||||
|
};
|
||||||
|
|
||||||
|
model.EventosJSON.Add(json);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (DbEntityValidationException ex)
|
catch (DbEntityValidationException ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,17 @@ 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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class EventosJSON
|
||||||
|
{
|
||||||
|
public string title { get; set; }
|
||||||
|
public string start { get; set; }
|
||||||
|
public string end { get; set; }
|
||||||
|
public bool allDay { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
public ComentariosProyecto Comentario { get; set; }
|
public ComentariosProyecto Comentario { get; set; }
|
||||||
public List<ProyectoNormativo> ProyectosNormativos { get; set; }
|
public List<ProyectoNormativo> ProyectosNormativos { get; set; }
|
||||||
public List<Convocatoria> ListaConvocatoria { get; set; }
|
public List<Convocatoria> ListaConvocatoria { get; set; }
|
||||||
|
public Calendario Evento { get; set; }
|
||||||
|
public List<EventosJSON> EventosJSON { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AdjuntosJSON : BaseJson
|
public class AdjuntosJSON : BaseJson
|
||||||
|
|
@ -32,8 +34,8 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Carpeta { get; set; }
|
public string Carpeta { get; set; }
|
||||||
public int? IdDocumentoAdjunto { get; set; }
|
public int? IdDocumentoAdjunto { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue