Beispiel #1
0
        public void Delete(int Id)
        {
            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()));
                    }

                    _PRESTACION_EXAMEN.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Beispiel #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;
            }
        }
Beispiel #3
0
 public PRESTACION_EXAMEN GetByIdWithReferences(int ID)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context);
             return(repositorio.GetByIdWithReferences(ID));
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Beispiel #4
0
 public List <PRESTACION_EXAMEN> GetAllWithReferences()
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context);
             return(repositorio.GetAllWithReferences().OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Beispiel #5
0
 public List <PRESTACION_EXAMEN> GetByFilter(int?EXAMENId = null, int?PRESTACIONId = null, int?VALOR = null)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioPRESTACION_EXAMEN repositorio = new RepositorioPRESTACION_EXAMEN(context);
             return(repositorio.GetByFilter(EXAMENId, PRESTACIONId, VALOR).OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }