/ThinkEmailFomatter/Models/DataObjects/DomainObjects/TemplateSetting.cs
C# | 96 lines | 61 code | 29 blank | 6 comment | 4 complexity | ade6031f0a20b649788b4ca27336e1ce MD5 | raw file
Possible License(s): BSD-3-Clause
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- namespace ThinkEmailFormatter.Models
- {
- public class TemplateSetting : IIdentifiable
- {
- public int Id { get; set; }
- public Guid Guid { get; set; }
- [Required]
- public string Name { get; set; }
- [StringLength(1024)]
- [DataType(DataType.MultilineText)]
- public string Description { get; set; }
- public bool Flag { get; set; }
- [DisplayName("From email")]
- public string FromEmail { get; set; }
- public string Subject { get; set; }
- [DisplayName("Event Type")]
- [Required]
- public Identifier EventType { get; set; }
- [DisplayName("Order Class")]
- [Required]
- public Identifier OrderClass { get; set; }
- [DisplayName("Enable default template")]
- public bool DefaultEnabled { get; set; }
- [DisplayName("Enable Tax Invoice check")]
- public bool TaxInvoiceCheckEnabled { get; set; }
- public List<Filter> Filters { get; set; }
- /// <summary>
- /// Initialize instances marked as "Required" so they are not null.
- /// It removes the need to check if the instance is not null in
- /// the view, and also removes the need to create the instance
- /// before setting it.
- /// </summary>
- public void InitiateRequiredComplexTypes()
- {
- if (this.OrderClass == null)
- OrderClass = new Identifier();
- if (this.EventType == null)
- EventType = new Identifier();
- }
- }
- public class Identifier : IIdentifiable
- {
- public int Id { get; set; }
- public Guid Guid { get; set; }
- public string Name { get; set; }
- public string Description { get; set; }
- public bool Flag { get; set; }
- }
- public class Filter : IIdentifiable
- {
- public int Id { get; set; }
- public Guid Guid { get; set; }
- public string Name { get; set; }
- public string Description { get; set; }
- public bool Flag { get; set; }
- public Identifier OrderCode { get; set; }
- public Identifier SourceCode { get; set; }
- public Identifier SubscriptionDefinition { get; set; }
- public bool Active { get; set; }
- }
- }