Exemplo n.º 1
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioFACTURA repositorio = new RepositorioFACTURA(context);
                    FACTURA            _FACTURA    = repositorio.GetById(Id);

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

                    _FACTURA.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
 public FACTURA GetByIdWithReferences(int ID)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioFACTURA repositorio = new RepositorioFACTURA(context);
             return(repositorio.GetByIdWithReferences(ID));
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Exemplo n.º 5
0
 public List <FACTURA> GetAllWithReferences()
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioFACTURA repositorio = new RepositorioFACTURA(context);
             return(repositorio.GetAllWithReferences().OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Exemplo n.º 6
0
 public List <FACTURA> GetByFilterWithReferences(int?CLIENTEId = null, int?FACTURACIONId = null, int?TIPO_FACTURAId = null, int?CORRELATIVO = null, string RUT_LABORATORIO = "", int?NETO = null, int?IVA = null, int?TOTAL = null, string NOMBRE_CLIENTE = "", string RUT_CLIENTE = "", string DIRECCION = "", string NOMBRE_COMUNA = "", int?NUMERO_FACTURA = null, int?DESCUENTO = null, string FONO = "", string GIRO = "", string DETALLE = "", bool?PAGADA = null)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioFACTURA repositorio = new RepositorioFACTURA(context);
             return(repositorio.GetByFilterWithReferences(CLIENTEId, FACTURACIONId, TIPO_FACTURAId, CORRELATIVO, RUT_LABORATORIO, NETO, IVA, TOTAL, NOMBRE_CLIENTE, RUT_CLIENTE, DIRECCION, NOMBRE_COMUNA, NUMERO_FACTURA, DESCUENTO, FONO, GIRO, DETALLE, PAGADA).OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Exemplo n.º 7
0
        public void Update(int Id, int FACTURAId, System.DateTime FECHA_EMISION, int NUMERO_NOTA_CREDITO, bool CORRECCION_TOTAL_PARCIAL)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioNOTA_CREDITO repositorio   = new RepositorioNOTA_CREDITO(context);
                    NOTA_CREDITO            _NOTA_CREDITO = repositorio.GetById(Id);
                    if (Equals(_NOTA_CREDITO, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado NOTA_CREDITO 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()));
                    }

                    //properties

                    _NOTA_CREDITO.FECHA_EMISION            = FECHA_EMISION;
                    _NOTA_CREDITO.NUMERO_NOTA_CREDITO      = NUMERO_NOTA_CREDITO;
                    _NOTA_CREDITO.CORRECCION_TOTAL_PARCIAL = CORRECCION_TOTAL_PARCIAL;

                    //parents

                    _NOTA_CREDITO.FACTURA = _objFACTURA;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Exemplo n.º 8
0
        public void Update(int Id, int CLIENTEId, int FACTURACIONId, int TIPO_FACTURAId, int CORRELATIVO, string RUT_LABORATORIO, int NETO, int IVA, int TOTAL, string NOMBRE_CLIENTE = "", string RUT_CLIENTE = "", string DIRECCION = "", string NOMBRE_COMUNA = "", int?NUMERO_FACTURA = null, int?DESCUENTO = null, string FONO = "", string GIRO = "", string DETALLE = "", bool?PAGADA = null)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioFACTURA repositorio = new RepositorioFACTURA(context);
                    FACTURA            _FACTURA    = repositorio.GetById(Id);
                    if (Equals(_FACTURA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado FACTURA 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()));
                    }

                    RepositorioFACTURACION _repositorioFACTURACION = new RepositorioFACTURACION(context);
                    FACTURACION            _objFACTURACION         = _repositorioFACTURACION.GetById(FACTURACIONId);
                    if (Equals(_objFACTURACION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado FACTURACION con Id =", FACTURACIONId.ToString()));
                    }

                    RepositorioTIPO_FACTURA _repositorioTIPO_FACTURA = new RepositorioTIPO_FACTURA(context);
                    TIPO_FACTURA            _objTIPO_FACTURA         = _repositorioTIPO_FACTURA.GetById(TIPO_FACTURAId);
                    if (Equals(_objTIPO_FACTURA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado TIPO_FACTURA con Id =", TIPO_FACTURAId.ToString()));
                    }

                    //properties

                    _FACTURA.CORRELATIVO = CORRELATIVO;
                    if (!string.IsNullOrEmpty(NOMBRE_CLIENTE))
                    {
                        _FACTURA.NOMBRE_CLIENTE = NOMBRE_CLIENTE;
                    }
                    if (!string.IsNullOrEmpty(RUT_CLIENTE))
                    {
                        _FACTURA.RUT_CLIENTE = RUT_CLIENTE;
                    }
                    if (!string.IsNullOrEmpty(DIRECCION))
                    {
                        _FACTURA.DIRECCION = DIRECCION;
                    }
                    if (!string.IsNullOrEmpty(NOMBRE_COMUNA))
                    {
                        _FACTURA.NOMBRE_COMUNA = NOMBRE_COMUNA;
                    }
                    if (NUMERO_FACTURA.HasValue)
                    {
                        _FACTURA.NUMERO_FACTURA = NUMERO_FACTURA.Value;
                    }
                    if (!string.IsNullOrEmpty(RUT_LABORATORIO))
                    {
                        _FACTURA.RUT_LABORATORIO = RUT_LABORATORIO;
                    }
                    if (DESCUENTO.HasValue)
                    {
                        _FACTURA.DESCUENTO = DESCUENTO.Value;
                    }
                    if (!string.IsNullOrEmpty(FONO))
                    {
                        _FACTURA.FONO = FONO;
                    }
                    if (!string.IsNullOrEmpty(GIRO))
                    {
                        _FACTURA.GIRO = GIRO;
                    }
                    if (!string.IsNullOrEmpty(DETALLE))
                    {
                        _FACTURA.DETALLE = DETALLE;
                    }
                    _FACTURA.NETO  = NETO;
                    _FACTURA.IVA   = IVA;
                    _FACTURA.TOTAL = TOTAL;
                    if (PAGADA.HasValue)
                    {
                        _FACTURA.PAGADA = PAGADA.Value;
                    }

                    //parents

                    _FACTURA.CLIENTE      = _objCLIENTE;
                    _FACTURA.FACTURACION  = _objFACTURACION;
                    _FACTURA.TIPO_FACTURA = _objTIPO_FACTURA;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }