Example #1
0
        protected new SortedBindingList <AlumnoInfo> Localize(object value, string column_name)
        {
            SortedBindingList <AlumnoInfo> list = null;
            AlumnoList sourceList = null;

            switch (FilterType)
            {
            case IFilterType.None:
                if (List == null)
                {
                    MessageBox.Show(moleQule.Face.Resources.Messages.NO_RESULTS);
                    return(null);
                }
                sourceList = List;
                break;

            case IFilterType.Filter:
                if (FilteredList == null)
                {
                    MessageBox.Show(moleQule.Face.Resources.Messages.NO_RESULTS);
                    return(null);
                }
                sourceList = FilteredList;
                break;
            }

            FCriteria criteria = null;
            string    related  = "none";

            switch (column_name)
            {
            default:
            {
                criteria = GetCriteria(column_name, value, _operation);
            } break;
            }

            switch (related)
            {
            case "none":
            {
                list = sourceList.GetSortedSubList(criteria);
            } break;
            }

            if (list.Count == 0)
            {
                MessageBox.Show(moleQule.Face.Resources.Messages.NO_RESULTS);
                return(sourceList.GetSortedList());
            }

            DatosSearch.DataSource = list;
            DatosSearch.MoveFirst();

            AddFilterLabel(column_name, value);

            Tabla.Focus();

            return(list);
        }
Example #2
0
        protected override bool DoSearch()
        {
            bool          promo   = false;
            PromocionList sublist = null;

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

            FCriteria criteria = null;

            foreach (Control ctl in this.Campos_Groupbox.Controls)
            {
                if (((System.Windows.Forms.RadioButton)ctl).Checked)
                {
                    switch (ctl.Name)
                    {
                    case "Nombre_RB":
                    {
                        criteria = new FCriteria <string>("Nombre", Valor_TB.Text);
                        break;
                    }

                    case "Apellidos_RB":
                    {
                        criteria = new FCriteria <string>("Apellidos", Valor_TB.Text);
                        break;
                    }

                    case "Promocion_RB":
                    {
                        CriteriaEx criteriaex = Promocion.GetCriteria(Promocion.OpenSession());
                        criteriaex.AddContains("Nombre", Valor_TB.Text);
                        sublist = PromocionList.GetList(criteriaex);
                        // No existe el plan
                        if (sublist.Count == 0)
                        {
                            MessageBox.Show(Resources.Messages.NO_RESULTS);
                            return(false);
                        }
                        promo = true;
                        break;
                    }
                    }
                }
            }

            // Consulta en la bd
            SortedBindingList <AlumnoInfo> lista;

            if (SortProperty != string.Empty)
            {
                if (!promo)
                {
                    lista = _lista.GetSortedSubList(criteria, SortProperty, SortDirection);
                }
                else
                {
                    AlumnoList list = AlumnoList.GetList(AlumnoList.GetFilteredList(_lista, sublist, "OidPromocion"));
                    lista = list.ToSortedList(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);
        }