Esempio n. 1
0
        public MovementViewModel(Movement movement,
                                 MovementDetails movementDetails,
                                 NotificationApplication notification,
                                 ShipmentInfo shipmentInfo,
                                 DateTimeFormatter dateTimeFormatter,
                                 QuantityFormatter quantityFormatter,
                                 PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter,
                                 PackagingTypesFormatter packagingTypesFormatter)
        {
            if (notification == null)
            {
                return;
            }

            NotificationNumber      = notification.NotificationNumber ?? string.Empty;
            IsSpecialHandling       = notification.HasSpecialHandlingRequirements.GetValueOrDefault();
            IsNotSpecialHandling    = !notification.HasSpecialHandlingRequirements.GetValueOrDefault(true);
            PhysicalCharacteristics =
                physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString(notification.PhysicalCharacteristics);
            IntendedNumberOfShipments = (shipmentInfo == null)
                ? "0"
                : shipmentInfo.NumberOfShipments.ToString();
            IsRecovery = notification.NotificationType == NotificationType.Recovery;
            IsDisposal = notification.NotificationType == NotificationType.Disposal;
            CA         = CompetentAuthorityFormatter.GetCompetentAuthority(notification.CompetentAuthority);

            if (movement == null)
            {
                return;
            }

            Number = movement.Number.ToString();

            if (movementDetails == null)
            {
                return;
            }

            ActualDate = dateTimeFormatter.DateTimeToDocumentFormatString(movement.Date);
            SetQuantity(movementDetails, quantityFormatter);
            PackagingTypes = packagingTypesFormatter.PackagingTypesToCommaDelimitedString(movementDetails.PackagingInfos);
        }
        public MovementViewModel(Movement movement,
            MovementDetails movementDetails,
            NotificationApplication notification,
            ShipmentInfo shipmentInfo,
            DateTimeFormatter dateTimeFormatter,
            QuantityFormatter quantityFormatter,
            PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter,
            PackagingTypesFormatter packagingTypesFormatter)
        {
            if (notification == null)
            {
                return;
            }

            NotificationNumber = notification.NotificationNumber ?? string.Empty;
            IsSpecialHandling = notification.HasSpecialHandlingRequirements.GetValueOrDefault();
            IsNotSpecialHandling = !notification.HasSpecialHandlingRequirements.GetValueOrDefault(true);
            PhysicalCharacteristics =
                physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString(notification.PhysicalCharacteristics);
            IntendedNumberOfShipments = (shipmentInfo == null)
                ? "0"
                : shipmentInfo.NumberOfShipments.ToString();
            IsRecovery = notification.NotificationType == NotificationType.Recovery;
            IsDisposal = notification.NotificationType == NotificationType.Disposal;

            if (movement == null)
            {
                return;
            }

            Number = movement.Number.ToString();

            if (movementDetails == null)
            {
                return;
            }

            ActualDate = dateTimeFormatter.DateTimeToDocumentFormatString(movement.Date);
            SetQuantity(movementDetails, quantityFormatter);
            PackagingTypes = packagingTypesFormatter.PackagingTypesToCommaDelimitedString(movementDetails.PackagingInfos);
        }