示例#1
0
        protected override bool afterRemove(ResponseParser parser, bool soft = false)
        {
            bool result = base.afterRemove(parser, soft);

            if (result)
            {
                Bid bid = BidViewModel.instance().getById(Id_bid);
                if (bid != null && bid.EquipmentBidCollection.Contains(this))
                {
                    bid.EquipmentBidCollection.Remove(this);
                }
                ComplectationViewModel.instance().getByEquipmentBidId(Id).ToList().ForEach(x => { x.remove(true); });
            }
            return(result);
        }
        //Фильтры отображени/сокрытия строк таблиц
        private void SetViewSources()
        {
            equipmentBidViewSource.Source  = EquipmentBidViewModel.instance().Collection;
            equipmentBidViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                EquipmentBid equipmentBid = e.Item as EquipmentBid;
                if (equipmentBid == null)
                {
                    return;
                }

                Bid bid = dgvBid.SelectedItem as Bid;
                if (bid == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (bid.Id == equipmentBid.Id_bid)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };

            complectationViewSource.Source  = ComplectationViewModel.instance().Collection;
            complectationViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Complectation complectation = e.Item as Complectation;
                if (complectation == null)
                {
                    return;
                }

                EquipmentBid equipmentBid = dgvEquipmentBid.SelectedItem as EquipmentBid;
                if (equipmentBid == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (complectation.Id_equipment_bid == equipmentBid.Id)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };

            buyerViewSource.Source  = BuyerViewModel.instance().Collection;
            buyerViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Buyer buyer = e.Item as Buyer;
                if (buyer == null)
                {
                    return;
                }

                Bid bid = dgvBid.SelectedItem as Bid;
                if (bid == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (buyer.Id == bid.Id_buyer)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };
        }
        //Фильтры отображени/сокрытия строк таблиц
        private void SetViewSources()
        {
            //Установка источника данных оборудования в заявке
            equipmentBidViewSource.Source = EquipmentBidViewModel.instance().Collection;
            //Установка фильтра
            equipmentBidViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                EquipmentBid equipmentBid = e.Item as EquipmentBid;
                if (equipmentBid == null)
                {
                    return;
                }

                Bid bid = dgvBid.SelectedItem as Bid;
                if (bid == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (bid.Id == equipmentBid.Id_bid)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };

            //Установка источника данных комплектация
            complectationViewSource.Source = ComplectationViewModel.instance().Collection;
            //Установка фильтра
            complectationViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Complectation complectation = e.Item as Complectation;
                if (complectation == null)
                {
                    return;
                }

                EquipmentBid equipmentBid = dgvEquipmentBid.SelectedItem as EquipmentBid;
                if (equipmentBid == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (complectation.Id_equipment_bid == equipmentBid.Id)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };

            //Установка источника данных покупателей
            buyerViewSource.Source = BuyerViewModel.instance().Collection;
            //Установка фильтра
            buyerViewSource.Filter += delegate(object sender, FilterEventArgs e)
            {
                Buyer buyer = e.Item as Buyer;
                if (buyer == null)
                {
                    return;
                }

                Bid bid = dgvBid.SelectedItem as Bid;
                if (bid == null)
                {
                    e.Accepted = false;
                    return;
                }
                if (buyer.Id == bid.Id_buyer)
                {
                    e.Accepted = true;
                }
                else
                {
                    e.Accepted = false;
                }
            };
        }