public CaptureViewModel() { ActualShipmentDate = new MaskedDateInputViewModel(); PrenotificationDate = new MaskedDateInputViewModel(); Receipt = new ReceiptViewModel(); Recovery = new RecoveryViewModel(); }
public CaptureViewModel(ImportMovementSummaryData data) { ShipmentNumber = data.Data.Number; ActualShipmentDate = new MaskedDateInputViewModel(data.Data.ActualDate.DateTime); if (data.Data.PreNotificationDate.HasValue) { PrenotificationDate = new MaskedDateInputViewModel(data.Data.PreNotificationDate.Value.DateTime); } else { PrenotificationDate = new MaskedDateInputViewModel(); HasNoPrenotification = true; } Comments = data.Comments; StatsMarking = data.StatsMarking; if (!string.IsNullOrWhiteSpace(data.Comments) || !string.IsNullOrWhiteSpace(data.StatsMarking)) { HasComments = true; } NotificationType = data.Data.NotificationType; IsReceived = data.IsReceived; IsOperationCompleted = data.RecoveryData.IsOperationCompleted; IsRejected = data.IsRejected; IsPartiallyRejected = data.IsPartiallyRejected; if (!data.IsReceived && !data.IsRejected && !data.IsPartiallyRejected) { data.IsReceived = true; } Receipt = new ReceiptViewModel { ActualQuantity = data.ReceiptData.ActualQuantity, ReceivedDate = data.ReceiptData.ReceiptDate.HasValue ? new MaskedDateInputViewModel(data.ReceiptData.ReceiptDate.Value.DateTime) : new MaskedDateInputViewModel(), ActualUnits = data.ReceiptData.ReceiptUnits ?? data.ReceiptData.NotificationUnit, ShipmentTypes = data.IsReceived ? ShipmentType.Accepted : (data.IsRejected ? ShipmentType.Rejected : ShipmentType.Partially), RejectionReason = data.ReceiptData.RejectionReason, PossibleUnits = data.ReceiptData.PossibleUnits, RejectedQuantity = data.RejectedQuantity, RejectedUnits = data.RejectedUnit }; Recovery = new RecoveryViewModel { NotificationType = data.Data.NotificationType, RecoveryDate = new MaskedDateInputViewModel(data.RecoveryData.OperationCompleteDate) }; }