Example #1
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION repositorio = new RepositorioPRESTACION(context);
                    PRESTACION            _PRESTACION = repositorio.GetById(Id);

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

                    _PRESTACION.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #2
0
        public void Update(int Id, int EXAMENId, int PRESTACIONId, int?VALOR = null)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION_EXAMEN repositorio        = new RepositorioPRESTACION_EXAMEN(context);
                    PRESTACION_EXAMEN            _PRESTACION_EXAMEN = repositorio.GetById(Id);
                    if (Equals(_PRESTACION_EXAMEN, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PRESTACION_EXAMEN con Id =", Id.ToString()));
                    }

                    RepositorioEXAMEN _repositorioEXAMEN = new RepositorioEXAMEN(context);
                    EXAMEN            _objEXAMEN         = _repositorioEXAMEN.GetById(EXAMENId);
                    if (Equals(_objEXAMEN, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado EXAMEN con Id =", EXAMENId.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

                    if (VALOR.HasValue)
                    {
                        _PRESTACION_EXAMEN.VALOR = VALOR.Value;
                    }

                    //parents

                    _PRESTACION_EXAMEN.EXAMEN     = _objEXAMEN;
                    _PRESTACION_EXAMEN.PRESTACION = _objPRESTACION;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #3
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;
            }
        }
Example #4
0
        public int Add(int EXAMENId, int PRESTACIONId, int?VALOR = null)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioEXAMEN _repositorioEXAMEN = new RepositorioEXAMEN(context);
                    EXAMEN            _objEXAMEN         = _repositorioEXAMEN.GetById(EXAMENId);
                    if (Equals(_objEXAMEN, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado EXAMEN con Id =", EXAMENId.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()));
                    }

                    PRESTACION_EXAMEN _PRESTACION_EXAMEN = new PRESTACION_EXAMEN();

                    //properties

                    _PRESTACION_EXAMEN.VALOR  = VALOR;
                    _PRESTACION_EXAMEN.ACTIVO = true;

                    //parents

                    _PRESTACION_EXAMEN.EXAMEN     = _objEXAMEN;
                    _PRESTACION_EXAMEN.PRESTACION = _objPRESTACION;

                    context.AddObject("PRESTACION_EXAMEN", _PRESTACION_EXAMEN);
                    context.SaveChanges();

                    return(_PRESTACION_EXAMEN.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #5
0
 public PRESTACION GetByIdWithReferences(int ID)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION repositorio = new RepositorioPRESTACION(context);
             return(repositorio.GetByIdWithReferences(ID));
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #6
0
 public List <PRESTACION> GetAllWithReferences()
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION repositorio = new RepositorioPRESTACION(context);
             return(repositorio.GetAllWithReferences().OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #7
0
 public List <PRESTACION> GetByFilterWithReferences(int?CLIENTEId = null, int?GARANTIAId = null, int?PREVISIONId = null, int?TIPO_PRESTACIONId = null, System.DateTime?FECHA_RECEPCION = null, string MEDICO = "", string RECEPCION = "", string PENDIENTE = "")
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION repositorio = new RepositorioPRESTACION(context);
             return(repositorio.GetByFilterWithReferences(CLIENTEId, GARANTIAId, PREVISIONId, TIPO_PRESTACIONId, FECHA_RECEPCION, MEDICO, RECEPCION, PENDIENTE).OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #8
0
        public void Update(int Id, int PRESTACIONId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION_MUESTRA repositorio         = new RepositorioPRESTACION_MUESTRA(context);
                    PRESTACION_MUESTRA            _PRESTACION_MUESTRA = repositorio.GetById(Id);
                    if (Equals(_PRESTACION_MUESTRA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PRESTACION_MUESTRA con Id =", Id.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

                    if (!string.IsNullOrEmpty(NOMBRE))
                    {
                        _PRESTACION_MUESTRA.NOMBRE = NOMBRE;
                    }

                    //parents

                    _PRESTACION_MUESTRA.PRESTACION = _objPRESTACION;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #9
0
        public int Add(int PRESTACIONId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    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()));
                    }

                    PRESTACION_MUESTRA _PRESTACION_MUESTRA = new PRESTACION_MUESTRA();

                    //properties

                    _PRESTACION_MUESTRA.NOMBRE = NOMBRE;
                    _PRESTACION_MUESTRA.ACTIVO = true;

                    //parents

                    _PRESTACION_MUESTRA.PRESTACION = _objPRESTACION;

                    context.AddObject("PRESTACION_MUESTRA", _PRESTACION_MUESTRA);
                    context.SaveChanges();

                    return(_PRESTACION_MUESTRA.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #10
0
        public void Update(int Id, int CLIENTEId, int GARANTIAId, int PREVISIONId, int TIPO_PRESTACIONId, System.DateTime FECHA_RECEPCION, string MEDICO = "", string RECEPCION = "", string PENDIENTE = "")
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION repositorio = new RepositorioPRESTACION(context);
                    PRESTACION            _PRESTACION = repositorio.GetById(Id);
                    if (Equals(_PRESTACION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PRESTACION 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()));
                    }

                    RepositorioGARANTIA _repositorioGARANTIA = new RepositorioGARANTIA(context);
                    GARANTIA            _objGARANTIA         = _repositorioGARANTIA.GetById(GARANTIAId);
                    if (Equals(_objGARANTIA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado GARANTIA con Id =", GARANTIAId.ToString()));
                    }

                    RepositorioPREVISION _repositorioPREVISION = new RepositorioPREVISION(context);
                    PREVISION            _objPREVISION         = _repositorioPREVISION.GetById(PREVISIONId);
                    if (Equals(_objPREVISION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PREVISION con Id =", PREVISIONId.ToString()));
                    }

                    RepositorioTIPO_PRESTACION _repositorioTIPO_PRESTACION = new RepositorioTIPO_PRESTACION(context);
                    TIPO_PRESTACION            _objTIPO_PRESTACION         = _repositorioTIPO_PRESTACION.GetById(TIPO_PRESTACIONId);
                    if (Equals(_objTIPO_PRESTACION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =", TIPO_PRESTACIONId.ToString()));
                    }

                    //properties

                    if (!string.IsNullOrEmpty(MEDICO))
                    {
                        _PRESTACION.MEDICO = MEDICO;
                    }
                    _PRESTACION.FECHA_RECEPCION = FECHA_RECEPCION;
                    if (!string.IsNullOrEmpty(RECEPCION))
                    {
                        _PRESTACION.RECEPCION = RECEPCION;
                    }
                    if (!string.IsNullOrEmpty(PENDIENTE))
                    {
                        _PRESTACION.PENDIENTE = PENDIENTE;
                    }

                    //parents

                    _PRESTACION.CLIENTE         = _objCLIENTE;
                    _PRESTACION.GARANTIA        = _objGARANTIA;
                    _PRESTACION.PREVISION       = _objPREVISION;
                    _PRESTACION.TIPO_PRESTACION = _objTIPO_PRESTACION;

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