public override void RefreshSecondaryData()
        {
            HorarioList horarios = HorarioList.GetList(false);
            HorarioInfo horario  = horarios.GetItem(_entity.OidHorario);

            Horario_TB.Text = "Desde " + horario.FechaInicial.ToShortDateString()
                              + " hasta " + horario.FechaFinal.ToShortDateString();
            PgMng.Grow();

            base.RefreshSecondaryData();
        }
        public HorarioMngForm(bool isModal, Form parent, HorarioList list)
            : base(isModal, parent, list)
        {
            InitializeComponent();
            SetView(molView.Normal);
            _sort_property = Plan.DataPropertyName;

            // Parche para poder abrir el formulario en modo diseño y no perder la configuracion de columnas
            DatosLocal_BS    = Datos;
            Tabla.DataSource = DatosLocal_BS;

            SetMainDataGridView(Tabla);
            Datos.DataSource  = HorarioList.NewList().GetSortedList();
            base.SortProperty = FechaInicial.DataPropertyName;
        }
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    HorarioList listA = HorarioList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.Lock:
            case molAction.Unlock:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

            case molAction.Delete:
                if (ActiveItem == null)
                {
                    return;
                }
                List.RemoveItem(ActiveOID);
                if (FilterType == IFilterType.Filter)
                {
                    HorarioList listD = HorarioList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            _entity = null;
            RefreshSources();
        }
        /// <summary>
        /// Toma la lista de bancos de la base de datos y rellena la tabla.
        /// </summary>
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "Horario");

            _selectedOid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:
                List = HorarioList.GetList(false);
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }

            PgMng.Grow(string.Empty, "Lista de Horarios");
        }
        protected override bool DoSearch()
        {
            bool             promo        = false;
            bool             plan         = false;
            PromocionList    sublist      = null;
            PlanEstudiosList sublist_plan = null;

            DateTime inicio = DateTime.MinValue;
            DateTime fin    = DateTime.MaxValue;

            if (Desde_DTP.Checked)
            {
                inicio = Desde_DTP.Value;
            }

            if (Hasta_DTP.Checked)
            {
                fin = Hasta_DTP.Value;
            }

            if (_lista == null)
            {
                MessageBox.Show(Resources.Messages.NO_RESULTS);
                return(false);
            }

            FCriteria criteria = null;

            if (Valor_TB.Text != " ")
            {
                foreach (Control ctl in this.Campos_Groupbox.Controls)
                {
                    if (((System.Windows.Forms.RadioButton)ctl).Checked)
                    {
                        switch (ctl.Name)
                        {
                        case "Promocion_RB":
                        {
                            CriteriaEx criteriaex = Promocion.GetCriteria(Promocion.OpenSession());
                            criteriaex.AddContains("Nombre", Valor_TB.Text);
                            criteriaex.Childs = false;
                            sublist           = PromocionList.GetList(criteriaex);
                            // No existe la promoción
                            if (sublist.Count == 0)
                            {
                                MessageBox.Show(Resources.Messages.NO_RESULTS);
                                return(false);
                            }
                            promo = true;
                            break;
                        }

                        case "Plan_RB":
                        {
                            CriteriaEx criteriaex = PlanEstudios.GetCriteria(PlanEstudios.OpenSession());
                            criteriaex.AddContains("Nombre", Valor_TB.Text);
                            criteriaex.Childs = false;
                            sublist_plan      = PlanEstudiosList.GetList(criteriaex);
                            // No existe la promoción
                            if (sublist_plan.Count == 0)
                            {
                                MessageBox.Show(Resources.Messages.NO_RESULTS);
                                return(false);
                            }
                            plan = true;
                            break;
                        }
                        }
                    }
                }
            }

            // Consulta en la bd
            SortedBindingList <HorarioInfo> lista = null;

            if (SortProperty != string.Empty)
            {
                if (promo)
                {
                    HorarioList list = HorarioList.GetList(HorarioList.GetFilteredList(HorarioList.GetFilteredFechaList(_lista, inicio, fin),
                                                                                       sublist, "OidPromocion"));
                    lista = list.ToSortedList(SortProperty, SortDirection);
                }
                else
                {
                    if (plan)
                    {
                        HorarioList list = HorarioList.GetList(HorarioList.GetFilteredList(HorarioList.GetFilteredFechaList(_lista, inicio, fin),
                                                                                           sublist_plan, "OidPlan"));
                        lista = list.ToSortedList(SortProperty, SortDirection);
                    }
                    else
                    {
                        lista = HorarioList.SortList(HorarioList.GetFilteredFechaList(_lista, inicio, fin), SortProperty, SortDirection);
                    };
                }
            }
            else
            {
                lista = _lista.GetSortedSubList(criteria, "Oid", SortDirection);
            }

            Datos.DataSource = lista;

            if (lista.Count == 0)
            {
                MessageBox.Show(Resources.Messages.NO_RESULTS);
                return(false);
            }

            Datos.MoveFirst();

            return(true);
        }