diff --git a/TIAM.Entities/TransferDestinations/TransferDestination.cs b/TIAM.Entities/TransferDestinations/TransferDestination.cs
index 739531a1..d51da3dc 100644
--- a/TIAM.Entities/TransferDestinations/TransferDestination.cs
+++ b/TIAM.Entities/TransferDestinations/TransferDestination.cs
@@ -2,13 +2,21 @@
using AyCode.Interfaces.Entities;
using AyCode.Entities.Locations;
using AyCode.Interfaces.TimeStampInfo;
+using System.ComponentModel.DataAnnotations;
+using System.Text.RegularExpressions;
namespace TIAM.Entities.TransferDestinations
{
[Table("TransferDestination")]
public class TransferDestination : LocationBase, ITimeStampInfo
{
+ //[Required(ErrorMessage = "The Username value should be specified.")]
+ [DataType(DataType.Text)]
+ [Display(Name = "Destination name")]
public string? Name { get; set; }
+
+ [DataType(DataType.MultilineText)]
+ [Display(Name = "Destination info")]
public string? Description { get; set; }
public DateTime Created { get; set; }
@@ -20,5 +28,31 @@ namespace TIAM.Entities.TransferDestinations
public TransferDestination(Guid id, string name, double latitude, double longitude, string address) : base(id, latitude,longitude, address) { }
public TransferDestination(Guid id, string name, string description, double latitude, double longitude, string address) : base(id, latitude,longitude, address) { }
}
+
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
+ public class MinPasswordLengthAttribute : ValidationAttribute
+ {
+ int MinLength { get; }
+ public MinPasswordLengthAttribute(int minLength, string errorMsg) : base(errorMsg)
+ {
+ MinLength = minLength;
+ }
+
+ public override bool IsValid(object value)
+ {
+ return ((string)value).Length >= MinLength;
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
+ public class EmailAttribute : ValidationAttribute
+ {
+ public override bool IsValid(object value)
+ {
+ return Regex.IsMatch((string)value, @"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*"
+ + "@"
+ + @"((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$");
+ }
+ }
}
diff --git a/TIAMSharedUI/Pages/Components/InputWizard.razor b/TIAMSharedUI/Pages/Components/InputWizard.razor
index 95a7a868..2b51e392 100644
--- a/TIAMSharedUI/Pages/Components/InputWizard.razor
+++ b/TIAMSharedUI/Pages/Components/InputWizard.razor
@@ -3,29 +3,42 @@
Edit Form
-
-
-
-
-
- @CreateEditFormFields()
-
-
-
+
+
+
+
+
+ @CreateEditFormFields()
+
+
+
+
+
+
+
+ @CreateDynamicTest()
+
+
+
@FormSubmitResult
@code {
-
+
}
\ No newline at end of file
diff --git a/TIAMSharedUI/Pages/Components/InputWizard.razor.cs b/TIAMSharedUI/Pages/Components/InputWizard.razor.cs
index 3004a9e7..c0b503b1 100644
--- a/TIAMSharedUI/Pages/Components/InputWizard.razor.cs
+++ b/TIAMSharedUI/Pages/Components/InputWizard.razor.cs
@@ -7,14 +7,19 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using TIAM.Entities.TransferDestinations;
+using TIAMWebApp.Shared.Application.Utility;
+
namespace TIAMSharedUI.Pages.Components
{
public partial class InputWizard : ComponentBase
{
+ [Inject]
+ LogToBrowserConsole logToBrowserConsole { get; set; }
string FormSubmitResult = "";
//TestUserData Data { get; set; } = new TestUserData();
@@ -33,15 +38,23 @@ namespace TIAMSharedUI.Pages.Components
public RenderFragment CreateEditFormFields() => formLayoutBuilder =>
{
+ logToBrowserConsole.LogToBC("Hellooooo");
+
var propertyList = typeof(TransferDestination).GetProperties();
+ //var propertyList = typeof(TestUserData).GetProperties();
formLayoutBuilder.OpenComponent(0);
formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) =>
{
int i = 0;
foreach (var property in propertyList)
{
+ //if(property.Name == "Id" || property.Name == "Latitude" || property.Name == "Longitude" || property.Name == "Created" || property.Name == "Modified")
+ if(property.Name == "Id" || property.Name == "Created" || property.Name == "Modified")
+ {
+ continue;
+ }
- var attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First();
+ DataTypeAttribute attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First();
DisplayAttribute displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First();
layoutItemBuilder.OpenComponent(i++);
layoutItemBuilder.AddAttribute(i++, "Caption", displayLabel.Name);
@@ -49,14 +62,18 @@ namespace TIAMSharedUI.Pages.Components
//layoutItemBuilder.AddAttribute(i++, "CssClass", "form-field");
var access = Expression.Property(Expression.Constant(Data), property.Name);
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
+ var lambda2 = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
+
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment