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();
            }
        }
Esempio n. 2
0
        protected void DoHorario()
        {
            try
            {
                PgMng.Reset(12, 1, Resources.Messages.UPDATING_PROMOCION_HORARIO, this);
                //Se rellena lo referente al plan
                if (_planes == null)
                {
                    return;
                }

                if (EntityInfo.Plan == null)
                {
                    Plan_CB.Text = _planes.GetItem(EntityInfo.OidPlan).Nombre;
                }
                else
                {
                    Plan_CB.Text = EntityInfo.Plan;
                }
                PgMng.Grow(string.Empty, "Plan");

                //Se rellena lo referente a la promoción
                if (_promociones == null)
                {
                    return;
                }

                if (EntityInfo.Promocion != string.Empty && EntityInfo.Promocion != null)
                {
                    Promocion_CB.Text = EntityInfo.Promocion;
                }
                else
                {
                    Promocion_CB.Text = _promociones.GetItem(EntityInfo.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 >= EntityInfo.FechaInicial)
                {
                    hoy = EntityInfo.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(EntityInfo.OidPlan, EntityInfo.OidPromocion, EntityInfo.Oid, i));
                    }
                }
                if (_teoricas == null)
                {
                    _teoricas = ClaseTeoricaList.GetDisponiblesList(EntityInfo.OidPlan, EntityInfo.OidPromocion, EntityInfo.Oid);
                }
                if (_extras == null)
                {
                    _extras = ClaseExtraList.GetDisponiblesList(EntityInfo.OidPromocion, EntityInfo.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(EntityInfo.FechaInicial, EntityInfo.OidPromocion);
                }
                if (_profesores == null)
                {
                    _profesores = InstructorList.GetList(true);
                }

                _disponibilidades = _profesores.GetDisponibilidadesProfesores(_entity.FechaInicial);
                PgMng.Grow(string.Empty, "Instructores y profesores");

                CLB_1.SetItemChecked(0, EntityInfo.H8AM);
                CLB_1.SetItemChecked(1, EntityInfo.H0);
                CLB_1.SetItemChecked(2, EntityInfo.H1);
                CLB_1.SetItemChecked(3, EntityInfo.H2);
                CLB_1.SetItemChecked(4, EntityInfo.H3);
                CLB_1.SetItemChecked(5, EntityInfo.H4);
                CLB_1.SetItemChecked(6, EntityInfo.H5);
                CLB_1.SetItemChecked(7, EntityInfo.H6);
                CLB_1.SetItemChecked(8, EntityInfo.H7);
                CLB_1.SetItemChecked(9, EntityInfo.H8);
                CLB_1.SetItemChecked(10, EntityInfo.H9);
                CLB_1.SetItemChecked(11, EntityInfo.H10);
                CLB_1.SetItemChecked(12, EntityInfo.H11);
                CLB_1.SetItemChecked(13, EntityInfo.H12);

                CLB_2.SetItemChecked(0, EntityInfo.Hs0);
                CLB_2.SetItemChecked(1, EntityInfo.Hs1);
                CLB_2.SetItemChecked(2, EntityInfo.Hs2);
                CLB_2.SetItemChecked(3, EntityInfo.Hs3);
                CLB_2.SetItemChecked(4, EntityInfo.Hs4);
                PgMng.Grow(string.Empty, "Lista horas");

                //Se rellena la fecha
                Fecha_DTP.Value = EntityInfo.FechaInicial;
                this.Text       = Resources.Labels.HORARIO_ADD_TITLE +
                                  "De Lunes, " + EntityInfo.FechaInicial.ToShortDateString() +
                                  " A Sábado, " + EntityInfo.FechaInicial.AddDays(5).ToShortDateString();
                PgMng.Grow(string.Empty, "string fechas");

                //Se rellena el horario
                if (_lista_sesiones == null)
                {
                    _lista_sesiones = new ListaSesiones(EntityInfo.FechaInicial);
                    //ResetSesiones(false);
                    PgMng.Grow(string.Empty, "lista sesiones");

                    Horario.MuestraSesiones(EntityInfo.Sesions, _lista_sesiones, _teoricas, ClasePracticaList.Merge(_practicas[1], _practicas[2]), _extras);
                }

                Confirmar_BT.Enabled = true;
                Marcar_BT.Enabled    = true;
                Generar_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") + "/" +
                                EntityInfo.FechaInicial.Month.ToString("00") + ")";
                Martes_LB.Text = "MARTES (" + EntityInfo.FechaInicial.AddDays(1).Day.ToString("00") + "/" +
                                 EntityInfo.FechaInicial.AddDays(1).Month.ToString("00") + ")";
                Miercoles_LB.Text = "MIÉRCOLES (" + EntityInfo.FechaInicial.AddDays(2).Day.ToString("00") + "/" +
                                    EntityInfo.FechaInicial.AddDays(2).Month.ToString("00") + ")";
                Jueves_LB.Text = "JUEVES (" + EntityInfo.FechaInicial.AddDays(3).Day.ToString("00") + "/" +
                                 EntityInfo.FechaInicial.AddDays(3).Month.ToString("00") + ")";
                Viernes_LB.Text = "VIERNES (" + EntityInfo.FechaInicial.AddDays(4).Day.ToString("00") + "/" +
                                  EntityInfo.FechaInicial.AddDays(4).Month.ToString("00") + ")";
                Sabado_LB.Text = "SÁBADO (" + EntityInfo.FechaInicial.AddDays(5).Day.ToString("00") + "/" +
                                 EntityInfo.FechaInicial.AddDays(5).Month.ToString("00") + ")";
            }
            finally
            {
                PgMng.FillUp();
            }
        }