コード例 #1
0
ファイル: CaptureViewModel.cs プロジェクト: DEFRA/prsd-iws
 public CaptureViewModel()
 {
     PrenotificationDate = new MaskedDateInputViewModel();
     ActualShipmentDate  = new MaskedDateInputViewModel();
     Receipt             = new ReceiptViewModel();
     Recovery            = new RecoveryViewModel();
 }
コード例 #2
0
ファイル: CaptureViewModel.cs プロジェクト: DEFRA/prsd-iws
        public CaptureViewModel(MovementReceiptAndRecoveryData data)
        {
            ActualShipmentDate = new MaskedDateInputViewModel(data.ActualDate);
            if (data.PrenotificationDate.HasValue)
            {
                PrenotificationDate = new MaskedDateInputViewModel(data.PrenotificationDate.Value);
            }
            else
            {
                PrenotificationDate  = new MaskedDateInputViewModel();
                HasNoPrenotification = true;
            }

            ShipmentNumber = data.Number;

            Comments     = data.Comments;
            StatsMarking = data.StatsMarking;

            if (!string.IsNullOrWhiteSpace(data.Comments) || !string.IsNullOrWhiteSpace(data.StatsMarking))
            {
                HasComments = true;
            }

            NotificationType     = data.NotificationType;
            IsReceived           = data.IsReceived;
            IsOperationCompleted = data.IsOperationCompleted;
            IsRejected           = data.IsRejected;
            IsPartiallyRejected  = data.IsPartiallyRejected;

            if (!data.IsReceived && !data.IsRejected && !data.IsPartiallyRejected)
            {
                data.IsReceived = true;
            }

            Receipt = new ReceiptViewModel
            {
                ActualQuantity   = data.ActualQuantity,
                ReceivedDate     = new MaskedDateInputViewModel(data.ReceiptDate),
                ActualUnits      = data.ReceiptUnits ?? data.NotificationUnits,
                ShipmentTypes    = data.IsReceived ? ShipmentType.Accepted : (data.IsRejected ? ShipmentType.Rejected : ShipmentType.Partially),
                RejectionReason  = data.RejectionReason,
                PossibleUnits    = data.PossibleUnits,
                RejectedQuantity = data.RejectedQuantity,
                RejectedUnits    = data.RejectedUnit
            };

            Recovery = new RecoveryViewModel
            {
                NotificationType = data.NotificationType,
                RecoveryDate     = new MaskedDateInputViewModel(data.OperationCompleteDate)
            };
        }