AuthorizeRequest.cs 857 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using EVCB_OCPP.Packet.Features;
  8. using Newtonsoft.Json;
  9. namespace EVCB_OCPP.Packet.Messages.Core
  10. {
  11. public class AuthorizeRequest : IRequest
  12. {
  13. public AuthorizeRequest()
  14. {
  15. Action = Actions.Authorize.ToString();
  16. }
  17. [JsonIgnore]
  18. public string Action { set; get; }
  19. [Required(AllowEmptyStrings = true)]
  20. [MaxLength(20)]
  21. public string idTag { set; get; }
  22. public bool TransactionRelated()
  23. {
  24. return false;
  25. }
  26. public bool Validate()
  27. {
  28. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  29. }
  30. }
  31. }