/// <summary> Creates a new instance with the default configuration. </summary> public static ListElementItem InitTemplate(int?id = null, string key = null, string label = null, string description = null, bool select = true, bool edit = true, bool delete = true, bool copy = false) { ListElementItem obj = new ListElementItem(); obj.Id = id ?? 0; obj.Key = key; obj.Status = (int)Base.Enums.Status.Active; obj.Index = 0; obj.Label = label; obj.Description = description; obj.Select = select; obj.Edit = edit; obj.Delete = delete; obj.Copy = copy; return(obj); }
/// <summary> Adds a template to this list. </summary> public void AddTemplate(ListElementItem template, int?index = null) { // Check if (template == null) { throw new CoreException("Parameter 'template' can not be null."); } if (this.Templates == null) { this.Templates = new List <ListElementItem>(); } // Set index if (template.Index == 0) { template.Index = (index != null) ? index.Value : this.Templates.Count + 1; } this.Templates.Add(template); }