git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C386
This commit is contained in:
parent
8648d7a543
commit
c342897a39
6 changed files with 81 additions and 26 deletions
|
|
@ -1210,7 +1210,7 @@ namespace AYA.SlnSinort.WCF
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (model.RespuestaEncuesta == null)
|
if (model == null || model.ListaRespuestas == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ADVERTENCIA;
|
||||||
|
|
@ -1218,7 +1218,7 @@ namespace AYA.SlnSinort.WCF
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
model = new EncuestaDAL().GuardarEncuesta(model);
|
model = new EncuestaDAL().GuardarRespuestaEncuesta(model);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,24 @@ this.CargarTablaEncuestas = function (data) {
|
||||||
Encuesta = data.UsuariosEncuestas;
|
Encuesta = data.UsuariosEncuestas;
|
||||||
var Seleccionar = $("#ucbtnRespuesta").html();
|
var Seleccionar = $("#ucbtnRespuesta").html();
|
||||||
|
|
||||||
|
if (data.UsuariosEncuestas[0].Estado == true) {
|
||||||
|
var descripcion;
|
||||||
|
descripcion = $("#ucDesc").html();
|
||||||
|
|
||||||
|
|
||||||
|
descripcion = replaceAll('[$DESCRIPCION]','Ver Respuestas', descripcion);
|
||||||
|
$('#btnseleccionar').empty();
|
||||||
|
$('#btnseleccionar').append(descripcion);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var descripcion;
|
||||||
|
descripcion = $("#ucDesc").html();
|
||||||
|
|
||||||
|
|
||||||
|
descripcion = replaceAll('[$DESCRIPCION]', 'Responder', descripcion);
|
||||||
|
$('#btnseleccionar').empty();
|
||||||
|
$('#btnseleccionar').append(descripcion);
|
||||||
|
}
|
||||||
|
|
||||||
var columnDefinition = [
|
var columnDefinition = [
|
||||||
{ "data": 'IdEncabezadoEncuesta', "visible": false },
|
{ "data": 'IdEncabezadoEncuesta', "visible": false },
|
||||||
|
|
@ -64,6 +82,7 @@ $('#tableEncuestas').on('click', 'button', function () {
|
||||||
url = url.replace("View", "ResponderEncuesta");
|
url = url.replace("View", "ResponderEncuesta");
|
||||||
url = url.replace("Controller", "NormativaReglamentacionTecnica");
|
url = url.replace("Controller", "NormativaReglamentacionTecnica");
|
||||||
url = url.replace("[$ID]", ROT47(data.IdEncabezadoEncuesta.toString()));
|
url = url.replace("[$ID]", ROT47(data.IdEncabezadoEncuesta.toString()));
|
||||||
|
url = url.replace("[$ESTADO]", ROT47(data.Estado != true ? "0" : "1"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ this.CrearEncuesta = function (data) {
|
||||||
survey.locale = "es";
|
survey.locale = "es";
|
||||||
survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion;
|
survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion;
|
||||||
survey.showProgressBar = "top";
|
survey.showProgressBar = "top";
|
||||||
survey.surveyId='5af48e08-a0a5-44a5-83f4-1c90e8e98de1';
|
survey.surveyId = '5af48e08-a0a5-44a5-83f4-1c90e8e98de1';
|
||||||
survey.surveyPostId = '3ce10f8b-2d8a-4ca2-a110-2994b9e697a1';
|
survey.surveyPostId = '3ce10f8b-2d8a-4ca2-a110-2994b9e697a1';
|
||||||
|
|
||||||
var page = {};
|
var page = {};
|
||||||
|
|
@ -74,10 +74,24 @@ this.CrearEncuesta = function (data) {
|
||||||
.add(function (result) {
|
.add(function (result) {
|
||||||
|
|
||||||
var uri = SinortWCF + '/api/GuardarRespuestaEncuesta';
|
var uri = SinortWCF + '/api/GuardarRespuestaEncuesta';
|
||||||
|
|
||||||
|
var ListaRespuestas = [];
|
||||||
|
|
||||||
|
$.each(result.data, function (nombrePregunta, respuestaPregunta) {
|
||||||
|
|
||||||
|
var respuesta = {
|
||||||
|
NombrePregunta: nombrePregunta,
|
||||||
|
Respuesta: JSON.stringify(respuestaPregunta),
|
||||||
|
IdEncabezadoEncuesta: EncuestaId,
|
||||||
|
UsuarioSistema: UsuarioSistema
|
||||||
|
};
|
||||||
|
|
||||||
|
ListaRespuestas.push(respuesta);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var model = {
|
var model = {
|
||||||
ListaRespuestas: result.data,
|
ListaRespuestas: ListaRespuestas,
|
||||||
IdEncabezadoEncuesta: EncuestaId,
|
|
||||||
UsuarioSistema: UsuarioSistema
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AjaxPostData(uri, model, false, true, null, null, null);
|
AjaxPostData(uri, model, false, true, null, null, null);
|
||||||
|
|
@ -86,6 +100,15 @@ this.CrearEncuesta = function (data) {
|
||||||
// .innerHTML = "result: " + JSON.stringify(result.data);
|
// .innerHTML = "result: " + JSON.stringify(result.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(){
|
||||||
|
survey.data = {
|
||||||
|
comentariopizza: 'John Doe',
|
||||||
|
Idioma: { "Inglés": "Intermedio", "Italiano": "Intermedio" },
|
||||||
|
NIVEL: 4,
|
||||||
|
pregunta1: ["uno", "tres"]
|
||||||
|
};
|
||||||
|
survey.mode = 'display';
|
||||||
|
}
|
||||||
$("#surveyElement").Survey({
|
$("#surveyElement").Survey({
|
||||||
model: survey
|
model: survey
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
<input type="hidden" id="hiddenHref" value="@string.Concat(Url.Action("View", "Controller", null), ViewBag.QueryEncripted)?encuestaid=[$ID]">
|
<input type="hidden" id="hiddenHref" value="@string.Concat(Url.Action("View", "Controller", null), ViewBag.QueryEncripted)?encuestaid=[$ID]&&estado=[$ESTADO]">
|
||||||
|
|
||||||
<form id="formEncuestas" class="form-horizontal" role="form">
|
<form id="formEncuestas" class="form-horizontal" role="form">
|
||||||
<div class="panel-body"> <h3> <i class="glyphicon glyphicon-list-alt"></i> Mis Encuestas </h3> </div>
|
<div class="panel-body"> <h3> <i class="glyphicon glyphicon-list-alt"></i> Mis Encuestas </h3> </div>
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
<div id="ucbtnRespuesta" style=" display:none;">
|
<div id="ucbtnRespuesta" style=" display:none;">
|
||||||
<button type="button" id="btnseleccionar" class="btn btn-default btn-xs">
|
<button type="button" id="btnseleccionar" class="btn btn-default btn-xs">
|
||||||
<i class="fa fa-edit"></i> Responder
|
<i class="fa fa-edit"></i> [$DESCRIPCION]
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -36,6 +36,12 @@
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div id="ucDesc" style="display:none;">
|
||||||
|
<span>
|
||||||
|
[$DESCRIPCION]
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@section scripts{
|
@section scripts{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
registros.DetalleEncuestas = Conn.DetalleEncuesta
|
registros.DetalleEncuestas = Conn.DetalleEncuesta
|
||||||
.Include("EncabezadoEncuesta")
|
.Include("EncabezadoEncuesta")
|
||||||
//.FirstOrDefault(q => q.IdDetalleEncuesta == model.DetalleEncuesta.IdDetalleEncuesta);
|
//.FirstOrDefault(q => q.IdDetalleEncuesta == model.DetalleEncuesta.IdDetalleEncuesta);
|
||||||
.Where(x => x.Estado == true ).AsNoTracking()
|
.Where(x => x.Estado == true).AsNoTracking()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
registros.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
registros.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||||
|
|
@ -155,7 +155,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
|
|
||||||
registros.UsuariosEncuestas = db.UsuariosEncuesta
|
registros.UsuariosEncuestas = db.UsuariosEncuesta
|
||||||
.Include(q => q.EncabezadoEncuesta)
|
.Include(q => q.EncabezadoEncuesta)
|
||||||
.Where(x => x.Estado == true && x.UsuarioSistema == model.UsuarioSistema).AsNoTracking()
|
.Where(x => x.UsuarioSistema == model.UsuarioSistema).AsNoTracking()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -271,11 +271,18 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
{
|
{
|
||||||
using (SinortContex Conn = new SinortContex())
|
using (SinortContex Conn = new SinortContex())
|
||||||
{
|
{
|
||||||
|
if (model != null && model.ListaRespuestas != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (var respuesta in model.ListaRespuestas)
|
||||||
|
{
|
||||||
|
respuesta.UsuarioCreacion = model.UserName;
|
||||||
|
respuesta.FechaCreacion = DateTime.Now;
|
||||||
|
respuesta.Estado = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
model.RespuestaEncuesta.UsuarioCreacion = model.UserName;
|
Conn.RespuestaEncuesta.AddRange(model.ListaRespuestas);
|
||||||
model.RespuestaEncuesta.FechaCreacion = DateTime.Now;
|
|
||||||
Conn.RespuestaEncuesta.Add(model.RespuestaEncuesta);
|
|
||||||
|
|
||||||
Conn.SaveChanges();
|
Conn.SaveChanges();
|
||||||
Conn.Commit();
|
Conn.Commit();
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
public List<TareasPendientes> ListaTareasPendientes { get; set; }
|
public List<TareasPendientes> ListaTareasPendientes { get; set; }
|
||||||
public List<Usuario> ListaUsuariosCorreo { get; set; }
|
public List<Usuario> ListaUsuariosCorreo { get; set; }
|
||||||
|
|
||||||
public List<RespuestaJSON> ListaRespuestas { get; set; }
|
public List<RespuestaEncuesta> ListaRespuestas { get; set; }
|
||||||
public int IdEncabezadoEncuesta { get; set; }
|
public int IdEncabezadoEncuesta { get; set; }
|
||||||
public string UsuarioSistema { get; set; }
|
public string UsuarioSistema { get; set; }
|
||||||
public string Mensaje { get; set; }
|
public string Mensaje { get; set; }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue