/// <summary> /// Metodo utilizado para actualizar un nueva Secretario. /// </summary> /// <param name="Matricula"></param> public void update(Secretario secretario) { try { using (var db = new ModeloRenacer()) { if (secretario.tipoDoc != null) { secretario.idTipoDoc = secretario.tipoDoc.id; secretario.tipoDoc = null; } db.secretario.AddOrUpdate(secretario); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// <summary> /// Metodo utilizado para Insertar un nuevo Matricula. /// </summary> /// <param name="Matricula"></param> public void grabar(Secretario secretario) { try { //var errores = this.validar(Matricula); //if (errores.Count > 0) //{ // throw new UsuarioException(errores); //} using (var db = new ModeloRenacer()) { if (secretario.tipoDoc != null) { secretario.idTipoDoc = secretario.tipoDoc.id; secretario.tipoDoc = null; } db.secretario.Add(secretario); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// <summary> /// Metodo utilizado para Insertar un nuevo TipoDocumento. /// </summary> /// <param name="TipoDocumento"></param> public void grabar(TipoDocumento TipoDocumento) { try { var errores = this.validar(TipoDocumento); if (errores.Count > 0) { throw new UsuarioException(errores); } using (var db = new ModeloRenacer()) { db.tipoDocumento.AddOrUpdate(TipoDocumento); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// var item = (from i in db.detalleEvento /// where i.id.Equals(id) // select i).FirstOrDefault(); /// /// /// SELECT * FROM DetalleEvento WHERE id = 1; public DetalleEvento devolver(int id) { try { using (var db = new ModeloRenacer()) { var detalleEvento = db.detalleEvento .Where(x => x.id.Equals(id)).FirstOrDefault(); if (detalleEvento.idEspacio > 0) { detalleEvento.espacio = db.espacioComun.Single(x => x.id == detalleEvento.idEspacio); } //if (detalleEvento.idAsistencia > 0) detalleEvento.asistencia = db.asistencia.Single(x => x.id == detalleEvento.idAsistencia); if (detalleEvento.idEncargado > 0) { detalleEvento.responsable = db.encargado.Single(x => x.id == detalleEvento.idEncargado); } return(detalleEvento); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
public void actualizar(DetalleEvento detalleEvento) { try { using (var db = new ModeloRenacer()) { if (detalleEvento.espacio != null) { detalleEvento.espacio = db.espacioComun.Single(a => a.id == detalleEvento.espacio.id); } //if (detalleEvento.asistencia != null) // detalleEvento.asistencia = db.asistencia.Single(a => a.id == detalleEvento.asistencia.id); if (detalleEvento.responsable != null) { detalleEvento.responsable = db.encargado.Single(a => a.id == detalleEvento.responsable.id); } db.detalleEvento.AddOrUpdate(detalleEvento); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// <summary> /// Metodo utilizado para Insertar un nuevo Matricula. /// </summary> /// <param name="Recordatorio"></param> public void grabar(Recordatorio Recordatorio) { try { //var errores = this.validar(Matricula); //if (errores.Count > 0) //{ // throw new UsuarioException(errores); //} using (var db = new ModeloRenacer()) { db.recordatorio.AddOrUpdate(Recordatorio); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
//public Evento devolverInscriptos(int id) //{ // try // { // using (var db = new ModeloRenacer()) // { // Evento evento = db.evento.Include("listaInscripciones") // .Where(x => x.id.Equals(id)).FirstOrDefault(); // return evento; // } // } // catch (Exception ex) // { // ServicioSentry.devolverSentry().informarExcepcion(ex); // return null; // } //} /// var item = (from i in db.evento /// where i.id.Equals(id) // select i).FirstOrDefault(); /// /// /// SELECT * FROM Evento WHERE id = 1; public Evento devolver(int id) { try { using (var db = new ModeloRenacer()) { var evento = db.evento //Include("listaDetalleEvento") .Include("espacio") .Include("responsable") .Include("tipoEvento") .Include("listaInscripciones") .Include("listaHorarios") .Include("listaCuotas") .Where(x => x.id.Equals(id)).FirstOrDefault(); //if (evento.idEncargado > 0) evento.responsable = db.encargado.FirstOrDefault(x => x.id.Equals(evento.idEncargado)); //if (evento.idEspacio > 0) evento.espacio = db.espacioComun.FirstOrDefault(x => x.id.Equals(evento.idEspacio)); //if (evento.idTipoEvento > 0) evento.tipoEvento = db.tipoEvento.FirstOrDefault(x => x.id.Equals(evento.idTipoEvento)); //evento.listaTags = db.tag.Where(x => x.listaEventos.Any(xy => xy.id.Equals(id))).ToList(); //evento.listaDetalleEvento = db.detalleEvento.Where(x => x.idEvento.Equals(id)).ToList(); //evento.listaSocios = db.socio.Where(x => x.listaInscripciones.Any(xy => xy.idEvento.Equals(id))).ToList(); // evento.listaInscripciones = db.inscripcion.Where(x => x.idEvento.Equals(id)).ToList(); return(evento); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los Inscripcion /// SELECT * FROM Inscripcion /// </summary> /// <returns></returns> public List <Inscripcion> devolverTodos(int?idEvento, int?idSocio) { try { using (var db = new ModeloRenacer()) { if (idSocio != null && idSocio > 0) { return(db.inscripcion .Include("listaPagos").Include("listaPagos.cuota") .Include("evento") .Where(x => x.idSocio == idSocio && x.fechaBaja == null) .ToList()); } else if (idEvento != null && idEvento > 0) { return(db.inscripcion .Include("listaPagos") .Include("socio") .Where(x => x.evento.id == idEvento && x.fechaBaja == null).ToList()); } else { return(db.inscripcion.ToList()); } } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para Insertar un nuevo encargado. /// </summary> /// <param name="encargado"></param> public void grabar(Encargado encargado) { try { var errores = this.validar(encargado); if (errores.Count > 0) { throw new UsuarioException(errores); } if (encargado.id == 0) { encargado.fechaCreacion = DateTime.Now; } if (encargado.id > 0) { encargado.fechaModificacion = DateTime.Now; } encargado.idTipoDoc = encargado.tipoDoc.id; using (var db = new ModeloRenacer()) { Tag[] listaTags = new Tag[encargado.listaTags.Count]; encargado.listaTags.CopyTo(listaTags); encargado.listaTags.RemoveAll(tag => true); db.encargado.AddOrUpdate(encargado); if (encargado.domicilio.id == 0) { db.Entry(encargado.domicilio).State = System.Data.Entity.EntityState.Added; } if (encargado.domicilio.id > 0) { db.Entry(encargado.domicilio).State = System.Data.Entity.EntityState.Modified; } db.Entry(encargado.tipoDoc).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); Encargado encargadoAux = db.encargado.Include("listaTags").Single(a => a.id == encargado.id); ControlTag.devolverInstancia().actualizarListaDeTags(db, listaTags, encargadoAux.listaTags); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// <summary> /// Metodo utilizado para Insertar un nuevo socio. /// </summary> /// <param name="socio"></param> public void grabar(Socio socio) { try { var errores = this.validar(socio); if (errores.Count > 0) { throw new UsuarioException(errores); } using (var db = new ModeloRenacer()) { socio.idTipoDoc = socio.tipoDoc.id; Tag[] listaTags = new Tag[socio.listaTags.Count]; socio.listaTags.CopyTo(listaTags); socio.listaTags.RemoveAll(tag => true); if (socio.domicilio.id == 0) { db.Entry(socio.domicilio).State = System.Data.Entity.EntityState.Added; } if (socio.domicilio.id > 0) { db.Entry(socio.domicilio).State = System.Data.Entity.EntityState.Modified; } if (socio.contacto.id == 0) { db.Entry(socio.contacto).State = System.Data.Entity.EntityState.Added; } if (socio.contacto.id > 0) { db.Entry(socio.contacto).State = System.Data.Entity.EntityState.Modified; } db.Entry(socio.tipoDoc).State = System.Data.Entity.EntityState.Unchanged; //db.SaveChanges(); Socio socioAux = db.socio.Include("listaTags").Single(a => a.id == socio.id); ControlTag.devolverInstancia().actualizarListaDeTags(db, listaTags, socioAux.listaTags); db.socio.AddOrUpdate(socio); db.SaveChanges(); } } catch (UsuarioException ex) { ServicioSentry.devolverSentry().informarExcepcionUsuario(ex); throw ex; } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// <summary> /// Metodo utilizado para eliminar un TipoDocumento. /// TODO: El metodo se tiene que cambiar para actualizar un atributo del TipoDocumento /// para ver si esta eliminado o no, no se eliminan datos. /// </summary> public void eliminar(int id) { try { using (var db = new ModeloRenacer()) { db.tipoDocumento.Remove(db.tipoDocumento.Where(x => x.id.Equals(id)).FirstOrDefault()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
/// <summary> /// Metodo utilizado para devolver todos los EspacioComun /// SELECT * FROM EspacioComun /// </summary> /// <returns></returns> public List <EspacioComun> devolverTodos() { try { using (var db = new ModeloRenacer()) { return(db.espacioComun.ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los Matricula /// SELECT * FROM Matricula /// </summary> /// <returns></returns> public List <Recordatorio> devolverTodos() { try { using (var db = new ModeloRenacer()) { return(db.recordatorio.OrderBy(x => x.fechaRecordatorio).ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
public List <Pago> devolverTodosXSocio(int idInscripcion) { try { using (var db = new ModeloRenacer()) { return(db.pagoCuota.Where(x => x.idInscripcion.Equals(idInscripcion)).ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para eliminar un evento. /// TODO: El metodo se tiene que cambiar para actualizar un atributo del evento /// para ver si esta eliminado o no, no se eliminan datos. /// </summary> public void eliminar(Evento evento) { try { using (var db = new ModeloRenacer()) { db.evento.AddOrUpdate(evento); db.SaveChanges(); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
public List <MatriculaXSocio> devolverXSocio(int _id) { try { using (var db = new ModeloRenacer()) { return(db.matriculaXSocio.Where(x => x.idSocio.Equals(_id)).ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
public Matricula devolverMatriculaActiva() { try { using (var db = new ModeloRenacer()) { return(db.matricula.Where(x => x.estado.Equals("Activa")).FirstOrDefault()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los Matricula /// SELECT * FROM Matricula /// </summary> /// <returns></returns> public List <Matricula> devolverTodos() { try { using (var db = new ModeloRenacer()) { return(db.matricula.OrderByDescending(x => x.anio).ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los Matricula /// SELECT * FROM Matricula /// </summary> /// <returns></returns> public List <Secretario> devolverTodos() { try { using (var db = new ModeloRenacer()) { return(db.secretario.Where(x => x.fechaBaja == null).ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los MatriculaXSocio /// SELECT * FROM MatriculaXSocio /// </summary> /// <returns></returns> public List <MatriculaXSocio> devolverTodos() { try { using (var db = new ModeloRenacer()) { return(db.matriculaXSocio.Include("socio").Include("matricula").ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los TipoDocumento /// SELECT * FROM TipoDocumento /// </summary> /// <returns></returns> public List <TipoDocumento> devolverTodos() { try { using (var db = new ModeloRenacer()) { return(db.tipoDocumento.ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// var item = (from i in db.Pago /// where i.id.Equals(id) // select i).FirstOrDefault(); /// /// /// SELECT * FROM Pago WHERE id = 1; public Pago devolver(int id) { try { using (var db = new ModeloRenacer()) { return(db.pagoCuota.Include("Inscripcion").Where(x => x.id.Equals(id)).FirstOrDefault()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// var item = (from i in db.TipoEspacio /// where i.id.Equals(id) // select i).FirstOrDefault(); /// /// /// SELECT * FROM TipoEspacio WHERE id = 1; public TipoEspacio devolver(int id) { try { using (var db = new ModeloRenacer()) { return(db.tipoEspacio.Where(x => x.id.Equals(id)).FirstOrDefault()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para eliminar un inscripcion. /// TODO: El metodo se tiene que cambiar para actualizar un atributo del inscripcion /// para ver si esta eliminado o no, no se eliminan datos. /// </summary> public void eliminar(Inscripcion inscripcion) { try { using (var db = new ModeloRenacer()) { db.inscripcion.AddOrUpdate(inscripcion);// pone fechaBaja db.SaveChanges(); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
public Usuario devolverPorUsuario(string usuario) { try { using (var db = new ModeloRenacer()) { return(db.usuario. Where(x => x.usuario.Equals(usuario)).FirstOrDefault()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para devolver todos los Pago /// SELECT * FROM Pago /// </summary> /// <returns></returns> public Pago devolverUltimo() { try { using (var db = new ModeloRenacer()) { //Product prod = db.Products.LastOrDefault<Product>(); return(db.pagoCuota.ToList().LastOrDefault <Pago>());; } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
public List <DetalleEvento> devolverTodosXEncargado(int _idEvento) { try { using (var db = new ModeloRenacer()) { return(db.detalleEvento .Where(ev => ev.idEvento == _idEvento && ev.fechaBaja == null) .ToList()); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// var item = (from i in db.asistencia /// where i.id.Equals(id) // select i).FirstOrDefault(); /// /// /// SELECT * FROM Asistencia WHERE id = 1; public Asistencia devolver(int id) { try { using (var db = new ModeloRenacer()) { var item = db.asistencia.Include("listaSocios").Where(x => x.id.Equals(id)).FirstOrDefault(); //item.listaSocios = db.socio.Where(x => x.listaEspacios.Any(xy => xy.id.Equals(id))).ToList(); return(item); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }
/// <summary> /// Metodo utilizado para eliminar un Matricula. /// TODO: El metodo se tiene que cambiar para actualizar un atributo del Matricula /// para ver si esta eliminado o no, no se eliminan datos. /// </summary> public void eliminar(int id) { try { using (var db = new ModeloRenacer()) { RatingEvento reco = db.rating.Where(x => x.id.Equals(id)).FirstOrDefault(); db.rating.Remove(reco); db.SaveChanges(); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } }
public Inscripcion devolverXsocioXevento(int _idEvento, int _idSocio) { try { using (var db = new ModeloRenacer()) { var item = db.inscripcion. Where(x => x.idEvento == _idEvento && x.idSocio == _idSocio && x.fechaBaja == null).FirstOrDefault(); return(item); } } catch (Exception ex) { ServicioSentry.devolverSentry().informarExcepcion(ex); } return(null); }