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;
            }
        }
Example #2
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                 using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPAGO repositorio = new RepositorioPAGO(context);
                    PAGO _PAGO = repositorio.GetById(Id);

                    if(Equals(_PAGO ,null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PAGO con Id =",Id.ToString()));
                    }

                    _PAGO.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch(Exception ex)
            {
                 ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                 throw ex;
            }
        }
Example #3
0
        public void Update(int Id, int CLIENTEId, int FECHA_PAGO, int MONTO_PAGO)
        {
            Init();
            try
            {
                 using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPAGO repositorio = new RepositorioPAGO(context);
                    PAGO _PAGO = repositorio.GetById(Id);
                    if(Equals(_PAGO,null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PAGO 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()));
                    }

                    //properties

                        _PAGO.FECHA_PAGO = FECHA_PAGO;
                        _PAGO.MONTO_PAGO = MONTO_PAGO;

                    //parents

                    _PAGO.CLIENTE = _objCLIENTE;

                    context.SaveChanges();
                }
            }
            catch(Exception ex)
            {
                 ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                 throw ex;
            }
        }
Example #4
0
 public PAGO GetByIdWithReferences(int ID)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPAGO repositorio = new RepositorioPAGO(context);
             return repositorio.GetByIdWithReferences(ID);
         }
     }
     catch (Exception ex)
     {
          ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #5
0
 public List<PAGO> GetByFilterWithReferences(int? CLIENTEId = null, int? FECHA_PAGO = null, int? MONTO_PAGO = null)
 {
     Init();
     try
     {
          using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPAGO repositorio = new RepositorioPAGO(context);
             return repositorio.GetByFilterWithReferences(CLIENTEId, FECHA_PAGO, MONTO_PAGO).OrderBy(i => i.ID).ToList();
         }
     }
     catch (Exception ex)
     {
          ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #6
0
 public List<PAGO> GetAllWithReferences()
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPAGO repositorio = new RepositorioPAGO(context);
                                 return repositorio.GetAllWithReferences().OrderBy(i => i.ID).ToList();
                             }
     }
     catch (Exception ex)
        {
          ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }