public List <ResponsableDto> updateResponsable(ResponsableDto ResponsableDto) { ResponsableModificado = ResponsableDto; List <ResponsableDto> lista = new List <ResponsableDto>(); using (NuevoDbContext context = new NuevoDbContext()) { ResponsableDto Responsable = context.getResponsables(true).Where(t => t.Id == ResponsableDto.Id).FirstOrDefault(); ResponsableOriginal = Responsable; prepararCambios(ResponsableModificado, ResponsableOriginal, context); var idResponsableAModificarr = Responsable.Id; Responsable.Nombre = ResponsableDto.Nombre.Trim(); Responsable.Apellido = ResponsableDto.Apellido.Trim(); Responsable.UmeId = ResponsableDto.UmeId.ToLower(); Responsable.TipoResponsable = ResponsableDto.TipoResponsable; Responsable.Rol = ResponsableDto.Rol; Responsable.Estudio_Id = ResponsableDto.Estudio_Id; Responsable.Deleted = ResponsableDto.Deleted; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); lista.Add(Responsable); //lista = context.Database // .SqlQuery<ResponsableDto>("GetResponsableDtoorId @id", new SqlParameter("@id", Responsable.Id)) // .ToList(); } return(lista); }
public List <OrganismoSP> updateOrganismo(OrganismoDto OrganismoDto) { List <OrganismoSP> lista = new List <OrganismoSP>(); OrganismoModificado = OrganismoDto; using (NuevoDbContext context = new NuevoDbContext()) { OrganismoDto Organismo = context.getOrganismos(true).Where(t => t.Id == OrganismoDto.Id).FirstOrDefault(); OrganismoOriginal = Organismo; prepararCambios(OrganismoModificado, OrganismoOriginal, context); var idOrganismoAModificarr = Organismo.Id; Organismo.Nombre = OrganismoDto.Nombre.Trim().ToUpper(); Organismo.Activo = OrganismoDto.Activo; Organismo.Provincia_Id = OrganismoDto.Provincia_Id; Organismo.Localidad_Id = OrganismoDto.Localidad_Id; Organismo.Region_Id = OrganismoDto.Region_Id; context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); lista = context.Database .SqlQuery <OrganismoSP>("GetOrganismosPorId @id", new SqlParameter("@id", Organismo.Id)) .ToList(); } return(lista); }
public List <MotivoDeReclamoSP> updateMotivoDeReclamo(MotivoDeReclamoDto MotivoDeReclamoDto) { MotivoDeReclamoModificado = MotivoDeReclamoDto; List <MotivoDeReclamoSP> lista = new List <MotivoDeReclamoSP>(); using (NuevoDbContext context = new NuevoDbContext()) { MotivoDeReclamoDto MotivoDeReclamo = context.getMotivosDeReclamo(true).Where(t => t.Id == MotivoDeReclamoDto.Id).FirstOrDefault(); MotivoDeReclamoOriginal = MotivoDeReclamo; prepararCambios(MotivoDeReclamoModificado, MotivoDeReclamoOriginal, context); var idMotivoDeReclamoAModificarr = MotivoDeReclamo.Id; MotivoDeReclamo.Nombre = MotivoDeReclamoDto.Nombre.Trim().ToUpper(); MotivoDeReclamo.Deleted = MotivoDeReclamoDto.Deleted; MotivoDeReclamo.servicioId = MotivoDeReclamoDto.servicioId; MotivoDeReclamo.tipoProcesoId = MotivoDeReclamoDto.tipoProcesoId; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); lista = context.Database .SqlQuery <MotivoDeReclamoSP>("GetMotivosDeReclamoPorId @id", new SqlParameter("@id", MotivoDeReclamo.Id)) .ToList(); } return(lista); }
public List <OrganismoSP> createOrganismo(string Nombre, int provinciaId, int localidadId, int regionId) { var organismo = new OrganismoDto(); organismo.Nombre = Nombre.Trim().ToUpper(); organismo.Provincia_Id = provinciaId; organismo.Localidad_Id = localidadId; organismo.Region_Id = regionId; organismo.Activo = false; List <OrganismoSP> lista = new List <OrganismoSP>(); var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(organismo); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "ORGANISMO", "Se ha creado el Organismo", null, organismo.Nombre, usuario, organismo.Id); context.Add(accion); context.SaveChanges(); lista = context.Database .SqlQuery <OrganismoSP>("GetOrganismosPorId @id", new SqlParameter("@id", organismo.Id)) .ToList(); } return(lista); }
public List <SubEstadoSP> updateSubEstado(SubEstadoDto SubEstadoDto) { SubEstadoModificado = SubEstadoDto; List <SubEstadoSP> lista = new List <SubEstadoSP>(); using (NuevoDbContext context = new NuevoDbContext()) { SubEstadoDto SubEstado = context.GetSubEstados(true).Where(t => t.Id == SubEstadoDto.Id).FirstOrDefault(); SubEstadoOriginal = SubEstado; prepararCambios(SubEstadoModificado, SubEstadoOriginal, context); var idSubEstadoAModificarr = SubEstado.Id; SubEstado.Nombre = SubEstadoDto.Nombre.Trim().ToUpper(); SubEstado.Deleted = SubEstadoDto.Deleted; SubEstado.CierraDenuncia = SubEstadoDto.CierraDenuncia; SubEstado.EstadoId = SubEstadoDto.EstadoId; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); lista = context.Database .SqlQuery <SubEstadoSP>("GetSubEstadosPorId @id", new SqlParameter("@id", SubEstado.Id)) .ToList(); } return(lista); }
public void createEvento(EventoDto evento, string usuario) { using (NuevoDbContext context = new NuevoDbContext()) { context.Add(evento); context.SaveChanges(); var logger = new CommonChangeLoggerDto(DateTime.Now, "EVENTO", "Se ha creado el Evento id : " + evento.EventoId + " relacionado a la Denuncia id : " + evento.DenunciaId, null, "Datos iniciales: " + "-Fecha Vencimiento : " + evento.Fecha + "Tipo de Evento: " + evento.TipoEventoId + "-Contestado " + ((evento.CONTESTADO == 1)?"SI":"NO"), usuario, evento.EventoId); context.Add(logger); context.SaveChanges(); } }
public DenunciaDto CreateDenuncia(DenunciaDto denuncia) { var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(denuncia); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "DENUNCIA", "Se ha creado La Denuncia con id: " + denuncia.DenunciaId.ToString(), null, "ACTIVA", usuario, denuncia.DenunciaId); context.Add(accion); context.SaveChanges(); return(denuncia); } }
public DenuncianteDto crearDenunciante(DenuncianteDto test) { var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(test); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "DENUNCIANTE", "Se ha creado al Denunciante", null, "Denunciante " + test.apellido + "," + test.nombre + "," + " dni: " + test.NroDocumento, usuario, test.DenuncianteId); context.Add(accion); context.SaveChanges(); return(test); } }
private void loguearModificaciones(NuevoDbContext context, DateTime fechaCambio, string objetoModificado, string valorAnterior, string valorActual, string descripcion, string usuario, int objetoId) { var logger = new DenChLoggerDto(); logger.FechaCambio = fechaCambio; logger.ObjetoModificado = objetoModificado; logger.Descripcion = descripcion; logger.ValorAnterior = valorAnterior; logger.ValorActual = valorActual; logger.Usuario = usuario; logger.ObjetoId = objetoId; context.Add(logger); context.SaveChanges(); //context.Database //.ExecuteSqlCommand("Insert into tDenChLogger values(@fechaCambio,@objetoModificado,@descripcion,@valorAnterior,@valorActual,@usuario,@objetoId)" //, new SqlParameter("@fechaCambio", fechaCambio) //, new SqlParameter("@objetoModificado", objetoModificado) //, new SqlParameter("@descripcion", descripcion) //, new SqlParameter("@valorAnterior", valorAnterior) //, new SqlParameter("@valorActual", valorActual) //, new SqlParameter("@usuario", usuario) //, new SqlParameter("@objetoId", objetoId)); }
public void updateDenunciante(DenuncianteDto denuncianteDto) { using (NuevoDbContext context = new NuevoDbContext()) { DenuncianteDto existingTest = context.getDenunciantes(true).Where(t => t.DenuncianteId == denuncianteDto.DenuncianteId).FirstOrDefault(); prepararCambios(denuncianteDto, existingTest, context); existingTest.nombre = denuncianteDto.nombre; existingTest.apellido = denuncianteDto.apellido; existingTest.NroDocumento = denuncianteDto.NroDocumento; context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); } }
public List <ResponsableDto> createResponsable(ResponsableDto Responsable) { List <ResponsableDto> lista = new List <ResponsableDto>(); var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(Responsable); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "RESPONSABLE", "Se ha creado el Responsable", null, Responsable.Nombre + ' ' + Responsable.Apellido, usuario, Responsable.Id); context.Add(accion); context.SaveChanges(); var sub = context.Responsables.Where(x => x.Id == Responsable.Id).FirstOrDefault(); lista.Add(sub); } return(lista); }
public List <LocalidadSP> createlocalidad(LocalidadDto localidad) { var usuario = HttpContext.Current.User.Identity.Name; List <LocalidadSP> lista = new List <LocalidadSP>(); using (NuevoDbContext context = new NuevoDbContext()) { context.Add(localidad); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "LOCALIDAD", "Se ha creado una Localidad", null, localidad.Nombre, usuario, localidad.Id); context.Add(accion); context.SaveChanges(); return(lista = context.Database .SqlQuery <LocalidadSP>("GetLocalidadesPorId @id", new SqlParameter("@id", localidad.Id)) .ToList()); } }
//[HttpGet] //[HttpPost] //[ValidateAntiForgeryToken] public ActionResult DescargarArchivo(Guid id) { ArchivoDto _ArchivoDto; FileContentResult _fileContent; using (_dbContext = new NuevoDbContext()) { _ArchivoDto = _dbContext.Archivos.FirstOrDefault(x => x.Id == id); } if (_ArchivoDto == null) { return(HttpNotFound()); } else { try { // Descargamos el ArchivoDto del Servidor. _fileContent = new FileContentResult(_ArchivoDto.DescargarArchivo(), "application/octet-stream"); _fileContent.FileDownloadName = _ArchivoDto.Nombre + "." + _ArchivoDto.Extension; // Actualizamos el nº de descargas en la base de datos. using (_dbContext = new NuevoDbContext()) { _ArchivoDto.Descargas++; _dbContext.Archivos.Attach(_ArchivoDto); _dbContext.Entry(_ArchivoDto).State = EntityState.Modified; _dbContext.SaveChanges(); var usuario = System.Web.HttpContext.Current.User.Identity.Name; var logger = new CommonChangeLoggerDto(DateTime.Now, "DENUNCIA", "Descarga de Archivo", _ArchivoDto.Nombre + '.' + _ArchivoDto.Extension, _ArchivoDto.path, usuario, (int)Session["DenunciaActual"]); _dbContext.Add(logger); _dbContext.SaveChanges(); } return(_fileContent); } catch (Exception ex) { return(HttpNotFound()); } } }
public List <MotivoDeReclamoSP> createMotivoDeReclamo(MotivoDeReclamoDto MotivoDeReclamo) { List <MotivoDeReclamoSP> lista = new List <MotivoDeReclamoSP>(); var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(MotivoDeReclamo); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "MOTIVO DE RECLAMO", "Se ha creado el MotivoDeReclamo", null, MotivoDeReclamo.Nombre, usuario, MotivoDeReclamo.Id); context.Add(accion); context.SaveChanges(); lista = context.Database .SqlQuery <MotivoDeReclamoSP>("GetMotivosDeReclamoPorId @motivoId", new SqlParameter("@motivoId", MotivoDeReclamo.Id)) .ToList(); } return(lista); }
public RegionDto createRegion(string Nombre) { var Region = new RegionDto(); Region.Nombre = Nombre.ToUpper(); Region.Deleted = false; var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(Region); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "REGION", "Se ha creado la Región", null, Region.Nombre, usuario, Region.Id); context.Add(accion); context.SaveChanges(); return(Region); } }
public MediadorDto createMediador(string Nombre) { var Mediador = new MediadorDto(); Mediador.Nombre = Nombre.Trim().ToUpper(); Mediador.Activo = true; var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(Mediador); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "MEDIADOR", "Se ha creado el Mediador", null, Mediador.Nombre, usuario, Mediador.Id); context.Add(accion); context.SaveChanges(); return(Mediador); } }
public void deleteDenunciante(DenuncianteDto denuncianteDto) { var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { //load task from database DenuncianteDto existingTest = context.getDenunciantes(true) .Where(t => t.DenuncianteId == denuncianteDto.DenuncianteId) .FirstOrDefault(); context.Remove(existingTest); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "DENUNCIANTE", "Se ha eliminado al Denunciante", "Denunciante : " + denuncianteDto.apellido + "," + denuncianteDto.nombre + "," + " dni: " + denuncianteDto.NroDocumento, "ELIMINADO", usuario, denuncianteDto.DenuncianteId); context.Add(accion); context.SaveChanges(); } }
public ServicioDto createServicio(string Nombre) { var Servicio = new ServicioDto(); Servicio.Nombre = Nombre.Trim().ToUpper(); Servicio.Deleted = false; var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(Servicio); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "SERVICIO", "Se ha creado el Servicio", null, Servicio.Nombre, usuario, Servicio.Id); context.Add(accion); context.SaveChanges(); return(Servicio); } }
public MotivoDeBajaDto createMotivo(string Nombre) { var motivo = new MotivoDeBajaDto(); motivo.Nombre = Nombre.ToUpper(); motivo.Deleted = false; var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(motivo); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "MOTIVO DE BAJA", "Se ha creado el Motivo de Baja", null, motivo.Nombre, usuario, motivo.Id); context.Add(accion); context.SaveChanges(); return(motivo); } }
public ProvinciaDto createProvincia(string Nombre) { var provincia = new ProvinciaDto(); provincia.Nombre = Nombre.Trim().ToUpper(); provincia.Deleted = false; var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(provincia); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "PROVINCIA", "Se ha creado la PROVINCIA", null, provincia.Nombre, usuario, provincia.Id); context.Add(accion); context.SaveChanges(); return(provincia); } }
public TipoEventoDto createTipoEvento(string Nombre, bool esAgendable) { var TipoEvento = new TipoEventoDto(); TipoEvento.Nombre = Nombre.Trim().ToUpper(); TipoEvento.Agendable = esAgendable; TipoEvento.Deleted = false; var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(TipoEvento); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "TIPO EVENTO", "Se ha creado el de Tipo de Evento", null, TipoEvento.Nombre, usuario, TipoEvento.Id); context.Add(accion); context.SaveChanges(); return(TipoEvento); } }
public MediadorDto updateMediador(MediadorDto MediadorDto) { MediadorModificado = MediadorDto; using (NuevoDbContext context = new NuevoDbContext()) { MediadorDto Mediador = context.getMediadores(true).Where(t => t.Id == MediadorDto.Id).FirstOrDefault(); MediadorOriginal = Mediador; prepararCambios(MediadorModificado, MediadorOriginal, context); var idMediadorAModificarr = Mediador.Id; Mediador.Nombre = MediadorDto.Nombre.Trim().ToUpper(); Mediador.Activo = MediadorDto.Activo; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); return(Mediador); } }
public void createEvento(EventoDto evento, int?idRes) { using (NuevoDbContext context = new NuevoDbContext()) { var usuario = context.Responsables.Where(x => x.Id == idRes).FirstOrDefault(); evento.CREATIONPERSON = usuario.UmeId; evento.Deleted = false; context.Add(evento); context.SaveChanges(); } }
public void deletelocalidad(int id) { using (NuevoDbContext context = new NuevoDbContext()) { LocalidadDto localidad = context.getLocalidades(true) .Where(t => t.Id == id) .FirstOrDefault(); context.Remove(localidad); context.SaveChanges(); } }
public List <DomicilioMediadorSP> createDomicilioMediador(DomicilioMediadorDto DomicilioMediador) { List <DomicilioMediadorSP> lista = new List <DomicilioMediadorSP>(); var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(DomicilioMediador); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "DOMICILIO MEDIADOR", "Se ha creado el Domicilio del Mediador", null, DomicilioMediador.Domicilio, usuario, DomicilioMediador.Id); context.Add(accion); context.SaveChanges(); lista = context.Database .SqlQuery <DomicilioMediadorSP>("GetDomicilioMediadorPorId @id", new SqlParameter("@id", DomicilioMediador.Id)) .ToList(); } return(lista); }
public MotivoDeBajaDto updateMotivo(MotivoDeBajaDto MotivoDeBajaDto) { motivoModificado = MotivoDeBajaDto; using (NuevoDbContext context = new NuevoDbContext()) { //load task from database MotivoDeBajaDto motivo = context.getMotivos(true).Where(t => t.Id == MotivoDeBajaDto.Id).FirstOrDefault(); motivoOriginal = motivo; prepararCambios(motivoModificado, motivoOriginal, context); var idmotivoAModificarr = motivo.Id; motivo.Nombre = MotivoDeBajaDto.Nombre; motivo.Deleted = MotivoDeBajaDto.Deleted; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); return(motivo); } }
public List <SubEstadoSP> createSubEstado(SubEstadoDto SubEstado) //public List<SubEstadoDto> createSubEstado(SubEstadoDto SubEstado) { List <SubEstadoSP> lista = new List <SubEstadoSP>(); var usuario = HttpContext.Current.User.Identity.Name; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(SubEstado); context.SaveChanges(); var accion = new CommonChangeLoggerDto(DateTime.Now, "SUB ESTADO", "Se ha creado el SubEstado", null, SubEstado.Nombre, usuario, SubEstado.Id); context.Add(accion); context.SaveChanges(); //var sub = context.SubEstados.Where(x => x.Id == SubEstado.Id).FirstOrDefault(); //lista.Add(sub); lista = context.Database .SqlQuery <SubEstadoSP>("GetSubEstadosPorId @motivoId", new SqlParameter("@motivoId", SubEstado.Id)) .ToList(); } return(lista); }
public RegionDto updateRegion(RegionDto RegionDto) { RegionModificado = RegionDto; using (NuevoDbContext context = new NuevoDbContext()) { //load task from database RegionDto Region = context.getRegiones(true).Where(t => t.Id == RegionDto.Id).FirstOrDefault(); RegionOriginal = Region; prepararCambios(RegionModificado, RegionOriginal, context); var idRegionAModificarr = Region.Id; Region.Nombre = RegionDto.Nombre.Trim().ToUpper(); Region.Deleted = RegionDto.Deleted; //save changes to database context.SaveChanges(); context.CommonChangeLogger.AddRange(listLoggers); context.SaveChanges(); return(Region); } }
public ExpedienteDto crearExpediente(string unExpediente) { ExpedienteDto expedienteDto = new ExpedienteDto(); expedienteDto.Numero = unExpediente; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(expedienteDto); context.SaveChanges(); return(expedienteDto); } }
public ReclamoDto crearReclamo(int?motivoReclamoId) { ReclamoDto reclamo = new ReclamoDto(); reclamo.Id_Motivo_Reclamo = motivoReclamoId; using (NuevoDbContext context = new NuevoDbContext()) { context.Add(reclamo); context.SaveChanges(); return(reclamo); } }