using CommunityToolkit.Mvvm.ComponentModel; using System; using System.ComponentModel.DataAnnotations.Schema; namespace TabletTester2025.Models { public class DissolutionSamplePoint : ObservableObject { private int _id; private int _testBatchId; private int _channel; private double _scheduledTimeMin; private double? _actualTimeMin; private double? _percent; private DateTime? _recordedAt; public int Id { get => _id; set => SetProperty(ref _id, value); } public int TestBatchId { get => _testBatchId; set => SetProperty(ref _testBatchId, value); } public int Channel { get => _channel; set { if (SetProperty(ref _channel, value)) OnPropertyChanged(nameof(ChannelName)); } } public double ScheduledTimeMin { get => _scheduledTimeMin; set => SetProperty(ref _scheduledTimeMin, value); } public double? ActualTimeMin { get => _actualTimeMin; set { if (SetProperty(ref _actualTimeMin, value)) OnPropertyChanged(nameof(Status)); } } public double? Percent { get => _percent; set { if (SetProperty(ref _percent, value)) OnPropertyChanged(nameof(Status)); } } public DateTime? RecordedAt { get => _recordedAt; set { if (SetProperty(ref _recordedAt, value)) OnPropertyChanged(nameof(Status)); } } [NotMapped] public string ChannelName => Channel == 2 ? "溶出2" : "溶出1"; [NotMapped] public string Status => Percent.HasValue ? "已记录" : "待取样"; } }