Exemple #1
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    AlumnoList listA = AlumnoList.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)
                {
                    AlumnoList listD = AlumnoList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

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

            _selected_oid = ActiveOID;

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

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

            PgMng.Grow(string.Empty, "Lista de Alumnos");
        }
        public override void RefreshSecondaryData()
        {
            PromocionList promociones = PromocionList.GetList(false);

            _combo_promociones = new Library.Instruction.HComboBoxSourceList(promociones);

            Datos_Promociones.DataSource = _combo_promociones;
            PgMng.Grow();

            _alumnos = AlumnoList.GetList(false);
            _combo_promociones.Childs = new Library.Instruction.HComboBoxSourceList(_alumnos);

            Datos_ComboAlumnos.DataSource = _combo_promociones.Childs;
            PgMng.Grow();

            _combo_tipo = new Library.Instruction.HComboBoxSourceList();
            _combo_tipo.Add(new ComboBoxSource());
            _combo_tipo.Add(new ComboBoxSource(1, "Curso"));
            _combo_tipo.Add(new ComboBoxSource(2, "Módulo"));

            Datos_Tipo.DataSource = _combo_tipo;
            PgMng.Grow();
        }
Exemple #4
0
        protected AlumnoList GetAlumnoList(AlumnoInfo alumno, PromocionInfo promocion)
        {
            List <AlumnoInfo> alumnos = new List <AlumnoInfo>();
            AlumnoList        list;

            if (alumno != null)
            {
                alumnos.Add(alumno);
                list = AlumnoList.GetList(alumnos);
            }
            else
            {
                if (promocion != null)
                {
                    list = AlumnoList.GetListByPromocion(promocion.Oid, false);
                }
                else
                {
                    list = AlumnoList.GetList(false);
                }
            }

            return(list);
        }
Exemple #5
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);
        }
Exemple #6
0
 public override void RefreshSecondaryData()
 {
     _alumnos = AlumnoList.GetList(false);
     PgMng.Grow();
 }
Exemple #7
0
        protected override void SelectEntities(EntidadInfo entidad)
        {
            _tipo            = entidad.Tipo;
            _entity_type_oid = entidad.Oid;
            switch (_tipo)
            {
            case "Cliente":
            {
                ClienteList        clientes = ClienteList.GetList(false);
                List <ClienteInfo> lista    = new List <ClienteInfo>();

                foreach (ClienteInfo obj in clientes)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }
                Datos_Agentes.DataSource = lista;
            }
            break;

            case "Alumno":
            {
                AlumnoList        alumnos = AlumnoList.GetList(false);;
                List <AlumnoInfo> lista   = new List <AlumnoInfo>();

                foreach (AlumnoInfo obj in alumnos)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;

            case "Empleado":
            {
                InstructorList        empleados = InstructorList.GetList(false);
                List <InstructorInfo> lista     = new List <InstructorInfo>();

                foreach (InstructorInfo obj in empleados)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;
            //case "Factura":
            //    {
            //        FacturaList facturas = FacturaList.GetList(false);
            //        List<FacturaInfo> lista = new List<FacturaInfo>();

            //        foreach (FacturaInfo obj in facturas)
            //        {
            //            if (!entidad.Agentes.ContainsAgent(obj.Oid))
            //                lista.Add(obj);
            //        }

            //        Datos_Agentes.DataSource = lista;
            //    }
            //    break;
            case "Auditoria":
            {
                AuditoriaList        auditorias = AuditoriaList.GetList();
                List <AuditoriaInfo> lista      = new List <AuditoriaInfo>();

                foreach (AuditoriaInfo obj in auditorias)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;

            case "Proveedor":
            {
                ProveedorList        proveedores = ProveedorList.GetList(false);
                List <ProveedorInfo> lista       = new List <ProveedorInfo>();

                foreach (ProveedorInfo obj in proveedores)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;

            case "Promocion":
            {
                PromocionList        promociones = PromocionList.GetList(false);
                List <PromocionInfo> lista       = new List <PromocionInfo>();

                foreach (PromocionInfo obj in promociones)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;

            case "Curso":
            {
                CursoList        cursos = CursoList.GetList(false);
                List <CursoInfo> lista  = new List <CursoInfo>();

                foreach (CursoInfo obj in cursos)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;

            case "Modulo":
            {
                ModuloList        modulos = ModuloList.GetList(false);
                List <ModuloInfo> lista   = new List <ModuloInfo>();

                foreach (ModuloInfo obj in modulos)
                {
                    if (entidad.Agentes.GetItemByProperty("Oid", obj.Oid) == null)
                    {
                        lista.Add(obj);
                    }
                }

                Datos_Agentes.DataSource = lista;
            }
            break;
                //default:
                //    _tipo = "";
                //    throw new iQException("No se ha encontrado el tipo de entidad " + entidad.Tipo);
            }
            Format();
        }