protected void Button1_Click(object sender, EventArgs e)
        {
            entity = new ContentThematic();
            status = new StatusThemeContent();
            if (txt_Tema.Text != "" || txt_ObjInstrumental.Text != "")
            {
                try
                {
                    entity.Theme = txt_Tema.Text;
                    entity.InstrumentalObjectives = txt_ObjInstrumental.Text;
                    if (txt_TemaInvest.Text != "")
                    {
                        entity.InvestigationThemes = txt_TemaInvest.Text;
                    }
                    else
                    {
                        entity.InvestigationThemes = null;
                    }

                    if (txt_TrabPersonal.Text != "")
                    {
                        entity.PersonalWork = txt_TrabPersonal.Text;
                    }
                    else
                    {
                        entity.PersonalWork = null;
                    }

                    if (txt_TrabGrupal.Text != "")
                    {
                        entity.GroupWork = txt_TrabGrupal.Text;
                    }
                    else
                    {
                        entity.GroupWork = null;
                    }

                    entity.GlobalPlan = (long)Session["GlobalPlanID"];
                    proxyGP.InsertThematicContent(entity);

                    status.StatusThemeCode = 0;
                    status.ContentCode     = ThematicContentID((long)Session["GlobalPlanID"]);
                    status.Date            = DateTime.Now;
                    proxyGP.InsertStatusThematicContent(status);


                    lbl_mensaje.Text = "ÉXITO. Los datos se han guardado correctamente.";
                    ComponentesGraficos1(false);
                    ComponentesGraficos2(true);
                }
                catch (Exception ex)
                {
                    lbl_mensaje.Text = "ÉRROR. Los datos NO se han guardado.";
                }
            }
            else
            {
                lbl_mensaje.Text = "Introduzca datos en los campos marcados con * (asterisco)";
            }
        }
예제 #2
0
 public void InsertThematicContent(ContentThematic entity)
 {
     using (var context = new QualificationsDBEntities())
     {
         context.ContentThematic.Attach(entity);
         context.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Added);
         context.SaveChanges();
     }
 }