Example #1
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION_HUMANA repositorio        = new RepositorioPRESTACION_HUMANA(context);
                    PRESTACION_HUMANA            _PRESTACION_HUMANA = repositorio.GetById(Id);

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

                    _PRESTACION_HUMANA.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #2
0
        public void Update(int Id, string NOMBRE, string RUT = "", string EDAD = "", string TELEFONO = "", string PAGADO = "")
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION_HUMANA repositorio        = new RepositorioPRESTACION_HUMANA(context);
                    PRESTACION_HUMANA            _PRESTACION_HUMANA = repositorio.GetById(Id);
                    if (Equals(_PRESTACION_HUMANA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PRESTACION_HUMANA con Id =", Id.ToString()));
                    }

                    //properties

                    if (!string.IsNullOrEmpty(NOMBRE))
                    {
                        _PRESTACION_HUMANA.NOMBRE = NOMBRE;
                    }
                    if (!string.IsNullOrEmpty(RUT))
                    {
                        _PRESTACION_HUMANA.RUT = RUT;
                    }
                    if (!string.IsNullOrEmpty(EDAD))
                    {
                        _PRESTACION_HUMANA.EDAD = EDAD;
                    }
                    if (!string.IsNullOrEmpty(TELEFONO))
                    {
                        _PRESTACION_HUMANA.TELEFONO = TELEFONO;
                    }
                    if (!string.IsNullOrEmpty(PAGADO))
                    {
                        _PRESTACION_HUMANA.PAGADO = PAGADO;
                    }

                    //parents


                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #3
0
 public PRESTACION_HUMANA GetByIdWithReferences(int ID)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION_HUMANA repositorio = new RepositorioPRESTACION_HUMANA(context);
             return(repositorio.GetByIdWithReferences(ID));
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #4
0
 public List <PRESTACION_HUMANA> GetAllWithReferences()
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION_HUMANA repositorio = new RepositorioPRESTACION_HUMANA(context);
             return(repositorio.GetAllWithReferences().OrderBy(i => i.NOMBRE).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #5
0
 public List <PRESTACION_HUMANA> GetByFilterWithReferences(string NOMBRE = "", string RUT = "", string EDAD = "", string TELEFONO = "", string PAGADO = "")
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION_HUMANA repositorio = new RepositorioPRESTACION_HUMANA(context);
             return(repositorio.GetByFilterWithReferences(NOMBRE, RUT, EDAD, TELEFONO, PAGADO).OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }