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)"; } }
public void UpdateTema(StatusThemeContent entity) { using (var context = new QualificationsDBEntities()) { context.StatusThemeContent.Attach(entity); context.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Modified); context.SaveChanges(); } }
public void InsertStatusThematicContent(StatusThemeContent status) { using (var context = new QualificationsDBEntities()) { context.StatusThemeContent.Attach(status); context.ObjectStateManager.ChangeObjectState(status, System.Data.EntityState.Added); context.SaveChanges(); } }
protected void Button1_Click(object sender, EventArgs e) { StatusThemeContent estado = new StatusThemeContent(); tema = this.GridView1.SelectedRow.Cells[1].Text;; long contentID = ContentID((long)Session["GlobalPlanID"], tema); long statusID = EstadoID(contentID); estado = Entidad(statusID); try { estado.StatusThemeCode = 1; estado.Date = DateTime.Today; UpdateTema(estado); lbl_tema.Text = "ÉXITO. Se ha registrado el avance del Tema: " + tema; Temas((long)Session["GlobalPlanID"]); } catch { lbl_tema.Text = "ERROR. Los datos NO se han guardado"; } }