Beispiel #1
0
        public void Refresh()
        {
            DeliveryPoint = (InfoProvider as IDeliveryPointInfoProvider)?.DeliveryPoint;
            if (DeliveryPoint == null)
            {
                buttonSaveComment.Sensitive = false;
                return;
            }
            buttonSaveComment.Sensitive = true;
            labelAddress.Text           = DeliveryPoint.CompiledAddress;

            foreach (var child in PhonesTable.Children)
            {
                PhonesTable.Remove(child);
                child.Destroy();
            }

            uint rowsCount = Convert.ToUInt32(DeliveryPoint.Phones.Count) + 1;

            PhonesTable.Resize(rowsCount, 2);
            for (uint row = 0; row < rowsCount - 1; row++)
            {
                Label label = new Label();
                label.Selectable = true;
                label.Markup     = $"{DeliveryPoint.Phones[Convert.ToInt32(row)].LongText}";

                HandsetView handsetView = new HandsetView(DeliveryPoint.Phones[Convert.ToInt32(row)].DigitsNumber);

                PhonesTable.Attach(label, 0, 1, row, row + 1);
                PhonesTable.Attach(handsetView, 1, 2, row, row + 1);
            }

            Label labelAddPhone = new Label()
            {
                LabelProp = "Щёлкните чтоб\n добавить телефон-->"
            };

            PhonesTable.Attach(labelAddPhone, 0, 1, rowsCount - 1, rowsCount);

            Image addIcon = new Image();

            addIcon.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-add", IconSize.Menu);
            Button btn = new Button();

            btn.Image    = addIcon;
            btn.Clicked += OnBtnAddPhoneClicked;
            PhonesTable.Attach(btn, 1, 2, rowsCount - 1, rowsCount);
            PhonesTable.ShowAll();

            var bottlesAtDeliveryPoint  = _bottlesRepository.GetBottlesAtDeliveryPoint(InfoProvider.UoW, DeliveryPoint);
            var bottlesAvgDeliveryPoint = _deliveryPointRepository.GetAvgBottlesOrdered(InfoProvider.UoW, DeliveryPoint, 5);

            lblBottlesQty.LabelProp = $"{bottlesAtDeliveryPoint} шт. (сред. зак.: {bottlesAvgDeliveryPoint:G3})";
            var bottlesAtCounterparty = _bottlesRepository.GetBottlesAtCounterparty(InfoProvider.UoW, DeliveryPoint.Counterparty);

            debtByClientLabel.LabelProp = $"{bottlesAtCounterparty} шт.";
            var depositsAtDeliveryPoint = _depositRepository.GetDepositsAtDeliveryPoint(InfoProvider.UoW, DeliveryPoint, null);

            labelDeposits.LabelProp     = CurrencyWorks.GetShortCurrencyString(depositsAtDeliveryPoint);
            textviewComment.Buffer.Text = DeliveryPoint.Comment;

            var currentOrders = _orderRepository.GetLatestOrdersForDeliveryPoint(InfoProvider.UoW, DeliveryPoint, 5);

            ytreeLastOrders.SetItemsSource <Order>(currentOrders);
            vboxLastOrders.Visible = currentOrders.Any();

            table2.ShowAll();
        }