public int Add(int FACTURA_DETALLEId, int PAGOId, int MONTO) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURA_DETALLE _repositorioFACTURA_DETALLE = new RepositorioFACTURA_DETALLE(context); FACTURA_DETALLE _objFACTURA_DETALLE = _repositorioFACTURA_DETALLE.GetById(FACTURA_DETALLEId); if(Equals(_objFACTURA_DETALLE,null)) { throw new Exception(String.Concat("No se ha encontrado FACTURA_DETALLE con Id =",FACTURA_DETALLEId.ToString())); } RepositorioPAGO _repositorioPAGO = new RepositorioPAGO(context); PAGO _objPAGO = _repositorioPAGO.GetById(PAGOId); if(Equals(_objPAGO,null)) { throw new Exception(String.Concat("No se ha encontrado PAGO con Id =",PAGOId.ToString())); } PAGO_DETALLE _PAGO_DETALLE = new PAGO_DETALLE(); //properties _PAGO_DETALLE.MONTO = MONTO; _PAGO_DETALLE.ACTIVO = true; //parents _PAGO_DETALLE.FACTURA_DETALLE = _objFACTURA_DETALLE; _PAGO_DETALLE.PAGO = _objPAGO; context.AddObject("PAGO_DETALLE",_PAGO_DETALLE); context.SaveChanges(); return _PAGO_DETALLE.ID; } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURA_DETALLE repositorio = new RepositorioFACTURA_DETALLE(context); FACTURA_DETALLE _FACTURA_DETALLE = repositorio.GetById(Id); if(Equals(_FACTURA_DETALLE ,null)) { throw new Exception(String.Concat("No se ha encontrado FACTURA_DETALLE con Id =",Id.ToString())); } _FACTURA_DETALLE.ACTIVO = false; context.SaveChanges(); } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int FACTURAId, int PRESTACIONId, int MONTO_TOTAL, int MONTO_COBRADO) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURA_DETALLE repositorio = new RepositorioFACTURA_DETALLE(context); FACTURA_DETALLE _FACTURA_DETALLE = repositorio.GetById(Id); if(Equals(_FACTURA_DETALLE,null)) { throw new Exception(String.Concat("No se ha encontrado FACTURA_DETALLE con Id =",Id.ToString())); } RepositorioFACTURA _repositorioFACTURA = new RepositorioFACTURA(context); FACTURA _objFACTURA = _repositorioFACTURA.GetById(FACTURAId); if(Equals(_objFACTURA,null)) { throw new Exception(String.Concat("No se ha encontrado FACTURA con Id =",FACTURAId.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 _FACTURA_DETALLE.MONTO_TOTAL = MONTO_TOTAL; _FACTURA_DETALLE.MONTO_COBRADO = MONTO_COBRADO; //parents _FACTURA_DETALLE.FACTURA = _objFACTURA; _FACTURA_DETALLE.PRESTACION = _objPRESTACION; context.SaveChanges(); } } catch(Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public FACTURA_DETALLE GetByIdWithReferences(int ID) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURA_DETALLE repositorio = new RepositorioFACTURA_DETALLE(context); return repositorio.GetByIdWithReferences(ID); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List<FACTURA_DETALLE> GetByFilterWithReferences(int? FACTURAId = null, int? PRESTACIONId = null, int? MONTO_TOTAL = null, int? MONTO_COBRADO = null) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURA_DETALLE repositorio = new RepositorioFACTURA_DETALLE(context); return repositorio.GetByFilterWithReferences(FACTURAId, PRESTACIONId, MONTO_TOTAL, MONTO_COBRADO).OrderBy(i => i.ID).ToList(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List<FACTURA_DETALLE> GetAllWithReferences() { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioFACTURA_DETALLE repositorio = new RepositorioFACTURA_DETALLE(context); return repositorio.GetAllWithReferences().OrderBy(i => i.ID).ToList(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }