Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        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;
            }
        }
Beispiel #3
0
        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;
            }
        }
Beispiel #4
0
        public int Add(int CLIENTEId, int COBROId, int CORRELATIVO)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    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()));
                    }

                    NOTA_COBRO _NOTA_COBRO = new NOTA_COBRO();

                    //properties

                    _NOTA_COBRO.CORRELATIVO = CORRELATIVO;
                    _NOTA_COBRO.ACTIVO      = true;

                    //parents

                    _NOTA_COBRO.CLIENTE = _objCLIENTE;
                    _NOTA_COBRO.COBRO   = _objCOBRO;

                    context.AddObject("NOTA_COBRO", _NOTA_COBRO);
                    context.SaveChanges();

                    return(_NOTA_COBRO.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
 public static NOTA_COBRO CreateNOTA_COBRO(int id, int cORRELATIVO, bool aCTIVO)
 {
     NOTA_COBRO nOTA_COBRO = new NOTA_COBRO();
     nOTA_COBRO.ID = id;
     nOTA_COBRO.CORRELATIVO = cORRELATIVO;
     nOTA_COBRO.ACTIVO = aCTIVO;
     return nOTA_COBRO;
 }
 public void AddToNOTA_COBRO(NOTA_COBRO nOTA_COBRO)
 {
     base.AddObject("NOTA_COBRO", nOTA_COBRO);
 }