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

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "Pedido");

            _selectedOid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:
                List = PedidoList.GetList(Library.Common.ModulePrincipal.GetActiveYear().Year, false);
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            PgMng.Grow(string.Empty, "Lista de Pedidos");
        }
        protected virtual void AddPedidoAction(List <PedidoInfo> albaranes)
        {
            if (_entity.OidSerie == 0)
            {
                PgMng.ShowInfoException(Resources.Messages.NO_SERIE_SELECTED);
                return;
            }

            if (_pedidos.Count == 0)
            {
                if (_entity.OidHolder != 0)
                {
                    _pedidos = PedidoList.GetPendientesList(_entity.OidHolder, _entity.OidSerie, false);
                }
                else
                {
                    _pedidos = PedidoList.GetPendientesList(0, _entity.OidSerie, false);
                }
            }

            if (albaranes == null)
            {
                PedidoSelectForm form = new PedidoSelectForm(this, PedidoList.GetList(_pedidos));
                form.ShowDialog(this);
                if (form.DialogResult == DialogResult.OK)
                {
                    _results = form.Selected as List <PedidoInfo>;
                }
                else
                {
                    _results.Clear();
                }
            }
            else
            {
                _results = albaranes;
            }

            if (_results.Count > 0)
            {
                foreach (PedidoInfo item in _results)
                {
                    if (item.OidCliente != _results[0].OidCliente)
                    {
                        PgMng.ShowInfoException("No es posible asignar pedidos de clientes distintos a un mismo Albarán.");
                        return;
                    }
                }

                DoAddPedido(null);
            }

            if (Result == BGResult.OK)
            {
                Serie_BT.Enabled = false;
                Datos.ResetBindings(false);
            }

            if (Result == BGResult.OK)
            {
                Lines_BS.ResetBindings(false);
            }
        }