protected void DoRefresh() { try { PgMng.Reset(8, 1, Resources.Messages.LOADING_DATA, this); for (int i = 1; i < 3; i++) { _practicas[i] = ClasePracticaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid, i); } PgMng.Grow(); _teoricas = ClaseTeoricaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid); PgMng.Grow(); _extras = ClaseExtraList.GetDisponiblesList(Entity.OidPromocion, Entity.Oid); PgMng.Grow(); profesores_encargados.GetEncargados(Entity.OidPlan, Entity.OidPromocion); PgMng.Grow(); _combo_clases = Submodulo.GetComboClases(_teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras); Datos_Clases.DataSource = _combo_clases; PgMng.Grow(); _instructores_asignados = Sesion.CargaSesionesProfesores(Entity.FechaInicial, Entity.OidPromocion); PgMng.Grow(); _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); PgMng.Grow(); } catch (Exception ex) { throw ex; } finally { PgMng.FillUp(); } }
protected void RefreshHorario() { try { PgMng.Reset(7, 1, Resources.Messages.UPDATING_PROMOCION_HORARIO, this); for (int i = 1; i < 3; i++) { _practicas[i] = ClasePracticaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid, i); } _teoricas = ClaseTeoricaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid); _extras = ClaseExtraList.GetDisponiblesList(Entity.OidPromocion, Entity.Oid); PgMng.Grow(string.Empty, "clases"); _instructores_asignados = Sesion.CargaSesionesProfesores(Entity.FechaInicial, Entity.OidPromocion); _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); _disponibilidades = _profesores.GetDisponibilidadesProfesores(_entity.FechaInicial); PgMng.Grow(string.Empty, "Instructores y profesores"); //Se rellena el horario //_lista_sesiones = new ListaSesiones(Entity.FechaInicial); //ResetSesiones(false); PgMng.Grow(string.Empty, "lista sesiones"); Horario.MuestraSesiones(Entity.Sesions, _lista_sesiones, _teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras); _combo_clases = Submodulo.GetComboClases(_teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras); _combo_clases.Childs = _combo_instructores; Datos_Clases.DataSource = _combo_clases; PgMng.Grow(string.Empty, "combo_clases"); } finally { PgMng.FillUp(); } }
protected override bool CreaSesiones() { //Sesions lista = _entity.Sesions; //_entity.Sesions = Sesions.NewChildList(); PgMng.Reset(72, 1, Resources.Messages.GENERANDO_SESIONES, this); try { if (_profesores == null) { _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); } PgMng.Grow(); foreach (SesionAuxiliar item in _lista_sesiones) { bool encontrada = false; foreach (Sesion ses in _entity.Sesions) { if (ses.Fecha.ToShortDateString() == item.Fecha.ToShortDateString() && ses.Hora.ToShortTimeString() == item.Hora.ToShortTimeString()) { /*if (item.OidProfesor == 0) * { * foreach (InstructorInfo p in _profesores) * { * bool salir = false; * foreach (Instructor_PromocionInfo pr in p.Promociones) * { * if (pr.OidPromocion == Entity.OidPromocion) * { * foreach (Submodulo_Instructor_PromocionInfo sub in pr.Submodulos) * { * if (sub.OidSubmodulo == item.OidSubmodulo && sub.Prioridad == 1) * { * ses.OidProfesor = p.Oid; * salir = true; * break; * } * } * } * } * if (salir) break; * } * } * else*/ ses.OidProfesor = item.OidProfesor; ses.OidClaseTeorica = item.OidClaseTeorica; ses.OidClasePractica = item.OidClasePractica; ses.OidClaseExtra = item.OidClaseExtra; ses.Fecha = DateTime.Parse(item.Fecha.ToShortDateString() + " " + ses.Fecha.ToShortTimeString()); ses.Hora = item.Hora; ses.Forzada = item.Forzada; ses.Estado = item.Estado; ses.Grupo = item.Grupo; //_entity.Sesions.AddItem(ses); encontrada = true; break; } } if (!encontrada) { Sesion nueva = Sesion.NewChild(_entity); nueva.OidProfesor = item.OidProfesor; nueva.OidClaseTeorica = item.OidClaseTeorica; nueva.OidClasePractica = item.OidClasePractica; nueva.OidClaseExtra = item.OidClaseExtra; nueva.Fecha = item.Fecha; nueva.Hora = item.Hora; nueva.Forzada = item.Forzada; nueva.Estado = item.Estado; nueva.Grupo = item.Grupo; nueva.MarkItemChild(); _entity.Sesions.AddItem(nueva); } PgMng.Grow(); } return(true); } catch { return(false); } finally { PgMng.FillUp(); } }
protected override void DoHorario() { try { PgMng.Reset(12, 1, Resources.Messages.UPDATING_PROMOCION_HORARIO, this); //Se rellena lo referente al plan if (_planes == null) { return; } if (Entity.Plan == null) { Plan_CB.Text = _planes.GetItem(Entity.OidPlan).Nombre; } else { Plan_CB.Text = Entity.Plan; } PgMng.Grow(string.Empty, "Plan"); //Se rellena lo referente a la promoción if (_promociones == null) { return; } if (Entity.Promocion != string.Empty && Entity.Promocion != null) { Promocion_CB.Text = Entity.Promocion; } else { Promocion_CB.Text = _promociones.GetItem(Entity.OidPromocion).Nombre; } PgMng.Grow(string.Empty, "Promocion"); DateTime hoy = DateTime.Today; // si la fecha del horario que se va a cargar es anterior a la del día en el que se edita // no se tiene en cuenta si las clases sesiones planificadas se han impartido o no para meterlas // en las lista, ya que de ningún modo se va a permitir modificar un horario antiguo if (hoy.Date >= Entity.FechaInicial) { hoy = Entity.FechaInicial; } else { while (hoy.DayOfWeek != DayOfWeek.Monday) { hoy = hoy.AddDays(-1); } } PgMng.Grow(string.Empty, "Hoy"); for (int i = 1; i < 3; i++) { if (_practicas.Count <= i) { _practicas.Add(ClasePracticaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid, i)); } } if (_teoricas == null) { _teoricas = ClaseTeoricaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid); } if (_extras == null) { _extras = ClaseExtraList.GetDisponiblesList(Entity.OidPromocion, Entity.Oid); } PgMng.Grow(string.Empty, "clases"); _day = Fecha_DTP.Value; while (_day.DayOfWeek != System.DayOfWeek.Monday) { _day = _day.AddDays(-1); } this.Text = Resources.Labels.HORARIO_ADD_TITLE + "De Lunes, " + _day.ToShortDateString() + " A Sábado, " + _day.AddDays(5).ToShortDateString(); if (_day < Fecha_DTP.MinDate) { Fecha_DTP.Value = Fecha_DTP.MinDate; } else { Fecha_DTP.Value = _day; } PgMng.Grow(string.Empty, "Fecha_DTP"); if (_instructores_asignados == null) { _instructores_asignados = Sesion.CargaSesionesProfesores(Entity.FechaInicial, Entity.OidPromocion); } if (_profesores == null) { _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); } _disponibilidades = _profesores.GetDisponibilidadesProfesores(_entity.FechaInicial); PgMng.Grow(string.Empty, "Instructores y profesores"); CLB_1.SetItemChecked(0, Entity.H8AM); CLB_1.SetItemChecked(1, Entity.H0); CLB_1.SetItemChecked(2, Entity.H1); CLB_1.SetItemChecked(3, Entity.H2); CLB_1.SetItemChecked(4, Entity.H3); CLB_1.SetItemChecked(5, Entity.H4); CLB_1.SetItemChecked(6, Entity.H5); CLB_1.SetItemChecked(7, Entity.H6); CLB_1.SetItemChecked(8, Entity.H7); CLB_1.SetItemChecked(9, Entity.H8); CLB_1.SetItemChecked(10, Entity.H9); CLB_1.SetItemChecked(11, Entity.H10); CLB_1.SetItemChecked(12, Entity.H11); CLB_1.SetItemChecked(13, Entity.H12); CLB_2.SetItemChecked(0, Entity.HS0); CLB_2.SetItemChecked(1, Entity.HS1); CLB_2.SetItemChecked(2, Entity.HS2); CLB_2.SetItemChecked(3, Entity.HS3); CLB_2.SetItemChecked(4, Entity.HS4); PgMng.Grow(string.Empty, "Lista horas"); //Se rellena la fecha Fecha_DTP.Value = Entity.FechaInicial; this.Text = Resources.Labels.HORARIO_ADD_TITLE + "De Lunes, " + Entity.FechaInicial.ToShortDateString() + " A Sábado, " + Entity.FechaInicial.AddDays(5).ToShortDateString(); PgMng.Grow(string.Empty, "string fechas"); //Se rellena el horario if (_lista_sesiones == null) { _lista_sesiones = new ListaSesiones(Entity.FechaInicial); //ResetSesiones(false); PgMng.Grow(string.Empty, "lista sesiones"); Horario.MuestraSesiones(Entity.Sesions, _lista_sesiones, _teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras); } //_lista_sesiones = Entity.SetSesionesActivas(_lista_sesiones); Confirmar_BT.Enabled = true; Marcar_BT.Enabled = true; Generar_BT.Enabled = true; Clean_BT.Enabled = true; PgMng.Grow(string.Empty, "MuestraSesiones"); if (_combo_clases == null) { _combo_clases = Submodulo.GetComboClases(_teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras); } _combo_clases.Childs = _combo_instructores; Datos_Clases.DataSource = _combo_clases; PgMng.Grow(string.Empty, "combo_clases"); Lunes_LB.Text = "LUNES (" + EntityInfo.FechaInicial.Day.ToString("00") + "/" + Entity.FechaInicial.Month.ToString("00") + ")"; Martes_LB.Text = "MARTES (" + EntityInfo.FechaInicial.AddDays(1).Day.ToString("00") + "/" + Entity.FechaInicial.AddDays(1).Month.ToString("00") + ")"; Miercoles_LB.Text = "MIÉRCOLES (" + EntityInfo.FechaInicial.AddDays(2).Day.ToString("00") + "/" + Entity.FechaInicial.AddDays(2).Month.ToString("00") + ")"; Jueves_LB.Text = "JUEVES (" + EntityInfo.FechaInicial.AddDays(3).Day.ToString("00") + "/" + Entity.FechaInicial.AddDays(3).Month.ToString("00") + ")"; Viernes_LB.Text = "VIERNES (" + EntityInfo.FechaInicial.AddDays(4).Day.ToString("00") + "/" + Entity.FechaInicial.AddDays(4).Month.ToString("00") + ")"; Sabado_LB.Text = "SÁBADO (" + EntityInfo.FechaInicial.AddDays(5).Day.ToString("00") + "/" + Entity.FechaInicial.AddDays(5).Month.ToString("00") + ")"; } finally { PgMng.FillUp(); } }
protected override bool CreaSesiones() { int libres = 0; foreach (SesionAuxiliar item in _lista_sesiones) { if (_profesores == null) { _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); } if (item.Estado > 1 && item.OidClaseTeorica > -1) { Sesion sesion = Sesion.NewChild(_entity); /*if (item.OidProfesor == 0) * { * bool salir = false; * * foreach (InstructorInfo p in _profesores) * { * foreach (Instructor_PromocionInfo pr in p.Promociones) * { * if (pr.OidPromocion == Entity.OidPromocion) * { * foreach (Submodulo_Instructor_PromocionInfo sub in pr.Submodulos) * { * if (sub.OidSubmodulo == item.OidSubmodulo && sub.Prioridad == 1) * { * sesion.OidProfesor = p.Oid; * salir = true; * break; * } * } * } * } * if (salir) break; * } * } * else*/ sesion.OidProfesor = item.OidProfesor; sesion.OidClaseTeorica = item.OidClaseTeorica; sesion.OidClasePractica = item.OidClasePractica; sesion.OidClaseExtra = item.OidClaseExtra; sesion.Fecha = item.Fecha; sesion.Hora = item.Hora; sesion.Forzada = item.Forzada; sesion.Estado = item.Estado; sesion.Grupo = item.Grupo; sesion.MarkItemChild(); _entity.Sesions.AddItem(sesion); } else { Sesion sesion = Sesion.NewChild(_entity); sesion.OidClaseTeorica = item.OidClaseTeorica; sesion.OidClasePractica = 0; sesion.OidClaseExtra = 0; sesion.Fecha = item.Fecha; sesion.Hora = item.Hora; sesion.Forzada = item.Forzada; sesion.Estado = 1; sesion.Grupo = item.Grupo; sesion.MarkItemChild(); libres++; _entity.Sesions.AddItem(sesion); } //if (libres == 70) return false; } return(true); }
protected override void DoPromociones() { try { PgMng.Reset(15, 1, Resources.Messages.UPDATING_PROMOCION_HORARIO, this); DateTime hoy = DateTime.Today; // si la fecha del horario que se va a cargar es anterior a la del día en el que se edita // no se tiene en cuenta si las clases sesiones planificadas se han impartido o no para meterlas // en las lista, ya que de ningún modo se va a permitir modificar un horario antiguo if (hoy.Date >= Entity.FechaInicial) { hoy = Entity.FechaInicial; } else { while (hoy.DayOfWeek != DayOfWeek.Monday) { hoy = hoy.AddDays(-1); } } for (int i = 1; i < 3; i++) { ClasePracticaList practicas = ClasePracticaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid, i); if (_practicas.Count <= i) { _practicas.Add(practicas); } else { _practicas[i] = practicas; } PgMng.Grow(string.Empty, "Rellena clases prácticas grupo " + i.ToString()); } _teoricas = ClaseTeoricaList.GetDisponiblesList(Entity.OidPlan, Entity.OidPromocion, Entity.Oid); PgMng.Grow(string.Empty, "Rellena clases teóricas"); _extras = ClaseExtraList.GetDisponiblesList(Entity.OidPromocion, Entity.Oid); PgMng.Grow(string.Empty, "Rellena clases extra"); //_combo_clases = Submodulo.GetComboClases(_teoricas, ClasePracticaList.Merge(_practicas[1],_practicas[2]), _extras); //pmg.Grow("combo clases"); //pmg.Grow("Rellena fecha"); while (_day.DayOfWeek != System.DayOfWeek.Monday) { _day = _day.AddDays(-1); } Fecha_DTP.Value = _day; DoSetFecha(); if (Promocion_CB.SelectedItem != null) { //ResetSesiones(false); PgMng.Grow(string.Empty, "reset sesiones"); _profesores = InstructorList.GetInstructoresHorariosList(((ComboBoxSource)Promocion_CB.SelectedItem).Oid, EntityInfo.FechaInicial, EntityInfo.FechaFinal); } if (_profesores != null) { _disponibilidades = _profesores.GetDisponibilidadesProfesores(_day); } PgMng.Grow(string.Empty, "_profesores"); if (Entity.OidPromocion != 0) { PromocionInfo promocion = _promociones.GetItem(Entity.OidPromocion); _entity.Promocion = promocion.Nombre; PlanEstudiosInfo plan = _planes.GetItem(promocion.OidPlan); _entity.Plan = plan.Nombre; PgMng.Grow(string.Empty, "Promociones"); //_profesores = InstructorList.GetInstructoresHorariosList(Entity.OidPromocion); PgMng.Grow(string.Empty, "GetInstructoresHorarioList"); CLB_1.SetItemChecked(0, promocion.H8AM); CLB_1.SetItemChecked(1, promocion.H0); CLB_1.SetItemChecked(2, promocion.H1); CLB_1.SetItemChecked(3, promocion.H2); CLB_1.SetItemChecked(4, promocion.H3); CLB_1.SetItemChecked(5, promocion.H4); CLB_1.SetItemChecked(6, promocion.H5); CLB_1.SetItemChecked(7, promocion.H6); CLB_1.SetItemChecked(8, promocion.H7); CLB_1.SetItemChecked(9, promocion.H8); CLB_1.SetItemChecked(10, promocion.H9); CLB_1.SetItemChecked(11, promocion.H10); CLB_1.SetItemChecked(12, promocion.H11); CLB_1.SetItemChecked(13, promocion.H12); CLB_2.SetItemChecked(0, promocion.HS0); CLB_2.SetItemChecked(1, promocion.HS1); CLB_2.SetItemChecked(2, promocion.HS2); CLB_2.SetItemChecked(3, promocion.HS3); CLB_2.SetItemChecked(4, promocion.HS4); PgMng.Grow(string.Empty, "SetItemChecked"); Entity.CopiaConfiguracion(promocion); } PgMng.Grow(string.Empty, "Inicializa horas disponibles"); if (!_generado) { Generar_BT.Enabled = true; } Instructores_BT.Enabled = true; Planes_BT.Enabled = true; Disponibilidades_BT.Enabled = true; if (_lista_sesiones == null) { _lista_sesiones = new ListaSesiones(Entity.FechaInicial); } RellenaCasillas(); } finally { PgMng.FillUp(); } }
public override ComboBoxSourceList RellenaComboInstructores(long oid, long tipo, int index, long oid_submodulo) { long oid_clase = oid; if (oid_clase <= 0) { ComboBoxSourceList combo_list = new ComboBoxSourceList(); combo_list.Add(new ComboBoxSource(0, "")); Datos_Instructores.DataSource = combo_list; return(combo_list); } List <Submodulo_Instructor_PromocionInfo> list = new List <Submodulo_Instructor_PromocionInfo>(); if (_profesores == null) { _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); } if (_disponibilidades == null) { _disponibilidades = _profesores.GetDisponibilidadesProfesores(EntityInfo.FechaInicial); } DisponibilidadInfo disp = null; foreach (InstructorInfo profesor in _profesores) { if (Horario.ProfesorLibre(_instructores_asignados, index, profesor.Oid, _lista_sesiones, _profesores, -1, EntityInfo.FechaInicial, _disponibilidades) && _disponibilidades.TryGetValue(profesor.Oid, out disp) && disp.Semana[index]) { Instructor_PromocionInfo promo = profesor.Promociones.GetItemByProperty("OidPromocion", EntityInfo.OidPromocion); if (tipo != 2) { Submodulo_Instructor_PromocionInfo sub = promo != null?promo.Submodulos.GetItemByProperty("OidSubmodulo", oid_submodulo) : null; if (sub != null) { list.Add(sub); } } else { Submodulo_Instructor_PromocionInfo sub = promo != null?promo.Submodulos.GetItemByProperty("OidModulo", _lista_sesiones[index].OidModulo) : null; if (sub != null) { list.Add(sub); } } } } //foreach (Submodulo_Instructor_PromocionInfo info in _submodulos) //{ // if (info.OidSubmodulo == oid_submodulo && info.OidPromocion == EntityInfo.OidPromocion) // { // if (Horario.ProfesorLibre(_instructores_asignados, index, info.OidInstructor, // _lista_sesiones, _profesores, -1, EntityInfo.FechaInicial, _disponibilidades)) // list.Add(info); // } //} Submodulo_Instructor_PromocionList lista = Submodulo_Instructor_PromocionList.GetChildList(list); _combo_instructores = new Library.Instruction.HComboBoxSourceList(lista, _profesores); _combo_clases.Childs = _combo_instructores; Datos_Instructores.DataSource = _combo_clases.Childs; return(_combo_clases.Childs); }
protected void DoNuevoHorario() { try { PgMng.Reset(10, 1, Resources.Messages.CREANDO_HORARIO, this); if (this is HorarioAddForm && Horario.ExisteHorario(Entity.OidPlan, Entity.OidPromocion, Entity.FechaInicial)) { MessageBox.Show("Ya existe un horario para la promoción y fecha indicadas, si lo desea modifique el que ya existe."); PgMng.FillUp(); return; } profesores_encargados.GetEncargados(Entity.OidPlan, Entity.OidPromocion); PgMng.Grow(); _combo_clases = Submodulo.GetComboClases(_teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras); Datos_Clases.DataSource = _combo_clases; PgMng.Grow(); _instructores_asignados = Sesion.CargaSesionesProfesores(Entity.FechaInicial, Entity.OidPromocion); PgMng.Grow(); if (_profesores == null) { _profesores = InstructorList.GetInstructoresHorariosList(EntityInfo.OidPromocion, EntityInfo.FechaInicial, EntityInfo.FechaFinal); } PgMng.Grow(); CleanAction(); PgMng.Grow(string.Empty, "CleanAction"); if (_generado) { ResetNoConfirmadas(); } PgMng.Grow(string.Empty, "ResetNoConfirmadas"); if (_lista_sesiones == null) { _lista_sesiones = new ListaSesiones(Entity.FechaInicial); } if (!Entity.FechaInicial.Date.Equals(_lista_sesiones[0].Fecha.Date)) { DateTime fecha = Entity.FechaInicial; for (int i = 0; i < 70; i += 14) { _lista_sesiones[i].Fecha = fecha; _lista_sesiones[i + 1].Fecha = fecha; _lista_sesiones[i + 2].Fecha = fecha; _lista_sesiones[i + 3].Fecha = fecha; _lista_sesiones[i + 4].Fecha = fecha; _lista_sesiones[i + 5].Fecha = fecha; _lista_sesiones[i + 6].Fecha = fecha; _lista_sesiones[i + 7].Fecha = fecha; _lista_sesiones[i + 8].Fecha = fecha; _lista_sesiones[i + 9].Fecha = fecha; _lista_sesiones[i + 10].Fecha = fecha; _lista_sesiones[i + 11].Fecha = fecha; _lista_sesiones[i + 12].Fecha = fecha; _lista_sesiones[i + 13].Fecha = fecha; fecha = fecha.AddDays(1); } for (int i = 70; i < 75; i++) { _lista_sesiones[i].Fecha = fecha; } } _lista_sesiones = Entity.SetSesionesActivas(_lista_sesiones); PgMng.Grow(string.Empty, "Entity.SetSesionesActivas"); decimal n_practicas = 11; if (Practicas_CB.Checked) { n_practicas = NPracticas.Value; } HorarioController controlador = new HorarioController(_entity, _lista_sesiones, _teoricas, _practicas, _extras, _profesores, profesores_encargados, _instructores_asignados, _disponibilidades, n_practicas, DiasSuplente.Value); controlador.Rules[(int)TRule.MismoInstructorMismaSesion] = !MismoInstructorMismaSesion_CB.Checked; controlador.Rules[(int)TRule.MismoInstructorMismoDia] = !MismoInstructorMismoDia_CB.Checked; controlador.GeneraHorario(_no_asignables); PgMng.Grow(string.Empty, "Generación de horario"); RellenaCasillas(); PgMng.Grow(string.Empty, "Rellenar Casillas"); Completar_BT.Enabled = false; Marcar_BT.Enabled = true; Clean_BT.Enabled = true; if (this is HorarioEditForm) { Confirmar_BT.Enabled = true; } _generado = true; } catch (Exception ex) { throw ex; } finally { PgMng.FillUp(); } }