Example #1
0
        public void Delete(int Id)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION_MUESTRA repositorio         = new RepositorioPRESTACION_MUESTRA(context);
                    PRESTACION_MUESTRA            _PRESTACION_MUESTRA = repositorio.GetById(Id);

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

                    _PRESTACION_MUESTRA.ACTIVO = false;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #2
0
        public void Update(int Id, int PRESTACIONId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioPRESTACION_MUESTRA repositorio         = new RepositorioPRESTACION_MUESTRA(context);
                    PRESTACION_MUESTRA            _PRESTACION_MUESTRA = repositorio.GetById(Id);
                    if (Equals(_PRESTACION_MUESTRA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado PRESTACION_MUESTRA con Id =", Id.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 (!string.IsNullOrEmpty(NOMBRE))
                    {
                        _PRESTACION_MUESTRA.NOMBRE = NOMBRE;
                    }

                    //parents

                    _PRESTACION_MUESTRA.PRESTACION = _objPRESTACION;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
Example #3
0
        public int Add(int PRESTACIONId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    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_MUESTRA _PRESTACION_MUESTRA = new PRESTACION_MUESTRA();

                    //properties

                    _PRESTACION_MUESTRA.NOMBRE = NOMBRE;
                    _PRESTACION_MUESTRA.ACTIVO = true;

                    //parents

                    _PRESTACION_MUESTRA.PRESTACION = _objPRESTACION;

                    context.AddObject("PRESTACION_MUESTRA", _PRESTACION_MUESTRA);
                    context.SaveChanges();

                    return(_PRESTACION_MUESTRA.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
 public void AddToPRESTACION_MUESTRA(PRESTACION_MUESTRA pRESTACION_MUESTRA)
 {
     base.AddObject("PRESTACION_MUESTRA", pRESTACION_MUESTRA);
 }
 public static PRESTACION_MUESTRA CreatePRESTACION_MUESTRA(int id, string nOMBRE, bool aCTIVO)
 {
     PRESTACION_MUESTRA pRESTACION_MUESTRA = new PRESTACION_MUESTRA();
     pRESTACION_MUESTRA.ID = id;
     pRESTACION_MUESTRA.NOMBRE = nOMBRE;
     pRESTACION_MUESTRA.ACTIVO = aCTIVO;
     return pRESTACION_MUESTRA;
 }