public DenunciaDto Obter(int id) { string connectionString = ConfigurationManager.ConnectionStrings["ContextoCgm"].ConnectionString; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand("prcObterDenuncia", connection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("@IdNoticia", id); try { DenunciaDto dto = new DenunciaDto(); connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { dto.Id = (int)reader[0]; dto.Conteudo = reader.IsDBNull(1) ? "empty" : reader[1].ToString(); dto.Data = reader.IsDBNull(2) ? "01/01/2016" : reader[2].ToString(); dto.Autor = reader.IsDBNull(3) ? "Anônimo" : reader[3].ToString(); dto.CaminhoAnexo = reader.IsDBNull(4) ? "" : reader[4].ToString(); dto.EmailAutor = reader.IsDBNull(5) ? "Anônimo" : reader[5].ToString(); } reader.Close(); return(dto); } catch (Exception ex) { throw ex; } } }
public CourierHelperClass elEventoEsValido(EventoDto evento) { List <string> errorMessages = new List <string>(); DenunciaDto denuncia = new DenunciaDto(); using (NuevoDbContext context = new NuevoDbContext()) { denuncia = context.Denuncias.Where(x => x.DenunciaId == evento.DenunciaId).FirstOrDefault(); } bool control = true; if (evento.Fecha == null) { errorMessages.Add("La Fecha De Vencimiento es Inválida</br>"); control = false; } if (denuncia.FSELLOCIA > evento.Fecha) { errorMessages.Add("La Fecha de vencimiento no puede ser anterior a la Fecha de Notificación del Reclamo </br>"); control = false; } if (evento.ResIntId == null) { errorMessages.Add("Seleccione un Responsable</br>"); control = false; } if (!(evento.TipoEventoId > 0)) { errorMessages.Add("Seleccione un Tipo de Evento</br>"); control = false; } var courier = new CourierHelperClass(); courier.elObjetoEsVálido = control; courier.mensajes = errorMessages; return(courier); }
public ActionResult CrearEvento([Bind(Include = "DenunciaId,Fecha,tipoEventoId,CONTESTADO,SOLUCIONADO,REQUERIMIENTOINFORME,observacion,ResIntId")] EventoDto evento) { DenunciaDto denuncia = new DenunciaDto(); using (NuevoDbContext context = new NuevoDbContext()) { denuncia = context.Denuncias.Where(x => x.DenunciaId == evento.DenunciaId).FirstOrDefault(); } var esUnEventoVálido = true; var mensajeFechaInvalida1 = ""; var mensajeFechaInvalida2 = ""; var mensajeResponsableInvalido = ""; var mensajeTipoDeEventoInvalido = ""; if (evento.Fecha == null) { mensajeFechaInvalida1 = "La Fecha De Vencimiento es Inválida</br>"; esUnEventoVálido = false; } if (denuncia.FSELLOCIA > evento.Fecha) { mensajeFechaInvalida2 = "La Fecha de vencimiento no puede ser anterior a la Fecha de Notificación del Reclamo </br>"; esUnEventoVálido = false; } if (evento.ResIntId == null) { mensajeResponsableInvalido = "Seleccione un Responsable</br>"; esUnEventoVálido = false; } if (!(evento.TipoEventoId > 0)) { mensajeTipoDeEventoInvalido = "Seleccione un Tipo de Evento</br>"; esUnEventoVálido = false; } if (esUnEventoVálido) { var usuario = System.Web.HttpContext.Current.User.Identity.Name; evento.FECHACREACION = DateTime.Now; evento.Deleted = false; evento.CREATIONPERSON = usuario; EventoCommandService evc = new EventoCommandService(); evc.createEvento(evento, usuario); return(Json("Evento guardado correctamente")); } else { return(Json("<div class='alert alert-danger text-center'>" + mensajeFechaInvalida1 + mensajeFechaInvalida2 + mensajeResponsableInvalido + mensajeTipoDeEventoInvalido + "</div>")); } //var courier = evc.elEventoEsValido(evento); //if (courier.elObjetoEsVálido) //{ //} //else { // if (courier.mensajes != null && courier.mensajes.Count > 0) // { // courier.mensajes; // } // else { // } //} //if (ModelState.IsValid) //{ // return JavaScript("<script>toastr.success('guardado correctamente')</script>"); //} //else { // return JavaScript("<script>toastr.error('Existe uno o más parámetros inválidos')</script>"); //} }
public DenunciasChangeValidator(DenunciaDto oldDenuncia, DenunciaDto newDenuncia, string user) { usuario = user; objetoId = oldDenuncia.DenunciaId; etapaIdAnterior = oldDenuncia.ETAPA_ID; tipoProcesoIdAnterior = oldDenuncia.TIPO_PRO_ID; denuncianteIdAnterior = oldDenuncia.DENUNCIANTE_ID; tramiteCRMAnterior = oldDenuncia.TRAMITECRM; objetoReclamoAnterior = oldDenuncia.OBJETORECLAMO; fechaNotificacionAnterior = oldDenuncia.FSELLOCIA; fechaNotificacionGciAnterior = oldDenuncia.FSELLOGCIADC; expedienteIdAnterior = oldDenuncia.EXPEDIENTE_ID; responsableIdAnterior = oldDenuncia.RESP_INT_ID; organismoIdAnterior = oldDenuncia.ORGANISMO_ID; estudioIdAnterior = oldDenuncia.ESTUDIO_ID; modalidadGestionIdAnterior = oldDenuncia.MODALIDADGESTION; subTipoProcesoAnteriorId = oldDenuncia.SUBTIPO_PRO_ID; servicioIdAnterior = oldDenuncia.SERV_DEN_ID; reclamoIdAnterior = oldDenuncia.RECLAMO_ID; // retocar al modificar el modelo conciliacionIdAnterior = oldDenuncia.CONCILIACION_ID; fechaResultadoAnterior = oldDenuncia.FECHARESULTADO.ToString(); grupoIdAnterior = oldDenuncia.grupoId; nroClienteContratoAnterior = oldDenuncia.nroClienteContrato; mediadorIdAnterior = oldDenuncia.mediadorId; domicilioMediadorIdAnterior = oldDenuncia.domicilioMediadorId; reclamoRelacionadoAnterior = oldDenuncia.reclamoRelacionado; //idDatosCoprecAnterior = oldDenuncia.idDatosCoprec; fechaHomologacionAnterior = oldDenuncia.fechaHomologacion.ToString(); nroGestionAnterior = oldDenuncia.nroGestionCoprec; honorarioAnterior = oldDenuncia.honorariosCoprec; montoAcordadoAnterior = oldDenuncia.montoAcordado; fechaGestionHonorariosAnterior = oldDenuncia.fechaGestionHonorarios.ToString(); arancelAnterior = oldDenuncia.arancel; fechaGestionArancelAnterior = oldDenuncia.fechaGestionArancel.ToString(); etapaIdActual = newDenuncia.ETAPA_ID; tipoProcesoIdActual = newDenuncia.TIPO_PRO_ID; denuncianteIdActual = newDenuncia.DENUNCIANTE_ID; tramiteCRMActual = newDenuncia.TRAMITECRM; objetoReclamoActual = newDenuncia.OBJETORECLAMO; fechaNotificacionActual = newDenuncia.FSELLOCIA; fechaNotificacionGciActual = newDenuncia.FSELLOGCIADC; expedienteIdActual = newDenuncia.EXPEDIENTE_ID; responsableIdActual = newDenuncia.RESP_INT_ID; organismoIdActual = newDenuncia.ORGANISMO_ID; estudioIdActual = newDenuncia.ESTUDIO_ID; modalidadGestionIdActual = newDenuncia.MODALIDADGESTION; subTipoProcesoActualId = newDenuncia.SUBTIPO_PRO_ID; servicioIdActual = newDenuncia.SERV_DEN_ID; reclamoIdActual = newDenuncia.RECLAMO_ID; // retocar al modificar el modelo conciliacionIdActual = newDenuncia.CONCILIACION_ID; fechaResultadoActual = newDenuncia.FECHARESULTADO.ToString(); grupoIdActual = newDenuncia.grupoId; nroClienteContratoActual = newDenuncia.nroClienteContrato; mediadorIdActual = newDenuncia.mediadorId; domicilioMediadorIdActual = newDenuncia.domicilioMediadorId; reclamoRelacionadoActual = newDenuncia.reclamoRelacionado; //idDatosCoprecActual = newDenuncia.idDatosCoprec; fechaHomologacionActual = newDenuncia.fechaHomologacion.ToString(); nroGestionActual = newDenuncia.nroGestionCoprec; honorarioActual = newDenuncia.honorariosCoprec; montoAcordadoActual = newDenuncia.montoAcordado; fechaGestionHonorariosActual = newDenuncia.fechaGestionHonorarios.ToString(); arancelActual = newDenuncia.arancel; fechaGestionArancelActual = newDenuncia.fechaGestionArancel.ToString(); }