protected override void SetCellsDataSource(string gridName) { switch (gridName) { case "Material_Grid": { foreach (DataGridViewRow row in Material_Grid.Rows) { if (row.IsNewRow) { continue; } if (lista_sources.Count >= row.Index + 1) { continue; } Material_Plan info = (Material_Plan)row.DataBoundItem; if (info != null) { RevisionMaterialInfo revision = _revisiones.GetItem(info.OidRevision); if (revision != null) { lista_sources.Add(_combo_materiales.GetFilteredChilds(revision.OidMaterial)); ((DataGridViewComboBoxCell)row.Cells["Version_CBC"]).DataSource = lista_sources[row.Index]; } } } } break; } }
/// <summary> /// Asigna los datos de origen para controles que dependen de otros /// </summary> /// <param name="controlName"></param> protected override void SetDependentControlSource(string controlName) { switch (controlName) { case "Modulo_CB": { if (Modulo_CB.SelectedItem != null && ((ComboBoxSource)Modulo_CB.SelectedItem).Oid != 0) { Datos_Temas.DataSource = _combo_modulos.GetFilteredChilds(((ComboBoxSource)Modulo_CB.SelectedItem).Oid); Tema_CB.SelectedItem = _combo_modulos.Childs.Buscar(_pregunta.OidTema); } } break; case "Tema_CB": { if (_pregunta != null) { TemaInfo tema = _temas.GetItem(_pregunta.OidTema); if (tema.Desarrollo) { Tipo_CB.SelectedIndex = 1; } else { Tipo_CB.SelectedIndex = 2; } Nivel_TB.Text = tema.Nivel.ToString(); } } break; } }
private void Submodulo_CB_SelectedValueChanged(object sender, EventArgs e) { if (Submodulo_CB.SelectedItem != null && ((ComboBoxSource)Submodulo_CB.SelectedItem).Oid != 0) { Datos_Temas.DataSource = _combo_submodulos.GetFilteredChilds(((ComboBoxSource)Submodulo_CB.SelectedItem).Oid); } }
private void Alumnos_Grid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (Alumnos_Grid.Columns[e.ColumnIndex].Name == "Promocion_CBC") { if (Alumnos_Grid["Promocion_CBC", e.RowIndex].Value != null) { //se está modificando una línea ya existente if (lista_sources.Count > e.RowIndex) { lista_sources[e.RowIndex] = _combo_promociones.GetFilteredChilds((long)Alumnos_Grid["Promocion_CBC", e.RowIndex].Value); } else //hay que añadir un nuevo datasource a la lista { lista_sources.Add(_combo_promociones.GetFilteredChilds((long)Alumnos_Grid["Promocion_CBC", e.RowIndex].Value)); } ((DataGridViewComboBoxCell)(Alumnos_Grid["Alumno_CBC", e.RowIndex])).DataSource = lista_sources[e.RowIndex]; } } }
private void Modulo_CB_SelectedIndexChanged(object sender, EventArgs e) { if (Modulo_CB.SelectedItem != null) { Datos_Temas.DataSource = _combo_modulos.GetFilteredChilds(CurrentModuloOid); Tema_CB.SelectedItem = _combo_modulos.Childs[0]; FilterByModuloAction(); } }
/// <summary> /// Asigna los datos de origen para controles que dependen de otros /// </summary> /// <param name="controlName"></param> protected void SetDependentControlSource(string controlName) { switch (controlName) { case "Modulo_CB": { if (Datos_Modulos.Current != null) { Datos_Submodulos.DataSource = _combo_modulos.GetFilteredChilds(((ComboBoxSource)Modulo_CB.SelectedItem).Oid); } } break; } }
/// <summary> /// Asigna los datos de origen para controles que dependen de otros /// </summary> /// <param name="controlName"></param> protected override void SetDependentControlSource(string controlName) { switch (controlName) { case "Plan_CB": { //moleQule.Library.Timer t = new moleQule.Library.Timer(); if (Datos_Planes.Current != null && Plan_CB.SelectedItem != null) { Datos_Promociones.DataSource = _combo_planes.GetFilteredChilds(((ComboBoxSource)Plan_CB.SelectedItem).Oid); Generar_BT.Enabled = true; } // t.Record("Plan_CB"); //MessageBox.Show(t.GetCronos()); } break; case "Promocion_CB": { //moleQule.Library.Timer t = new moleQule.Library.Timer(); if (Datos_Promociones.Current != null) { if (Promocion_CB.SelectedItem != null) { _entity.OidPromocion = ((ComboBoxSource)Promocion_CB.SelectedItem).Oid; } Generar_BT.Enabled = true; } //t.Record("Promocion_CB"); //MessageBox.Show(t.GetCronos()); } break; case "Semana_GB": { PromocionInfo promo = null; if (Promocion_CB.SelectedItem != null) { promo = PromocionInfo.Get(((ComboBoxSource)Promocion_CB.SelectedItem).Oid, true); } if (promo != null) { CLB_1.Items[0] = "08:00 - 9:00"; CLB_1.Items[1] = "09:00 - 10:00"; CLB_1.Items[2] = "10:00 - 11:00"; CLB_1.Items[3] = "11:00 - 12:00"; CLB_1.Items[4] = "12:00 - 13:00"; CLB_1.Items[5] = "13:00 - 14:00"; CLB_1.Items[6] = "14:00 - 15:00"; CLB_1.Items[7] = "15:00 - 16:00"; CLB_2.Items[0] = "16:00 - 17:00"; CLB_2.Items[1] = "17:00 - 18:00"; CLB_2.Items[2] = "18:00 - 19:00"; CLB_2.Items[3] = "19:00 - 20:00"; CLB_2.Items[4] = "20:00 - 21:00"; CLB_2.Items[5] = "21:00 - 22:00"; CLB_1.SetItemChecked(0, promo.H8AM); CLB_1.SetItemChecked(1, promo.H0); CLB_1.SetItemChecked(2, promo.H1); CLB_1.SetItemChecked(3, promo.H2); CLB_1.SetItemChecked(4, promo.H3); CLB_1.SetItemChecked(5, promo.H4); CLB_1.SetItemChecked(6, promo.H5); CLB_1.SetItemChecked(7, promo.H6); CLB_2.SetItemChecked(0, promo.H7); CLB_2.SetItemChecked(1, promo.H8); CLB_2.SetItemChecked(2, promo.H9); CLB_2.SetItemChecked(3, promo.H10); CLB_2.SetItemChecked(4, promo.H11); CLB_2.SetItemChecked(5, promo.H12); _entity.Configuracion = Sesiones_Promociones.NewChildList(); foreach (Sesion_PromocionInfo item in promo.Sesiones) { Sesion_Promocion copia_conf = Sesion_Promocion.NewChild(_entity); copia_conf.HoraInicio = item.HoraInicio; copia_conf.Sabado = item.Sabado; copia_conf.NHoras = item.NHoras; copia_conf.Hora = item.Hora; _entity.Configuracion.AddItem(copia_conf); } Datos_Sesiones.DataSource = _entity.Configuracion; } } break; case "Sabado_GB": { PromocionInfo promo = null; if (Promocion_CB.SelectedItem != null) { promo = _promociones.GetItem(((ComboBoxSource)Promocion_CB.SelectedItem).Oid); } if (promo != null) { CLB_3.Items[0] = "09:00 - 10:00"; CLB_3.Items[1] = "10:00 - 11:00"; CLB_3.Items[2] = "11:00 - 12:00"; CLB_3.Items[3] = "12:00 - 13:00"; CLB_3.Items[4] = "13:00 - 14:00"; CLB_3.SetItemChecked(0, promo.HS0); CLB_3.SetItemChecked(1, promo.HS1); CLB_3.SetItemChecked(2, promo.HS2); CLB_3.SetItemChecked(3, promo.HS3); CLB_3.SetItemChecked(4, promo.HS4); } } break; } }
private void Submodulo_Instructor_Grid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (this is InstructorUIForm) { switch (Submodulo_Instructor_Grid.Columns[e.ColumnIndex].Name) { case ("Modulo_CBC"): { if (Submodulo_Instructor_Grid["Modulo_CBC", e.RowIndex].Value != null) { if (Datos_Promociones.Current != null && ((Instructor_Promocion)Datos_Promociones.Current).OidPromocion > 0) { //se está modificando una línea ya existente if (lista_sources.Count > e.RowIndex) { lista_sources[e.RowIndex] = _combo_modulos.GetFilteredChilds((long)Submodulo_Instructor_Grid["Modulo_CBC", e.RowIndex].Value); } else //hay que añadir un nuevo datasource a la lista { lista_sources.Add(_combo_modulos.GetFilteredChilds((long)Submodulo_Instructor_Grid["Modulo_CBC", e.RowIndex].Value)); } ((DataGridViewComboBoxCell)(Submodulo_Instructor_Grid["Submodulo_CBC", e.RowIndex])).DataSource = lista_sources[e.RowIndex]; ((Submodulo_Instructor_Promocion)Submodulo_Instructor_Grid.Rows[e.RowIndex].DataBoundItem).OidPromocion = ((Instructor_Promocion)Datos_Promociones.Current).OidPromocion; } } } break; case ("Submodulo_CBC"): { if (Datos_Promociones.Current == null) { return; } Instructor_Promocion selected = Entity.Promociones.GetItem(((Instructor_Promocion)Datos_Promociones.Current).Oid); if (selected == null) { foreach (Instructor_Promocion item in Entity.Promociones) { if (item.Oid == ((Instructor_Promocion)Datos_Promociones.Current).Oid) { selected = item; break; } } } Submodulos_Instructores_Promociones lista = selected.Submodulos; if (lista.Count <= e.RowIndex) { lista.Add((Submodulo_Instructor_Promocion)Submodulo_Instructor_Grid.Rows[e.RowIndex].DataBoundItem); } lista[e.RowIndex].OidInstructorPromocion = ((Instructor_Promocion)Datos_Promociones.Current).Oid; lista[e.RowIndex].OidInstructor = Entity.Oid; } break; } } }
/// <summary> /// Asigna los datos de origen para controles que dependen de otros /// </summary> /// <param name="controlName"></param> protected override void SetDependentControlSource(string controlName) { switch (controlName) { case "Modulo_CB": { if (Datos_Modulos.Current != null && Modulo_CB.SelectedItem != null) { Datos_Submodulos.DataSource = _combo_modulos.GetFilteredChilds(((ComboBoxSource)Modulo_CB.SelectedItem).Oid); } } break; case "Submodulo_CB": { if (Submodulo_CB.SelectedItem != null && ((ComboBoxSource)Submodulo_CB.SelectedItem).Oid != 0) { Datos_Temas.DataSource = _combo_modulos.Childs.GetFilteredChilds(((ComboBoxSource)Submodulo_CB.SelectedItem).Oid); } } break; case "Tema_CB": { if (_temas != null && Tema_CB.SelectedItem != null) { TemaInfo tema = _temas.GetItem(((ComboBoxSource)Tema_CB.SelectedItem).Oid); if (tema != null && _entity != null) { _entity.OidSubmodulo = tema.OidSubmodulo; _entity.OidTema = tema.Oid; Nivel_TB.Text = tema.Nivel.ToString(); _entity.Nivel = tema.Nivel; if (tema.Desarrollo) { Tipo_TB.Text = ETipoPregunta.Desarrollo.ToString(); _entity.Tipo = ETipoPregunta.Desarrollo.ToString(); Respuestas_Grid.Visible = false; Respuestas_Grid.Enabled = false; Respuestas_BT.Visible = false; Respuestas_BT.Enabled = false; ModeloRespuesta_TB.Visible = true; ModeloRespuesta_TB.Enabled = true; ModeloRespuesta_LB.Visible = true; ModeloRespuesta_LB.Enabled = true; ModeloRespuesta_BT.Visible = true; ModeloRespuesta_BT.Enabled = true; ModeloRespuestaView_BT.Visible = true; ModeloRespuestaView_BT.Enabled = true; } else { Tipo_TB.Text = ETipoPregunta.Test.ToString(); _entity.Tipo = ETipoPregunta.Test.ToString(); ModeloRespuesta_TB.Visible = false; ModeloRespuesta_TB.Enabled = false; ModeloRespuesta_LB.Visible = false; ModeloRespuesta_LB.Enabled = false; ModeloRespuestaView_BT.Visible = false; ModeloRespuestaView_BT.Enabled = false; ModeloRespuesta_BT.Visible = false; ModeloRespuesta_BT.Enabled = false; Respuestas_Grid.Visible = true; Respuestas_Grid.Enabled = true; Respuestas_BT.Visible = true; Respuestas_BT.Enabled = true; } } } } break; } }