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

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
        private void PlantillasMngForm_KeyPress(object sender, KeyPressEventArgs e)
        {
            DataGridViewColumn col;

            if (Tabla.CurrentCell == null)
            {
                if (Tabla.SortedColumn != null)
                {
                    col = Tabla.SortedColumn;
                }
                else
                {
                    col = Tabla.Columns[0];
                }
            }
            else
            {
                col = Tabla.Columns[Tabla.CurrentCell.ColumnIndex];
            }

            if (col.ValueType != null)
            {
                if (col.ValueType.Name == "Int32")
                {
                    return;
                }
                if (col.ValueType.Name == "Int64")
                {
                    return;
                }
                if (col.ValueType.Name == "Single")
                {
                    return;
                }
                if (col.ValueType.Name == "Double")
                {
                    return;
                }

                string     car      = e.KeyChar.ToString();
                CriteriaEx criteria = PlantillaExamen.GetCriteria(PlantillaExamen.OpenSession());

                criteria.AddStartsWith(col.DataPropertyName, car);

                // Buscamos las palabras que empiecen por el caracter
                PlantillaExamenList lista = PlantillaExamenList.GetList(criteria);
                SortedBindingList <PlantillaExamenInfo> list =
                    PlantillaExamenList.GetSortedList(lista, col.DataPropertyName, ListSortDirection.Ascending);

                int foundIndex;

                // Nos situamos en la primera aparicion de esa lista en la
                // que se muestra. Esto se hace pq se ha consultado la bd y no la lista actual
                // lo que puede dar lugar a inconsistencias si otro usuario a cambiado la bd
                foreach (PlantillaExamenInfo cli in list)
                {
                    foundIndex = Datos.IndexOf(cli);
                    if (foundIndex != -1)
                    {
                        Datos.Position = foundIndex;
                        break;
                    }
                }
            }
        }