Example #1
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioEXAMEN_SINONIMO repositorio      = new RepositorioEXAMEN_SINONIMO(context);
                    EXAMEN_SINONIMO            _EXAMEN_SINONIMO = repositorio.GetById(Id);

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

                    _EXAMEN_SINONIMO.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #2
0
 public EXAMEN_SINONIMO GetByIdWithReferences(int ID)
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioEXAMEN_SINONIMO repositorio = new RepositorioEXAMEN_SINONIMO(context);
             return(repositorio.GetByIdWithReferences(ID));
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #3
0
 public List <EXAMEN_SINONIMO> GetAllWithReferences()
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioEXAMEN_SINONIMO repositorio = new RepositorioEXAMEN_SINONIMO(context);
             return(repositorio.GetAllWithReferences().OrderBy(i => i.NOMBRE).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #4
0
 public List <EXAMEN_SINONIMO> GetByFilter(int?EXAMENId = null, string NOMBRE = "")
 {
     Init();
     try
     {
         using (LQCEEntities context = new LQCEEntities())
         {
             RepositorioEXAMEN_SINONIMO repositorio = new RepositorioEXAMEN_SINONIMO(context);
             return(repositorio.GetByFilter(EXAMENId, NOMBRE).OrderBy(i => i.ID).ToList());
         }
     }
     catch (Exception ex)
     {
         ISException.RegisterExcepcion(ex);
         Error = ex.Message;
         throw ex;
     }
 }
Example #5
0
        public void Update(int Id, int EXAMENId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioEXAMEN_SINONIMO repositorio      = new RepositorioEXAMEN_SINONIMO(context);
                    EXAMEN_SINONIMO            _EXAMEN_SINONIMO = repositorio.GetById(Id);
                    if (Equals(_EXAMEN_SINONIMO, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado EXAMEN_SINONIMO 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()));
                    }

                    //properties

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

                    //parents

                    _EXAMEN_SINONIMO.EXAMEN = _objEXAMEN;

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