public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context); PRESTACION_EXAMEN _PRESTACION_EXAMEN = repositorio.GetById(Id); if(Equals(_PRESTACION_EXAMEN ,null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION_EXAMEN con Id =",Id.ToString())); } _PRESTACION_EXAMEN.ACTIVO = false; context.SaveChanges(); } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int EXAMENId, int PRESTACIONId, int? VALOR = null) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context); PRESTACION_EXAMEN _PRESTACION_EXAMEN = repositorio.GetById(Id); if(Equals(_PRESTACION_EXAMEN,null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION_EXAMEN con Id =",Id.ToString())); } RepositorioEXAMEN _repositorioEXAMEN = new RepositorioEXAMEN(context); EXAMEN _objEXAMEN = _repositorioEXAMEN.GetById(EXAMENId); if(Equals(_objEXAMEN,null)) { throw new Exception(String.Concat("No se ha encontrado EXAMEN con Id =",EXAMENId.ToString())); } RepositorioPRESTACION _repositorioPRESTACION = new RepositorioPRESTACION(context); PRESTACION _objPRESTACION = _repositorioPRESTACION.GetById(PRESTACIONId); if(Equals(_objPRESTACION,null)) { throw new Exception(String.Concat("No se ha encontrado PRESTACION con Id =",PRESTACIONId.ToString())); } //properties if (VALOR.HasValue) { _PRESTACION_EXAMEN.VALOR = VALOR.Value; } //parents _PRESTACION_EXAMEN.EXAMEN = _objEXAMEN; _PRESTACION_EXAMEN.PRESTACION = _objPRESTACION; context.SaveChanges(); } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public PRESTACION_EXAMEN GetByIdWithReferences(int ID) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context); return repositorio.GetByIdWithReferences(ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List<PRESTACION_EXAMEN> GetByFilterWithReferences(int? EXAMENId = null, int? PRESTACIONId = null, int? VALOR = null) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context); return repositorio.GetByFilterWithReferences(EXAMENId, PRESTACIONId, VALOR).OrderBy(i => i.ID).ToList(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List<PRESTACION_EXAMEN> GetAll() { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context); return repositorio.GetAll().OrderBy(i => i.ID).ToList(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List<DTO_PAGO_PRESTACIONES> FacturaForPagos(int IdDetalleFactura) { try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURACION _RepositorioFACTURACION = new RepositorioFACTURACION(context); RepositorioPRESTACION_EXAMEN _RepositorioPRESTACION_EXAMEN = new RepositorioPRESTACION_EXAMEN(context); var detalle_factura = _RepositorioFACTURACION.GetFacturaDetalleByIdDetalleFactura(IdDetalleFactura); List<DTO_PAGO_PRESTACIONES> lista = new List<DTO_PAGO_PRESTACIONES>(); foreach (var lis in detalle_factura) { DTO_PAGO_PRESTACIONES _DTO_PAGO_PRESTACIONES = new DTO_PAGO_PRESTACIONES(); _DTO_PAGO_PRESTACIONES.ID_FACTURA = lis.FACTURA.ID; _DTO_PAGO_PRESTACIONES.NUMERO_FACTURA = lis.FACTURA.NUMERO_FACTURA; _DTO_PAGO_PRESTACIONES.NOMBRE_PACIENTE = lis.PRESTACION.PRESTACION_HUMANA != null ? lis.PRESTACION.PRESTACION_HUMANA.NOMBRE : lis.PRESTACION.PRESTACION_VETERINARIA.NOMBRE;// lis.FACTURA.NOMBRE_CLIENTE; _DTO_PAGO_PRESTACIONES.PRESTACION = lis.PRESTACION.TIPO_PRESTACION.NOMBRE; //_DTO_PAGO_PRESTACIONES.EXAMEN = ; //_DTO_PAGO_PRESTACIONES.VALOR_EXAMEN = lis.PRESTACION; _DTO_PAGO_PRESTACIONES.FECHA_RECEPCION = lis.PRESTACION.FECHA_RECEPCION; _DTO_PAGO_PRESTACIONES.ID_FACTURA_DETALLE = lis.ID; var prestacion = _RepositorioPRESTACION_EXAMEN.GetByFilterWithReferences(null, lis.PRESTACION.ID, null); foreach (var pre in prestacion) { _DTO_PAGO_PRESTACIONES.EXAMEN = pre.EXAMEN.NOMBRE; _DTO_PAGO_PRESTACIONES.VALOR_EXAMEN = int.Parse(pre.VALOR.ToString()); } lista.Add(_DTO_PAGO_PRESTACIONES); } return lista; } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }