/// <summary>
        /// Config
        /// </summary>
        /// <returns>The config.</returns>
        /// <param name="trailerStock">Trailer stock.</param>
        public void Config(DriverStock trailerStock)
        {
            using (var cylinderImageView = ItemView.FindViewById <ImageView>(Resource.Id.cylinderImageView))
            {
                var icon = ProductIcon.GetIcon(trailerStock.ProductCode);

                if (icon != null)
                {
                    cylinderImageView.SetImageResource(icon.Value);
                }
                else
                {
                    cylinderImageView.SetImageResource(0);
                }
            }

            using (var descriptionTextView = ItemView.FindViewById <TextView>(Resource.Id.descriptionTextView))
            {
                descriptionTextView.Text = trailerStock.ShortDescription;
            }

            using (var fullsTextView = ItemView.FindViewById <TextView>(Resource.Id.fullsTextView))
            {
                var fullsLabel = ItemView.Context.Resources.GetString(Resource.String.label_fulls);
                fullsTextView.Text       = String.Format("{0} {1}", trailerStock.Fulls, fullsLabel);
                fullsTextView.Visibility = trailerStock.Fulls > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var emptiesTextView = ItemView.FindViewById <TextView>(Resource.Id.emptiesTextView))
            {
                var emptiesLabel = ItemView.Context.Resources.GetString(Resource.String.label_empties);
                emptiesTextView.Text       = String.Format("{0} {1}", trailerStock.Empties, emptiesLabel);
                emptiesTextView.Visibility = trailerStock.Empties > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var faultyEmptiesTextView = ItemView.FindViewById <TextView>(Resource.Id.faultyEmptiesTextView))
            {
                var faultyEmptiesLabel = ItemView.Context.Resources.GetString(Resource.String.label_faulty_empties);
                faultyEmptiesTextView.Text       = String.Format("{0} {1}", trailerStock.FaultyEmpties, faultyEmptiesLabel);
                faultyEmptiesTextView.Visibility = trailerStock.FaultyEmpties > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var faultyFullsTextView = ItemView.FindViewById <TextView>(Resource.Id.faultyFullsTextView))
            {
                var faultyFullsLabel = ItemView.Context.Resources.GetString(Resource.String.label_faulty_fulls);
                faultyFullsTextView.Text       = String.Format("{0} {1}", trailerStock.FaultyFulls, faultyFullsLabel);
                faultyFullsTextView.Visibility = trailerStock.FaultyFulls > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var orderedTextView = ItemView.FindViewById <TextView>(Resource.Id.orderedTextView))
            {
                var orderedLabel = ItemView.Context.Resources.GetString(Resource.String.label_ordered);
                orderedTextView.Text       = String.Format("{0} {1}", trailerStock.OrderQuantity, orderedLabel);
                orderedTextView.Visibility = trailerStock.OrderQuantity > 0 ? ViewStates.Visible : ViewStates.Gone;
            }
        }
Exemple #2
0
        /// <summary>
        /// Config the specified lending.
        /// </summary>
        /// <param name="lending">Lending.</param>
        public void Config(LendingStatus lending)
        {
            using (var cylinderImageView = ItemView.FindViewById <ImageView>(Resource.Id.cylinderImageView))
            {
                var icon = ProductIcon.GetIcon(lending.ProductCode);

                if (icon != null)
                {
                    cylinderImageView.SetImageResource(icon.Value);
                }
            }

            using (var descriptionTextView = ItemView.FindViewById <TextView>(Resource.Id.descriptionTextView))
            {
                descriptionTextView.Text = lending.ShortDescription;
            }

            using (var quantityTextView = ItemView.FindViewById <TextView>(Resource.Id.quantityTextView))
            {
                var label = ItemView.Context.Resources.GetString(Resource.String.title_lending);
                quantityTextView.Text = String.Format("{0} {1}", lending.Quantity, label);
            }
        }
        /// <summary>
        /// Bind view
        /// </summary>
        /// <param name="view">View.</param>
        void BindView(View view)
        {
            GetData();

            using (var descriptionTextView = view.FindViewById <TextView>(Resource.Id.descriptionTextView))
            {
                descriptionTextView.Text = _product.ShortDescription;
            }

            var icon = ProductIcon.GetIcon(_product.ProductCode);

            if (icon.HasValue)
            {
                using (var cylinderImageView = view.FindViewById <ImageView>(Resource.Id.cylinderImageView))
                {
                    cylinderImageView.SetImageResource(icon.Value);
                }
            }

            _fullsEditText = view.FindViewById <EditText>(Resource.Id.fullsEditText);

            if (_product.Fulls.GetValueOrDefault() > 0)
            {
                _fullsEditText.Text = _product.Fulls?.ToString();
            }

            _emptiesEditText = view.FindViewById <EditText>(Resource.Id.emptiesEditText);

            if (_product.Empties.GetValueOrDefault() > 0)
            {
                _emptiesEditText.Text = _product.Empties?.ToString();
            }

            _faultyFullsEditText = view.FindViewById <EditText>(Resource.Id.faultyFullsEditText);

            if (_product.FaultyFulls.GetValueOrDefault() > 0)
            {
                _faultyFullsEditText.Text = _product.FaultyFulls?.ToString();
            }

            _fullsCollectedEditText = view.FindViewById <EditText>(Resource.Id.fullsCollectedEditText);

            if (_product.FullsCollected.GetValueOrDefault() > 0)
            {
                _fullsCollectedEditText.Text = _product.FullsCollected?.ToString();
            }

            _emptiesDeliveredEditText = view.FindViewById <EditText>(Resource.Id.emptiesDeliveredEditText);

            if (_product.EmptiesDelivered.GetValueOrDefault() > 0)
            {
                _emptiesDeliveredEditText.Text = _product.EmptiesDelivered?.ToString();
            }

            _faultyEmptiesEditText = view.FindViewById <EditText>(Resource.Id.faultyEmptiesEditText);

            if (_product.FaultyEmpties.GetValueOrDefault() > 0)
            {
                _faultyEmptiesEditText.Text = _product.FaultyEmpties?.ToString();
            }

            // hide faulty empties if delivery
            _faultyEmptiesLayout            = view.FindViewById <RelativeLayout>(Resource.Id.faultyEmptiesLayout);
            _faultyEmptiesLayout.Visibility = _mode == StockItemDialogMode.Delivery ? ViewStates.Gone : ViewStates.Visible;

            // hide fulls collected if trailer
            _fullsCollectedLayout            = view.FindViewById <RelativeLayout>(Resource.Id.fullsCollectedLayout);
            _fullsCollectedLayout.Visibility = _mode == StockItemDialogMode.Trailer ? ViewStates.Gone : ViewStates.Visible;

            // hide empties delivered if trailer
            _emptiesDeliveredLayout            = view.FindViewById <RelativeLayout>(Resource.Id.emptiesDeliveredLayout);
            _emptiesDeliveredLayout.Visibility = _mode == StockItemDialogMode.Trailer ? ViewStates.Gone : ViewStates.Visible;

            _cancelButton        = view.FindViewById <Button>(Resource.Id.cancelButton);
            _cancelButton.Click += OnCancel;

            _confirmButton        = view.FindViewById <Button>(Resource.Id.confirmButton);
            _confirmButton.Click += OnConfirm;

            // set selec to end of text
            _fullsEditText.SetSelection(_fullsEditText.Text.Length);

            SetFullsTextChangedEvent();
        }
Exemple #4
0
        /// <summary>
        /// Config
        /// </summary>
        /// <returns>The config.</returns>
        /// <param name="stock">Stock.</param>
        public void Config(DeliveryDocketItem deliveryItem)
        {
            using (var cylinderImageView = ItemView.FindViewById <ImageView>(Resource.Id.cylinderImageView))
            {
                var icon = ProductIcon.GetIcon(deliveryItem.ProductCode);

                if (icon != null)
                {
                    cylinderImageView.SetImageResource(icon.Value);
                }
                else
                {
                    cylinderImageView.SetImageResource(0);
                }
            }

            using (var descriptionTextView = ItemView.FindViewById <TextView>(Resource.Id.descriptionTextView))
            {
                descriptionTextView.Text = deliveryItem.Description;
            }

            using (var fullsTextView = ItemView.FindViewById <TextView>(Resource.Id.fullsTextView))
            {
                var fullsLabel = ItemView.Context.Resources.GetString(Resource.String.label_fulls);
                fullsTextView.Text = String.Format("{0} {1}", deliveryItem.FullsDelivered, fullsLabel);

                fullsTextView.Visibility = deliveryItem.FullsDelivered > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var emptiesCollectedTextView = ItemView.FindViewById <TextView>(Resource.Id.emptiesCollectedTextView))
            {
                var emptiesCollectedLabel = ItemView.Context.Resources.GetString(Resource.String.label_empties);
                emptiesCollectedTextView.Text = String.Format("{0} {1}", deliveryItem.EmptiesCollected, emptiesCollectedLabel);

                emptiesCollectedTextView.Visibility = deliveryItem.EmptiesCollected > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var faultyFullsTextView = ItemView.FindViewById <TextView>(Resource.Id.faultyFullsTextView))
            {
                var faultyFullsLabel = ItemView.Context.Resources.GetString(Resource.String.label_faulty_fulls);
                faultyFullsTextView.Text = String.Format("{0} {1}", deliveryItem.FaultyFulls, faultyFullsLabel);

                faultyFullsTextView.Visibility = deliveryItem.FaultyFulls > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var faultyEmptiesTextView = ItemView.FindViewById <TextView>(Resource.Id.faultyEmptiesTextView))
            {
                var faultyEmptiesLabel = ItemView.Context.Resources.GetString(Resource.String.label_faulty_empties);
                faultyEmptiesTextView.Text = String.Format("{0} {1}", deliveryItem.FaultyEmpties, faultyEmptiesLabel);

                faultyEmptiesTextView.Visibility = deliveryItem.FaultyEmpties > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var fullsCollectedTextView = ItemView.FindViewById <TextView>(Resource.Id.fullsCollectedTextView))
            {
                var fullsCollectedLabel = ItemView.Context.Resources.GetString(Resource.String.label_fulls_collected);
                fullsCollectedTextView.Text = String.Format("{0} {1}", deliveryItem.FullsCollected, fullsCollectedLabel);

                fullsCollectedTextView.Visibility = deliveryItem.FullsCollected > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var emptiesDeliveredTextView = ItemView.FindViewById <TextView>(Resource.Id.emptiesDeliveredTextView))
            {
                var emptiesDeliveredLabel = ItemView.Context.Resources.GetString(Resource.String.label_empties_delivered);
                emptiesDeliveredTextView.Text = String.Format("{0} {1}", deliveryItem.EmptiesDelivered, emptiesDeliveredLabel);

                emptiesDeliveredTextView.Visibility = deliveryItem.EmptiesDelivered > 0 ? ViewStates.Visible : ViewStates.Gone;
            }

            using (var orderedTextView = ItemView.FindViewById <TextView>(Resource.Id.orderedTextView))
            {
                var orderedLabel = ItemView.Context.Resources.GetString(Resource.String.label_ordered);
                orderedTextView.Text = String.Format("{0} {1}", deliveryItem.OrderQuantity, orderedLabel);

                orderedTextView.Visibility = deliveryItem.OrderQuantity > 0 ? ViewStates.Visible : ViewStates.Gone;
            }
        }