Esempio n. 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;
            }
        }
Esempio n. 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;
            }
        }
Esempio n. 3
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;
            }
        }
 public void AddToPRESTACION_EXAMEN(PRESTACION_EXAMEN pRESTACION_EXAMEN)
 {
     base.AddObject("PRESTACION_EXAMEN", pRESTACION_EXAMEN);
 }
 public static PRESTACION_EXAMEN CreatePRESTACION_EXAMEN(int id, bool aCTIVO)
 {
     PRESTACION_EXAMEN pRESTACION_EXAMEN = new PRESTACION_EXAMEN();
     pRESTACION_EXAMEN.ID = id;
     pRESTACION_EXAMEN.ACTIVO = aCTIVO;
     return pRESTACION_EXAMEN;
 }