public void Delete(int Id) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_COBRO repositorio = new RepositorioNOTA_COBRO(context); NOTA_COBRO _NOTA_COBRO = repositorio.GetById(Id); if (Equals(_NOTA_COBRO, null)) { throw new Exception(String.Concat("No se ha encontrado NOTA_COBRO con Id =", Id.ToString())); } _NOTA_COBRO.ACTIVO = false; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int NOTA_COBROId, int FACTURAId, int MONTO_PENDIENTE) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_COBRO_DETALLE repositorio = new RepositorioNOTA_COBRO_DETALLE(context); NOTA_COBRO_DETALLE _NOTA_COBRO_DETALLE = repositorio.GetById(Id); if (Equals(_NOTA_COBRO_DETALLE, null)) { throw new Exception(String.Concat("No se ha encontrado NOTA_COBRO_DETALLE con Id =", Id.ToString())); } RepositorioNOTA_COBRO _repositorioNOTA_COBRO = new RepositorioNOTA_COBRO(context); NOTA_COBRO _objNOTA_COBRO = _repositorioNOTA_COBRO.GetById(NOTA_COBROId); if (Equals(_objNOTA_COBRO, null)) { throw new Exception(String.Concat("No se ha encontrado NOTA_COBRO con Id =", NOTA_COBROId.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())); } //properties _NOTA_COBRO_DETALLE.MONTO_PENDIENTE = MONTO_PENDIENTE; //parents _NOTA_COBRO_DETALLE.NOTA_COBRO = _objNOTA_COBRO; _NOTA_COBRO_DETALLE.FACTURA = _objFACTURA; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public void Update(int Id, int CLIENTEId, int COBROId, int CORRELATIVO) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_COBRO repositorio = new RepositorioNOTA_COBRO(context); NOTA_COBRO _NOTA_COBRO = repositorio.GetById(Id); if (Equals(_NOTA_COBRO, null)) { throw new Exception(String.Concat("No se ha encontrado NOTA_COBRO con Id =", Id.ToString())); } RepositorioCLIENTE _repositorioCLIENTE = new RepositorioCLIENTE(context); CLIENTE _objCLIENTE = _repositorioCLIENTE.GetById(CLIENTEId); if (Equals(_objCLIENTE, null)) { throw new Exception(String.Concat("No se ha encontrado CLIENTE con Id =", CLIENTEId.ToString())); } RepositorioCOBRO _repositorioCOBRO = new RepositorioCOBRO(context); COBRO _objCOBRO = _repositorioCOBRO.GetById(COBROId); if (Equals(_objCOBRO, null)) { throw new Exception(String.Concat("No se ha encontrado COBRO con Id =", COBROId.ToString())); } //properties _NOTA_COBRO.CORRELATIVO = CORRELATIVO; //parents _NOTA_COBRO.CLIENTE = _objCLIENTE; _NOTA_COBRO.COBRO = _objCOBRO; context.SaveChanges(); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public NOTA_COBRO GetByIdWithReferences(int ID) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_COBRO repositorio = new RepositorioNOTA_COBRO(context); return(repositorio.GetByIdWithReferences(ID)); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List <NOTA_COBRO> GetAllWithReferences() { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_COBRO repositorio = new RepositorioNOTA_COBRO(context); return(repositorio.GetAllWithReferences().OrderBy(i => i.ID).ToList()); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }
public List <NOTA_COBRO> GetByFilterWithReferences(int?CLIENTEId = null, int?COBROId = null, int?CORRELATIVO = null) { Init(); try { using (LQCEEntities context = new LQCEEntities()) { RepositorioNOTA_COBRO repositorio = new RepositorioNOTA_COBRO(context); return(repositorio.GetByFilterWithReferences(CLIENTEId, COBROId, CORRELATIVO).OrderBy(i => i.ID).ToList()); } } catch (Exception ex) { ISException.RegisterExcepcion(ex); Error = ex.Message; throw ex; } }