Using YaStringLength and YaRequired

This commit is contained in:
Paul Schneider 2019-09-04 01:25:36 +01:00
commit 9457ba71d1
62 changed files with 396 additions and 150 deletions

View file

@ -9,22 +9,23 @@ namespace Yavsc.Models.Workflow
{
using Yavsc.Models.Market;
using Yavsc;
using Yavsc.Attributes.Validation;
public class Activity : IBaseTrackedEntity, IActivity
{
[StringLength(512), Required, Key]
[YaStringLength(512), YaRequired, Key]
[Display(Name = "Code")]
public string Code { get; set; }
/// <summary>
///
/// </summary>
/// <returns></returns>
[StringLength(512), Required()]
[YaStringLength(512), YaRequired()]
[Display(Name = "Nom")]
public string Name { get; set; }
[StringLength(512)]
[YaStringLength(512)]
[Display(Name = "Code du parent")]
public string ParentCode { get; set; }

View file

@ -5,6 +5,8 @@ using Newtonsoft.Json;
namespace Yavsc.Models.Workflow
{
using Yavsc;
using Yavsc.Attributes.Validation;
public class CommandForm : ICommandForm
{
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@ -14,7 +16,7 @@ namespace Yavsc.Models.Workflow
public string Title { get; set; }
[Required]
[YaRequired]
public string ActivityCode { get; set; }
[ForeignKey("ActivityCode"),JsonIgnore]

View file

@ -7,6 +7,7 @@ namespace Yavsc.Models.Workflow
using System;
using Models.Relationship;
using Newtonsoft.Json;
using Yavsc.Attributes.Validation;
using Yavsc.Workflow;
public class PerformerProfile : IPerformerProfile {
@ -20,13 +21,13 @@ namespace Yavsc.Models.Workflow
[Display(Name="Activity"), JsonIgnore]
public virtual List<UserActivity> Activity { get; set; }
[Required,StringLength(14),Display(Name="SIREN"),
[YaRequired,YaStringLength(14),Display(Name="SIREN"),
RegularExpression(@"^[0-9]{9,14}$", ErrorMessage = "Only numbers are allowed here")]
public string SIREN { get; set; }
public long OrganizationAddressId { get; set; }
[Required,Display(Name="Organization address"),ForeignKey("OrganizationAddressId")]
[YaRequired,Display(Name="Organization address"),ForeignKey("OrganizationAddressId")]
public virtual Location OrganizationAddress { get; set; }
[Display(Name="Accept notifications on client query")]

View file

@ -6,6 +6,7 @@ using Yavsc.Models.Market;
namespace Yavsc.Models.Workflow
{
using Models.Relationship;
using Yavsc.Attributes.Validation;
/// <summary>
/// A date, between two persons
@ -17,21 +18,21 @@ namespace Yavsc.Models.Workflow
/// Event date
/// </summary>
/// <returns></returns>
[Required(),Display(Name="EventDate")]
[YaRequired(),Display(Name="EventDate")]
public DateTime EventDate { get; set; }
/// <summary>
/// Location identifier
/// </summary>
/// <returns></returns>
[Required]
[YaRequired]
public long LocationId { get; set; }
/// <summary>
/// A Location for this event
/// </summary>
/// <returns></returns>
[Required(ErrorMessage="SpecifyPlace"),Display(Name="Location"),ForeignKey("LocationId")]
[YaRequired(ErrorMessage="SpecifyPlace"),Display(Name="Location"),ForeignKey("LocationId")]
public Location Location { get; set; }
}

View file

@ -1,18 +1,19 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Yavsc.Attributes.Validation;
namespace Yavsc.Models.Workflow
{
public class UserActivity
{
[Required]
[YaRequired]
public string UserId { get; set; }
[ForeignKey("UserId")]
public virtual PerformerProfile User { get; set; }
[Required]
[YaRequired]
public string DoesCode { get; set; }
[ForeignKey("DoesCode")]