Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        public int Add(int EXAMENId, string NOMBRE)
        {
            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()));
                    }

                    EXAMEN_SINONIMO _EXAMEN_SINONIMO = new EXAMEN_SINONIMO();

                    //properties

                    _EXAMEN_SINONIMO.NOMBRE = NOMBRE;
                    _EXAMEN_SINONIMO.ACTIVO = true;

                    //parents

                    _EXAMEN_SINONIMO.EXAMEN = _objEXAMEN;

                    context.AddObject("EXAMEN_SINONIMO", _EXAMEN_SINONIMO);
                    context.SaveChanges();

                    return(_EXAMEN_SINONIMO.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Ejemplo n.º 4
0
 public void AddToEXAMEN_SINONIMO(EXAMEN_SINONIMO eXAMEN_SINONIMO)
 {
     base.AddObject("EXAMEN_SINONIMO", eXAMEN_SINONIMO);
 }
Ejemplo n.º 5
0
 public static EXAMEN_SINONIMO CreateEXAMEN_SINONIMO(int id, string nOMBRE, bool aCTIVO)
 {
     EXAMEN_SINONIMO eXAMEN_SINONIMO = new EXAMEN_SINONIMO();
     eXAMEN_SINONIMO.ID = id;
     eXAMEN_SINONIMO.NOMBRE = nOMBRE;
     eXAMEN_SINONIMO.ACTIVO = aCTIVO;
     return eXAMEN_SINONIMO;
 }