PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/ThinkEmailFomatter/Models/DataObjects/DomainObjects/TemplateSetting.cs

https://bitbucket.org/nicdao/frg-think-emailformatter
C# | 96 lines | 61 code | 29 blank | 6 comment | 4 complexity | ade6031f0a20b649788b4ca27336e1ce MD5 | raw file
Possible License(s): BSD-3-Clause
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.ComponentModel;
  6. using System.ComponentModel.DataAnnotations;
  7. namespace ThinkEmailFormatter.Models
  8. {
  9. public class TemplateSetting : IIdentifiable
  10. {
  11. public int Id { get; set; }
  12. public Guid Guid { get; set; }
  13. [Required]
  14. public string Name { get; set; }
  15. [StringLength(1024)]
  16. [DataType(DataType.MultilineText)]
  17. public string Description { get; set; }
  18. public bool Flag { get; set; }
  19. [DisplayName("From email")]
  20. public string FromEmail { get; set; }
  21. public string Subject { get; set; }
  22. [DisplayName("Event Type")]
  23. [Required]
  24. public Identifier EventType { get; set; }
  25. [DisplayName("Order Class")]
  26. [Required]
  27. public Identifier OrderClass { get; set; }
  28. [DisplayName("Enable default template")]
  29. public bool DefaultEnabled { get; set; }
  30. [DisplayName("Enable Tax Invoice check")]
  31. public bool TaxInvoiceCheckEnabled { get; set; }
  32. public List<Filter> Filters { get; set; }
  33. /// <summary>
  34. /// Initialize instances marked as "Required" so they are not null.
  35. /// It removes the need to check if the instance is not null in
  36. /// the view, and also removes the need to create the instance
  37. /// before setting it.
  38. /// </summary>
  39. public void InitiateRequiredComplexTypes()
  40. {
  41. if (this.OrderClass == null)
  42. OrderClass = new Identifier();
  43. if (this.EventType == null)
  44. EventType = new Identifier();
  45. }
  46. }
  47. public class Identifier : IIdentifiable
  48. {
  49. public int Id { get; set; }
  50. public Guid Guid { get; set; }
  51. public string Name { get; set; }
  52. public string Description { get; set; }
  53. public bool Flag { get; set; }
  54. }
  55. public class Filter : IIdentifiable
  56. {
  57. public int Id { get; set; }
  58. public Guid Guid { get; set; }
  59. public string Name { get; set; }
  60. public string Description { get; set; }
  61. public bool Flag { get; set; }
  62. public Identifier OrderCode { get; set; }
  63. public Identifier SourceCode { get; set; }
  64. public Identifier SubscriptionDefinition { get; set; }
  65. public bool Active { get; set; }
  66. }
  67. }