/// <summary> /// Adds a new child Category. /// </summary> /// <param name="name">The name of the new child Category.</param> /// <returns>The new Category.</returns> public Category AddCategory(string name) { Category category = new Category(0, name, (short)Categories.Count, this); Categories.Add(category); category.Save(); foreach (TemplateField field in Fields) { TemplateField copy = new TemplateField(0, field.Name, field.Type, category, field.MinRange, field.MaxRange, (short)Fields.Count); copy.IsModified = true; category.Fields.Add(copy); } category.SaveTemplate(); return category; }
/// <summary> /// Adds a <see cref="T:TemplateField"/> to the template. /// </summary> /// <param name="type">The type of the new field.</param> /// <param name="name">The name of the new field.</param> /// <returns>The new <see cref="T:TemplateField/> added to <see cref="T:Category.Fields"/>.</returns> public TemplateField AddField(FieldType type, string name) { TemplateField field = new TemplateField(0, name, type, this, "", "", (short)Fields.Count); field.IsModified = true; Fields.Add(field); return field; }
protected virtual void OnSelectedTemplateFieldChanged(object sender, TemplateField oldField, TemplateField newField) { }