Added validation for InspectionDate and set a maximum year restriction in InspectionView.

This commit is contained in:
retr0volkov
2025-07-30 13:10:25 +03:00 Unverified
parent 08eaa30209
commit c1f0c8714f
5 changed files with 12 additions and 9 deletions
+2
View File
@@ -66,6 +66,8 @@ public partial class InspectionViewModel : ViewModelBase
{ {
Inspection.Name = Name; Inspection.Name = Name;
Inspection.CreationDate = CreationDate; Inspection.CreationDate = CreationDate;
if (InspectionDate.Year > 2500)
InspectionDate = DateTimeOffset.Now;
Inspection.InspectionDate = InspectionDate; Inspection.InspectionDate = InspectionDate;
Inspection.PeriodType = PeriodType.ToDescription(); Inspection.PeriodType = PeriodType.ToDescription();
Inspection.PeriodValue = PeriodValue; Inspection.PeriodValue = PeriodValue;
+1 -1
View File
@@ -32,7 +32,7 @@
<WrapPanel VerticalAlignment="Top"> <WrapPanel VerticalAlignment="Top">
<TextBlock Margin="10,2" Text="Дата проведения:" <TextBlock Margin="10,2" Text="Дата проведения:"
FontSize="18" VerticalAlignment="Center"/> FontSize="18" VerticalAlignment="Center"/>
<DatePicker FontSize="18" VerticalAlignment="Center" <DatePicker FontSize="18" VerticalAlignment="Center" MaxYear="2500-01-01"
SelectedDate="{Binding InspectionDate}"/> SelectedDate="{Binding InspectionDate}"/>
<TextBlock Margin="10,2" Text="Период:" FontSize="18" VerticalAlignment="Center"/> <TextBlock Margin="10,2" Text="Период:" FontSize="18" VerticalAlignment="Center"/>
Binary file not shown.
+8 -7
View File
@@ -7,15 +7,16 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System;
using System.Reflection; using System.Reflection;
[assembly: AssemblyCompany("GazpromApp")] [assembly: System.Reflection.AssemblyCompanyAttribute("GazpromApp")]
[assembly: AssemblyConfiguration("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+edae732facddad296bc2957b70d69e109c8df0dc")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+08eaa30209fb07132671006392af33044278fb88")]
[assembly: AssemblyProduct("GazpromApp")] [assembly: System.Reflection.AssemblyProductAttribute("GazpromApp")]
[assembly: AssemblyTitle("GazpromApp")] [assembly: System.Reflection.AssemblyTitleAttribute("GazpromApp")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class. // Generated by the MSBuild WriteCodeFragment class.
@@ -1 +1 @@
d5e1f758b4af1a11eec5b0ef10074d2fa0359670b43f632e44e63e702c71cb03 991b92f7461b0b0cb8dff258086ca1dd3fd0a9b1938281c5774aefca5ef9edfc