Inspections added

This commit is contained in:
retr0volkov
2025-07-08 22:19:51 +03:00 Unverified
parent bd8b780a39
commit 646f60e800
14 changed files with 239 additions and 20 deletions
+37 -3
View File
@@ -1,16 +1,50 @@
using GazpromApp.Models;
using System;
using CommunityToolkit.Mvvm.ComponentModel;
using GazpromApp.Enums;
using GazpromApp.Models;
namespace GazpromApp.ViewModels;
public partial class InspectionViewModel : ViewModelBase
{
[ObservableProperty]
private string _name;
[ObservableProperty]
private DateTimeOffset _inspectionDate;
[ObservableProperty]
private PeriodType _periodType;
[ObservableProperty]
private float _periodValue;
// Visual properties
[ObservableProperty]
private bool _isEditing = false;
public InspectionViewModel()
{
Name = string.Empty;
InspectionDate = DateTimeOffset.Now;
PeriodType = 0;
PeriodValue = 1;
}
public InspectionViewModel(Inspection inspection)
{
Name = inspection.Name;
InspectionDate = inspection.InspectionDate;
PeriodType = inspection.PeriodType.ToPeriodType();
PeriodValue = inspection.PeriodValue;
}
public Inspection GetInspection()
{
return new Inspection()
{
Name = Name,
InspectionDate = InspectionDate,
PeriodType = PeriodType.ToDescription(),
PeriodValue = PeriodValue
};
}
}