Esempio n. 1
0
        protected override void DeleteLineAction()
        {
            if (Lines_BS.Current == null)
            {
                return;
            }

            if (PgMng.ShowDeleteConfirmation() == DialogResult.Yes)
            {
                if (Line.OidPedido == 0)
                {
                    PgMng.Reset(4, 1, Resources.Messages.UPDATING_STOCK, this);

                    BatchInfo partida = BatchInfo.Get(Line.OidPartida, true);
                    PgMng.Grow();

                    if (partida.IsKit)
                    {
                        DeleteKit(partida);
                    }
                    PgMng.Grow();

                    _entity.Conceptos.Remove(Line, true);
                    _entity.CalculateTotal();
                    PgMng.Grow();
                }
                else
                {
                    long oidPedido = Line.OidPedido;

                    _entity.Conceptos.Remove(Line, true);
                    _entity.CalculateTotal();

                    bool free_pedido = true;

                    foreach (InputDeliveryLine item in _entity.Conceptos)
                    {
                        if (item.OidPedido == Line.OidPedido)
                        {
                            free_pedido = false;
                        }
                    }

                    //Actualizamos la lista de pedidos disponibles
                    if (free_pedido)
                    {
                        _orders.AddItem(_provider_orders.GetItem(oidPedido));
                    }
                }


                ControlsMng.UpdateBinding(Lines_BS);
                ControlsMng.UpdateBinding(Datos);
                PgMng.FillUp();
            }

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

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }