private void DeleteSelected_Click(object sender, EventArgs e) { progressBar.Maximum = 6; progressBar.Value = 0; progressBar.Value++; int tema = comboBoxTema.SelectedIndex; ListTema memTemaSeleccionado = TemaSeleccionado; try { SandBoxDB.SandBoxEntities SandBoxCtx = new SandBoxDB.SandBoxEntities(); progressBar.Value++; var reg = new SandBoxDB.Rel_ConceptoRespValor() { IdConceptoRespValor = preguntaSeleccionada.IdConceptoRespValor }; SandBoxCtx.Rel_ConceptoRespValor.Attach(reg); SandBoxCtx.Rel_ConceptoRespValor.Remove(reg); progressBar.Value++; SandBoxCtx.SaveChanges(); progressBar.Value++; InicializaCustionario(); progressBar.Value++; TemaSeleccionado = memTemaSeleccionado; ShowCuestionario(TemaSeleccionado.IdTema); comboBoxTema.SelectedIndex = tema; progressBar.Value++; ClearRegistro(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n no se borro el registro"); } progressBar.Value = 0; }
private void listBoxPreguntas_SelectedIndexChanged(object sender, EventArgs e) { disable_Reg_TextChanged(); preguntaSeleccionada = ListaPreguntasTema[listBoxPreguntas.SelectedIndex]; Reg_IdInstitucion = preguntaSeleccionada.Fk_IdInstitucion; Reg_IdTema = preguntaSeleccionada.Fk_IdTema; Reg_IdConcepto = preguntaSeleccionada.Fk_IdConcepto; Reg_IdRespuesta = preguntaSeleccionada.Fk_IdRespuesta; Reg_NumOrden = preguntaSeleccionada.NumOrden; Reg_EsDeterminante = preguntaSeleccionada.EsDeterminante; Reg_ValorRespuesta = preguntaSeleccionada.ValorRespuesta; Reg_ValorMinimo = preguntaSeleccionada.ValorMinimo; Reg_ValorMaximo = preguntaSeleccionada.ValorMaximo; Reg_Comentario = preguntaSeleccionada.Comentario; Reg_EstatusRegistro = preguntaSeleccionada.EstatusRegistro; Reg_IdUsuarioRegistro = preguntaSeleccionada.Fk_IdUsuarioRegistro; Reg_FechaRegistro = preguntaSeleccionada.FechaRegistro; enable_Reg_TextChanged(); }
private void buttonInsertRelacion_Click(object sender, EventArgs e) { progressBar.Maximum = 11; progressBar.Value = 0; progressBar.Value++; if (Reg_IdTema == null) { MessageBox.Show("Seleccionar el tema al que pertenece la pregunta"); return; } progressBar.Value++; if (Reg_EsDeterminante == null) { MessageBox.Show("Definir si es determinante o no"); return; } progressBar.Value++; if (Reg_ValorMinimo == null) { MessageBox.Show("Definir el valor mínimo"); return; } progressBar.Value++; if (Reg_ValorMaximo == null) { MessageBox.Show("Definir el valor máximo"); return; } progressBar.Value++; if (Reg_EstatusRegistro == null) { MessageBox.Show("Definir el estatus del registro"); return; } progressBar.Value++; if (Reg_IdUsuarioRegistro == -1) { MessageBox.Show("Definir Id Usuario Registro"); return; } progressBar.Value++; if (RegistroModificado) { int tema = comboBoxTema.SelectedIndex; ListTema memTemaSeleccionado = TemaSeleccionado; try { SandBoxDB.SandBoxEntities SandBoxCtx = new SandBoxDB.SandBoxEntities(); progressBar.Value++; SandBoxDB.Rel_ConceptoRespValor NuevaRelación = new SandBoxDB.Rel_ConceptoRespValor() { Fk_IdInstitucion = Reg_IdInstitucion, Fk_IdTema = (byte)Reg_IdTema, Fk_IdConcepto = Reg_IdConcepto, Fk_IdRespuesta = Reg_IdRespuesta, NumOrden = Reg_NumOrden, EsDeterminante = (bool)Reg_EsDeterminante, ValorRespuesta = Reg_ValorRespuesta, ValorMinimo = (decimal)Reg_ValorMinimo, ValorMaximo = (decimal)Reg_ValorMaximo, Comentario = Reg_Comentario, EstatusRegistro = (bool)Reg_EstatusRegistro, Fk_IdUsuarioRegistro = Reg_IdUsuarioRegistro, FechaRegistro = DateTime.Today }; SandBoxCtx.Rel_ConceptoRespValor.Add(NuevaRelación); progressBar.Value++; SandBoxCtx.SaveChanges(); progressBar.Value++; InicializaCustionario(); TemaSeleccionado = memTemaSeleccionado; ShowCuestionario(TemaSeleccionado.IdTema); progressBar.Value++; comboBoxTema.SelectedIndex = tema; ClearRegistro(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n no se inserto el registro"); } } progressBar.Value = 0; }