Example #1
0
        public int Add(int TIPO_PRESTACIONId, string CODIGO, string NOMBRE)
        {
            Init();
            try
            {
                 using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioTIPO_PRESTACION _repositorioTIPO_PRESTACION = new RepositorioTIPO_PRESTACION(context);
                    TIPO_PRESTACION _objTIPO_PRESTACION = _repositorioTIPO_PRESTACION.GetById(TIPO_PRESTACIONId);
                    if(Equals(_objTIPO_PRESTACION,null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado TIPO_PRESTACION con Id =",TIPO_PRESTACIONId.ToString()));
                    }

                    EXAMEN _EXAMEN = new EXAMEN();

                    //properties

                    _EXAMEN.CODIGO = CODIGO;
                    _EXAMEN.NOMBRE = NOMBRE;
                    _EXAMEN.ACTIVO = true;

                    //parents

                    _EXAMEN.TIPO_PRESTACION = _objTIPO_PRESTACION;

                    context.AddObject("EXAMEN",_EXAMEN);
                    context.SaveChanges();

                    return _EXAMEN.ID;
                }
            }
            catch(Exception ex)
            {
                 ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
        protected void btnExamenAgregarIngresaSinonimo_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(txtExamenAgregarIngresaSinonimo.Text))
                {
                    List<EXAMEN> _list = new List<EXAMEN>();
                    EXAMEN objExamen = new EXAMEN();
                    objExamen.NOMBRE = txtExamenAgregarIngresaSinonimo.Text;
                    _list.Add(objExamen);

                    gridAgregarSinonimoExamen.DataSource = _list;
                    gridAgregarSinonimoExamen.DataBind();

                    txtExamenAgregarIngresaSinonimo.Text = string.Empty;
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                panelMensaje.CssClass = "MostrarMensaje";
                lblMensaje.Text = ex.Message;
                return;
            }
        }