public GeneralViewModel(NotificationApplication notification,
            ShipmentInfo shipmentInfo,
            FacilityCollection facilityCollection,
            DateTimeFormatter dateTimeFormatter,
            QuantityFormatter quantityFormatter,
            PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter)
        {
            Number = notification.NotificationNumber;
            IsDisposal = notification.NotificationType.Equals(NotificationType.Disposal);
            IsRecovery = notification.NotificationType.Equals(NotificationType.Recovery);

            var isPreconsented = facilityCollection.AllFacilitiesPreconsented;
            if (!isPreconsented.HasValue)
            {
                IsPreconsented = false;
                IsNotPreconsented = false;
            }
            else
            {
                IsPreconsented = isPreconsented.GetValueOrDefault();
                IsNotPreconsented = !isPreconsented.GetValueOrDefault();
            }

            if (shipmentInfo.NumberOfShipments > 1)
            {
                IsIndividualShipment = false;
                IsNotIndividualShipment = true;
            }
            else
            {
                IsIndividualShipment = true;
                IsNotIndividualShipment = false;
            }

            IntendedNumberOfShipments = shipmentInfo.NumberOfShipments.ToString();
            FirstDeparture = dateTimeFormatter.DateTimeToDocumentFormatString(shipmentInfo.ShipmentPeriod.FirstDate);
            LastDeparture = dateTimeFormatter.DateTimeToDocumentFormatString(shipmentInfo.ShipmentPeriod.LastDate);
            SetIntendedQuantityFields(shipmentInfo, quantityFormatter);

            var hasSpecialHandlingRequirements = notification.HasSpecialHandlingRequirements;
            if (!hasSpecialHandlingRequirements.HasValue)
            {
                IsSpecialHandling = false;
                IsNotSpecialHandling = false;
            }
            else
            {
                IsSpecialHandling = hasSpecialHandlingRequirements.GetValueOrDefault();
                IsNotSpecialHandling = !hasSpecialHandlingRequirements.GetValueOrDefault();
            }

            PackagingTypes = GetPackagingInfo(notification);

            PhysicalCharacteristics =
                physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString(
                    notification.PhysicalCharacteristics);
        }
Beispiel #2
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);
        }
Beispiel #4
0
        public GeneralViewModel(NotificationApplication notification,
                                ShipmentInfo shipmentInfo,
                                FacilityCollection facilityCollection,
                                DateTimeFormatter dateTimeFormatter,
                                QuantityFormatter quantityFormatter,
                                PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter)
        {
            Number     = notification.NotificationNumber;
            IsDisposal = notification.NotificationType.Equals(NotificationType.Disposal);
            IsRecovery = notification.NotificationType.Equals(NotificationType.Recovery);

            var isPreconsented = facilityCollection.AllFacilitiesPreconsented;

            if (!isPreconsented.HasValue)
            {
                IsPreconsented    = false;
                IsNotPreconsented = false;
            }
            else
            {
                IsPreconsented    = isPreconsented.GetValueOrDefault();
                IsNotPreconsented = !isPreconsented.GetValueOrDefault();
            }

            if (shipmentInfo.NumberOfShipments > 1)
            {
                IsIndividualShipment    = false;
                IsNotIndividualShipment = true;
            }
            else
            {
                IsIndividualShipment    = true;
                IsNotIndividualShipment = false;
            }

            IntendedNumberOfShipments = shipmentInfo.NumberOfShipments.ToString();
            FirstDeparture            = dateTimeFormatter.DateTimeToDocumentFormatString(shipmentInfo.ShipmentPeriod.FirstDate);
            LastDeparture             = dateTimeFormatter.DateTimeToDocumentFormatString(shipmentInfo.ShipmentPeriod.LastDate);
            SetIntendedQuantityFields(shipmentInfo, quantityFormatter);

            var hasSpecialHandlingRequirements = notification.HasSpecialHandlingRequirements;

            if (!hasSpecialHandlingRequirements.HasValue)
            {
                IsSpecialHandling    = false;
                IsNotSpecialHandling = false;
            }
            else
            {
                IsSpecialHandling    = hasSpecialHandlingRequirements.GetValueOrDefault();
                IsNotSpecialHandling = !hasSpecialHandlingRequirements.GetValueOrDefault();
            }

            PackagingTypes = GetPackagingInfo(notification);

            PhysicalCharacteristics =
                physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString(
                    notification.PhysicalCharacteristics);

            CA = CompetentAuthorityFormatter.GetCompetentAuthority(notification.CompetentAuthority);
        }