git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C362
This commit is contained in:
parent
ea5eab4670
commit
88dae675be
14 changed files with 473 additions and 150 deletions
|
|
@ -124,14 +124,20 @@ namespace AYA.SlnSinort.WCF
|
|||
#endregion
|
||||
|
||||
#region Encuestas
|
||||
[OperationContract]
|
||||
List<DetalleEncuesta> ObtenerDetalleEncuesta();
|
||||
//[OperationContract]
|
||||
//List<DetalleEncuesta> ObtenerDetalleEncuesta();
|
||||
|
||||
[OperationContract]
|
||||
EncuestaJSON GuardarPregunta(EncuestaJSON model);
|
||||
|
||||
[OperationContract]
|
||||
EncuestaJSON ObtenerEncuestas(EncuestaJSON model);
|
||||
|
||||
[OperationContract]
|
||||
EncuestaJSON ObtenerEncabezadoEncuesta(EncuestaJSON model);
|
||||
[OperationContract]
|
||||
EncuestaJSON ObtenerDetalleEncuesta(EncuestaJSON model);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1057,20 +1057,49 @@ namespace AYA.SlnSinort.WCF
|
|||
#endregion
|
||||
|
||||
#region Encuesta
|
||||
public List<DetalleEncuesta> ObtenerDetalleEncuesta()
|
||||
{
|
||||
List<DetalleEncuesta> respuesta = null;
|
||||
|
||||
public EncuestaJSON ObtenerEncabezadoEncuesta(EncuestaJSON model) {
|
||||
EncuestaJSON registros = new EncuestaJSON();
|
||||
try
|
||||
{
|
||||
respuesta = new EncuestaDAL().ObtenerDetalleEncuesta();
|
||||
|
||||
registros = new EncuestaDAL().ObtenerEncabezadoEncuesta(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
registros.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||
log.Error(ex);
|
||||
}
|
||||
return respuesta;
|
||||
return registros;
|
||||
}
|
||||
public EncuestaJSON ObtenerDetalleEncuesta(EncuestaJSON model)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
model = new EncuestaDAL().ObtenerDetalleEncuesta(model);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||
log.Error(ex);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
//public List<DetalleEncuesta> ObtenerDetalleEncuesta()
|
||||
//{
|
||||
// List<DetalleEncuesta> respuesta = null;
|
||||
// try
|
||||
// {
|
||||
// respuesta = new EncuestaDAL().ObtenerDetalleEncuesta();
|
||||
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// log.Error(ex);
|
||||
// }
|
||||
// return respuesta;
|
||||
//}
|
||||
|
||||
public EncuestaJSON GuardarPregunta(EncuestaJSON model)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7405,6 +7405,7 @@
|
|||
<Content Include="Sinort-Scripts\Global.js" />
|
||||
<Content Include="Sinort-Scripts\Login.js" />
|
||||
<Content Include="Sinort-Scripts\Mantenimientos.js" />
|
||||
<Content Include="Sinort-Scripts\NormativaReglamentacionTecnica\MisEncuestas.js" />
|
||||
<Content Include="Sinort-Scripts\NormativaReglamentacionTecnica\MisSolicitudes.js" />
|
||||
<Content Include="Sinort-Scripts\NormativaReglamentacionTecnica\ResponderEncuesta.js" />
|
||||
<Content Include="Sinort-Scripts\NormativaReglamentacionTecnica\Solicitud.js" />
|
||||
|
|
@ -7525,6 +7526,7 @@
|
|||
<Content Include="Views\NormativaReglamentacionTecnica\CrearEncuesta.cshtml" />
|
||||
<Content Include="Views\Reportes\Aplicacion.cshtml" />
|
||||
<Content Include="Views\NormativaReglamentacionTecnica\ResponderEncuesta.cshtml" />
|
||||
<Content Include="Views\NormativaReglamentacionTecnica\MisEncuestas.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
|
|||
|
|
@ -55,5 +55,10 @@ namespace AYA.SlnSinort.Controllers.NormativaReglamentacionTecnica
|
|||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
public ActionResult MisEncuestas()
|
||||
{
|
||||
InitControllers();
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -20725,18 +20725,18 @@ var SurveyTemplateText = /** @class */ (function () {
|
|||
//Uncomment this line on creating a translation file
|
||||
//import { surveyLocalization } from "../surveyStrings";
|
||||
var englishStrings = {
|
||||
pagePrevText: "Previous",
|
||||
pageNextText: "Next",
|
||||
pagePrevText: "Anterior",
|
||||
pageNextText: "Siguiente",
|
||||
completeText: "Complete",
|
||||
startSurveyText: "Start",
|
||||
otherItemText: "Other (describe)",
|
||||
noneItemText: "None",
|
||||
progressText: "Page {0} of {1}",
|
||||
progressText: "Pagina {0} de {1}",
|
||||
emptySurvey: "There is no visible page or question in the survey.",
|
||||
completingSurvey: "Thank you for completing the survey!",
|
||||
completingSurveyBefore: "Our records show that you have already completed this survey.",
|
||||
loadingSurvey: "Survey is loading...",
|
||||
optionsCaption: "Choose...",
|
||||
optionsCaption: "Seleccione una opción...",
|
||||
value: "value",
|
||||
requiredError: "Please answer the question.",
|
||||
requiredErrorInPanel: "Please answer at least one question.",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
var Item = {};
|
||||
var data;
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
CargarEncuestas();
|
||||
});
|
||||
|
||||
this.CargarEncuestas = function () {
|
||||
|
||||
var uri = SinortWCF + '/api/ObtenerEncabezadoEncuesta';
|
||||
var model = {
|
||||
UsuarioSistema: UsuarioSistema
|
||||
}
|
||||
AjaxPostData(uri, model, false, false, CargarTablaEncuestas, null, null);
|
||||
}
|
||||
|
||||
this.CargarTablaEncuestas = function (data) {
|
||||
|
||||
if (data != null && data.UsuariosEncuestas != null) {
|
||||
Encuesta = data.UsuariosEncuestas;
|
||||
var Seleccionar = $("#ucbtnRespuesta").html();
|
||||
|
||||
|
||||
var columnDefinition = [
|
||||
{ "data": 'IdEncabezadoEncuesta', "visible": false },
|
||||
{ "data": "EncabezadoEncuesta.Descripcion" },
|
||||
{ "data": null, className: "center", defaultContent: Seleccionar }
|
||||
];
|
||||
|
||||
$('#tableEncuestas').DataTable({
|
||||
|
||||
initComplete: function () {
|
||||
|
||||
$('#tableEncuestas').TableInit(1, false, true, true, true, columnDefinition, Encuesta);
|
||||
}
|
||||
});
|
||||
|
||||
if ($.fn.DataTable.isDataTable('#tableEncuestas')) {
|
||||
|
||||
$('#tableEncuestas').DataTable().search('').draw();
|
||||
ENDREQUEST();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$('#tableEncuestas').on('click', 'button', function () {
|
||||
|
||||
|
||||
var data = $('#tableEncuestas').DataTable().row($(this).parents('tr')).data();
|
||||
|
||||
//if (data.PromotorProyecto != UsuarioSistema) {
|
||||
|
||||
// if (ValidarPermisos('Accesar expediente de propuesta normativa').length <= 0 || data.IdEstado == Estados.Contruccion.Codigo) {
|
||||
// toastr.warning(Message_NoGrants, Message_Warning);
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
|
||||
url = $("#hiddenHref").val();
|
||||
url = url.replace("View", "ResponderEncuesta");
|
||||
url = url.replace("Controller", "NormativaReglamentacionTecnica");
|
||||
url = url.replace("[$ID]", ROT47(data.IdEncabezadoEncuesta.toString()));
|
||||
|
||||
|
||||
|
||||
document.location.href = url;
|
||||
|
||||
});
|
||||
|
|
@ -1,152 +1,214 @@
|
|||
var model = {};
|
||||
|
||||
var EncuestaId;
|
||||
var Titulo;
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
init();
|
||||
|
||||
|
||||
getDataModel();
|
||||
|
||||
|
||||
});
|
||||
|
||||
function init() {
|
||||
var json = {
|
||||
title: "Primera Encuesta",
|
||||
showProgressBar: "top",
|
||||
pages: [
|
||||
{
|
||||
questions: [
|
||||
{
|
||||
type: "boolean",
|
||||
name: "bool",
|
||||
title: "Please answer the question digite ",
|
||||
label: "Trabaja en el AYA?",
|
||||
isRequired: true
|
||||
},
|
||||
{
|
||||
type: "checkbox",
|
||||
name: "car",
|
||||
title: "Cual es su Vehículo?",
|
||||
isRequired: true,
|
||||
hasNone: true,
|
||||
colCount: 4,
|
||||
choices: [
|
||||
"Ford",
|
||||
"Vauxhall",
|
||||
"Volkswagen",
|
||||
"Nissan",
|
||||
"Audi",
|
||||
"Mercedes-Benz",
|
||||
"BMW",
|
||||
"Peugeot",
|
||||
"Toyota",
|
||||
"Citroen"
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "comment",
|
||||
name: "suggestions",
|
||||
title: "Digite un comentario"
|
||||
}
|
||||
this.getDataModel = function () {
|
||||
EncuestaId = (IsNullOrEmpty(ObtenerParametros().encuestaid)) ? '' : ROT47(ObtenerParametros().encuestaid);
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
questions: [
|
||||
{
|
||||
type: "dropdown",
|
||||
name: "car",
|
||||
title: "Cual es su Vehículo?",
|
||||
isRequired: true,
|
||||
colCount: 0,
|
||||
choices: [
|
||||
"None",
|
||||
"Ford",
|
||||
"Vauxhall",
|
||||
"Volkswagen",
|
||||
"Nissan",
|
||||
"Audi",
|
||||
"Mercedes-Benz",
|
||||
"BMW",
|
||||
"Peugeot",
|
||||
"Toyota",
|
||||
"Citroen"
|
||||
]
|
||||
},
|
||||
var uri = SinortWCF + '/api/ObtenerDetalleEncuesta';
|
||||
var model = {
|
||||
IdEncabezadoEncuesta: EncuestaId
|
||||
}
|
||||
AjaxPostData(uri, model, false, false, CrearEncuesta, null, null);
|
||||
}
|
||||
|
||||
{
|
||||
type: "matrix",
|
||||
name: "Quality",
|
||||
title:
|
||||
"Por favor indique su nivel de satisfacción con las siguintes preguntas",
|
||||
columns: [
|
||||
{ value: 1, text: "Totalmente desacuerdo" },
|
||||
{ value: 2, text: "Desacuerdo" },
|
||||
{ value: 3, text: "Neutral" },
|
||||
{ value: 4, text: "Deacuerdo" },
|
||||
{ value: 5, text: "Totalmente Deacuerdo" }
|
||||
],
|
||||
rows: [
|
||||
{ value: "affordable", text: "Fácil de usar" },
|
||||
{
|
||||
value: "does what it claims",
|
||||
text: "Mejor que los demás"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "radiogroup",
|
||||
name: "price to competitors",
|
||||
title: "Comparando el producto es",
|
||||
choices: [
|
||||
"Más caro",
|
||||
"El mismo precio",
|
||||
"Más barato",
|
||||
"No estoy seguro"
|
||||
]
|
||||
}
|
||||
this.CrearEncuesta = function (data) {
|
||||
var body = data.questions;
|
||||
|
||||
var survey = new Survey.Survey();
|
||||
survey.title = data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion;
|
||||
survey.showProgressBar = "top";
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
questions: [
|
||||
{
|
||||
type: "rating",
|
||||
name: "satisfaction",
|
||||
title: "Cual es su nivel de satisfacción?",
|
||||
mininumRateDescription: "No satisfecho",
|
||||
maximumRateDescription: "Completamente satisfecho"
|
||||
},
|
||||
//{
|
||||
// type: "rating",
|
||||
// name: "recommend friends",
|
||||
// visibleIf: "{satisfaction} > 3",
|
||||
// title:
|
||||
// "How likely are you to recommend the Product to a friend or co-worker?",
|
||||
// mininumRateDescription: "Will not recommend",
|
||||
// maximumRateDescription: "I will recommend"
|
||||
//},
|
||||
{
|
||||
name: "name",
|
||||
type: "text",
|
||||
title: "Cual es su nombre:",
|
||||
isRequired: true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
var page = {};
|
||||
|
||||
window.survey = new Survey.Model(json);
|
||||
survey.onComplete.add(function (result) {
|
||||
document.querySelector("#surveyResult").innerHTML =
|
||||
"result: " + JSON.stringify(result.data);
|
||||
$.each(body, function (key, item) {
|
||||
|
||||
if (key % 3 == 0)
|
||||
page = survey.addNewPage("page_"+ ( key + 1 ));
|
||||
|
||||
|
||||
var q = page.addNewQuestion(item.type, item.title)
|
||||
|
||||
if (item.type == "dropdown" || item.type == "radiogroup" || item.type == "checkbox") {
|
||||
q.choices = item.choices
|
||||
if (q.choices.length % 3 == 0 && q.choices.length > 4)
|
||||
q.colCount = 3
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("#surveyElement").Survey({
|
||||
model: survey
|
||||
});
|
||||
|
||||
//var json = {
|
||||
// title: data.DetalleEncuestas[0].EncabezadoEncuesta.Descripcion,
|
||||
// showProgressBar: "top",
|
||||
// pages: [
|
||||
// {
|
||||
// questions: [
|
||||
// {
|
||||
// type: "boolean",
|
||||
// name: "bool",
|
||||
// title: "Please answer the question digite ",
|
||||
// label: "Trabaja en el AYA?",
|
||||
// isRequired: true
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
//};
|
||||
//window.survey = new Survey.Model(json);
|
||||
//survey.onComplete.add(function (result) {
|
||||
// document.querySelector("#surveyResult").innerHTML =
|
||||
// "result: " + JSON.stringify(result.data);
|
||||
//});
|
||||
|
||||
//$("#surveyElement").Survey({
|
||||
// model: survey
|
||||
//});
|
||||
}
|
||||
|
||||
if (!window["%hammerhead%"]) {
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//function init() {
|
||||
// var json = {
|
||||
// title: "Primera Encuesta",
|
||||
// showProgressBar: "top",
|
||||
// pages: [
|
||||
// {
|
||||
// questions: [
|
||||
// {
|
||||
// type: "boolean",
|
||||
// name: "bool",
|
||||
// title: "Please answer the question digite ",
|
||||
// label: "Trabaja en el AYA?",
|
||||
// isRequired: true
|
||||
// },
|
||||
// {
|
||||
// type: "checkbox",
|
||||
// name: "car",
|
||||
// title: "Cual es su Vehículo?",
|
||||
// isRequired: true,
|
||||
// hasNone: true,
|
||||
// colCount: 4,
|
||||
// choices: [
|
||||
// "Ford",
|
||||
// "Vauxhall",
|
||||
// "Volkswagen",
|
||||
// "Nissan",
|
||||
// "Audi",
|
||||
// "Mercedes-Benz",
|
||||
// "BMW",
|
||||
// "Peugeot",
|
||||
// "Toyota",
|
||||
// "Citroen"
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// type: "comment",
|
||||
// name: "suggestions",
|
||||
// title: "Digite un comentario"
|
||||
// }
|
||||
|
||||
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// questions: [
|
||||
// {
|
||||
// type: "dropdown",
|
||||
// name: "car",
|
||||
// title: "Cual es su Vehículo?",
|
||||
// isRequired: true,
|
||||
// colCount: 0,
|
||||
// choices: [
|
||||
// "None",
|
||||
// "Ford",
|
||||
// "Vauxhall",
|
||||
// "Volkswagen",
|
||||
// "Nissan",
|
||||
// "Audi",
|
||||
// "Mercedes-Benz",
|
||||
// "BMW",
|
||||
// "Peugeot",
|
||||
// "Toyota",
|
||||
// "Citroen"
|
||||
// ]
|
||||
// },
|
||||
|
||||
// {
|
||||
// type: "matrix",
|
||||
// name: "Quality",
|
||||
// title:
|
||||
// "Por favor indique su nivel de satisfacción con las siguintes preguntas",
|
||||
// columns: [
|
||||
// { value: 1, text: "Totalmente desacuerdo" },
|
||||
// { value: 2, text: "Desacuerdo" },
|
||||
// { value: 3, text: "Neutral" },
|
||||
// { value: 4, text: "Deacuerdo" },
|
||||
// { value: 5, text: "Totalmente Deacuerdo" }
|
||||
// ],
|
||||
// rows: [
|
||||
// { value: "affordable", text: "Fácil de usar" },
|
||||
// { value: "does what it claims",text: "Mejor que los demás"}
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// type: "radiogroup",
|
||||
// name: "price to competitors",
|
||||
// title: "Comparando el producto es",
|
||||
// choices: [
|
||||
// "Más caro",
|
||||
// "El mismo precio",
|
||||
// "Más barato",
|
||||
// "No estoy seguro"
|
||||
// ]
|
||||
// }
|
||||
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// questions: [
|
||||
// {
|
||||
// type: "rating",
|
||||
// name: "satisfaction",
|
||||
// title: "Cual es su nivel de satisfacción?",
|
||||
// mininumRateDescription: "No satisfecho",
|
||||
// maximumRateDescription: "Completamente satisfecho"
|
||||
// },
|
||||
// //{
|
||||
// // type: "rating",
|
||||
// // name: "recommend friends",
|
||||
// // visibleIf: "{satisfaction} > 3",
|
||||
// // title:
|
||||
// // "How likely are you to recommend the Product to a friend or co-worker?",
|
||||
// // mininumRateDescription: "Will not recommend",
|
||||
// // maximumRateDescription: "I will recommend"
|
||||
// //},
|
||||
// {
|
||||
// name: "name",
|
||||
// type: "text",
|
||||
// title: "Cual es su nombre:",
|
||||
// isRequired: true
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// };
|
||||
|
||||
|
||||
//if (!window["%hammerhead%"]) {
|
||||
// init();
|
||||
//}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
@{
|
||||
ViewBag.Title = "MisEncuestas";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<input type="hidden" id="hiddenHref" value="@string.Concat(Url.Action("View", "Controller", null), ViewBag.QueryEncripted)?encuestaid=[$ID]">
|
||||
|
||||
<form id="formEncuestas" class="form-horizontal" role="form">
|
||||
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
|
||||
<div class="panel-body"> <h3> <i class="glyphicon glyphicon-list-alt"></i> Mis Encuestas </h3> </div>
|
||||
<div style="background-color: #fff">
|
||||
<div class="panel-body">
|
||||
<br />
|
||||
<div>
|
||||
<table id="tableEncuestas" class="table table-condensed dataTable no-footer">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-1">ID</th>
|
||||
<th class="col-sm-5">Título</th>
|
||||
<th class="col-sm-5">Acción</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="ucbtnRespuesta" style=" display:none;">
|
||||
<button type="button" id="btnseleccionar" class="btn btn-default btn-xs">
|
||||
<i class="fa fa-edit"></i> Responder
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
@section scripts{
|
||||
|
||||
@Scripts.Render("~/Sinort-Scripts/NormativaReglamentacionTecnica/MisEncuestas.js")
|
||||
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div class="panel-body">
|
||||
<div id="surveyElement">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@
|
|||
|
||||
<span><i class="fa fa-circle text-success"> Sitios</i> </span>
|
||||
<li><a href="@Url.Action("CrearEncuesta", "NormativaReglamentacionTecnica")"> Crear encuesta </a></li>
|
||||
<li><a href="@Url.Action("ResponderEncuesta", "NormativaReglamentacionTecnica")"> Responder encuesta </a></li>
|
||||
<li><a href="#"> Ver mis encuestas </a></li>
|
||||
@*<li><a href="@Url.Action("ResponderEncuesta", "NormativaReglamentacionTecnica")"> Responder encuesta </a></li>*@
|
||||
<li><a href="@Url.Action("MisEncuestas", "NormativaReglamentacionTecnica")"> Ver mis encuestas </a></li>
|
||||
<span><i class="fa fa-circle text-success"> Administar</i> </span>
|
||||
<li><a href="@Url.Action("FichaTecnica", "NormativaReglamentacionTecnica")"> Ficha Técnica</a></li>
|
||||
<li><a href="#"> Ver fichas técnicas inactivas</a></li>
|
||||
|
|
|
|||
|
|
@ -155,6 +155,79 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
|
||||
return registros;
|
||||
}
|
||||
public EncuestaJSON ObtenerEncabezadoEncuesta(EncuestaJSON model)
|
||||
{
|
||||
|
||||
EncuestaJSON registros = new EncuestaJSON();
|
||||
|
||||
try
|
||||
{
|
||||
using (SinortContex db = new SinortContex())
|
||||
{
|
||||
|
||||
registros.UsuariosEncuestas = db.UsuariosEncuesta
|
||||
.Include(q => q.EncabezadoEncuesta)
|
||||
.Where(x => x.Estado == true && x.UsuarioSistema == model.UsuarioSistema).AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
|
||||
registros.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
registros.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||
log.Error(ex);
|
||||
}
|
||||
|
||||
return registros;
|
||||
}
|
||||
|
||||
public EncuestaJSON ObtenerDetalleEncuesta(EncuestaJSON model)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (SinortContex db = new SinortContex())
|
||||
{
|
||||
|
||||
model.DetalleEncuestas = db.DetalleEncuesta
|
||||
.Include(q => q.EncabezadoEncuesta)
|
||||
.Where(x => x.Estado == true && x.IdEncabezadoEncuesta == model.IdEncabezadoEncuesta).AsNoTracking()
|
||||
.ToList();
|
||||
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||
|
||||
|
||||
if (model.DetalleEncuestas != null)
|
||||
{
|
||||
model.questions = new List<PreguntasJSON>();
|
||||
|
||||
foreach (var listaencuesta in model.DetalleEncuestas)
|
||||
{
|
||||
var json = new PreguntasJSON()
|
||||
{
|
||||
|
||||
type = listaencuesta.IdTipoPregunta,
|
||||
name = listaencuesta.NombrePregunta,
|
||||
title = listaencuesta.TituloPregunta,
|
||||
isRequired = listaencuesta.Requerido.Value,
|
||||
choices = listaencuesta.RespuestaPregunta != null ? listaencuesta.RespuestaPregunta.Split('|').ToList() : null
|
||||
};
|
||||
|
||||
model.questions.Add(json);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||
log.Error(ex);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,4 +68,29 @@ namespace AYA.SlnSinortModel.Entidades
|
|||
public Roles Rol { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class PreguntasJSON
|
||||
{
|
||||
public string type { get; set; }
|
||||
public string name { get; set; }
|
||||
public string title { get; set; }
|
||||
public bool isRequired { get; set; }
|
||||
public List<string> choices { get; set; }
|
||||
public string mininumRateDescription { get; set; }
|
||||
public string maximumRateDescription { get; set; }
|
||||
public List<Columnas> columns { get; set; }
|
||||
public List<Filas> rows { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class Columnas
|
||||
{
|
||||
public string value { get; set; }
|
||||
public string text { get; set; }
|
||||
}
|
||||
public class Filas
|
||||
{
|
||||
public string value { get; set; }
|
||||
public string text { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,11 +96,13 @@ namespace AYA.SlnSinortModel.Entidades
|
|||
{
|
||||
public DetalleEncuesta DetalleEncuesta { get; set; }
|
||||
public EncabezadoEncuesta EncabezadoEncuesta { get; set; }
|
||||
public UsuariosEncuesta UsuariosEncuesta { get; set; }
|
||||
public TipoPregunta TipoPregunta { get; set; }
|
||||
public List<TipoPregunta> TipoPreguntas { get; set; }
|
||||
public List<DetalleEncuesta> DetalleEncuestas { get; set; }
|
||||
public List<EncabezadoEncuesta> EncabezadoEncuestas { get; set; }
|
||||
public List<EventosJSON> EventosJSON { get; set; }
|
||||
public List<UsuariosEncuesta> UsuariosEncuestas { get; set; }
|
||||
public List<PreguntasJSON> questions { get; set; }
|
||||
public PlantillaEmail PlantillaEmail { get; set; }
|
||||
public TareasPendientes TareasPendientes { get; set; }
|
||||
public List<TareasPendientes> ListaTareasPendientes { get; set; }
|
||||
|
|
@ -108,6 +110,8 @@ namespace AYA.SlnSinortModel.Entidades
|
|||
public int IdEncabezadoEncuesta { get; set; }
|
||||
public string UsuarioSistema { get; set; }
|
||||
public string Mensaje { get; set; }
|
||||
public string BodyEncuestaJson { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue