Пример #1
0
    public static void RegisterNoteType(NoteTypeSymbol noteType)
    {
        if (!noteType.Key.HasText())
        {
            throw new InvalidOperationException("noteType must have a key, use MakeSymbol method after the constructor when declaring it");
        }

        SystemNoteTypes.Add(noteType);
    }
Пример #2
0
    public static NoteEntity?CreateNote <T>(this Lite <T> entity, string text, NoteTypeSymbol noteType, Lite <UserEntity>?user = null, string?title = null) where T : class, IEntity
    {
        if (started == false)
        {
            return(null);
        }

        return(new NoteEntity
        {
            CreatedBy = user ?? UserEntity.Current.ToLite(),
            Text = text,
            Title = title,
            Target = (Lite <Entity>)Lite.Create(entity.EntityType, entity.Id, entity.ToString()),
            NoteType = noteType
        }.Execute(NoteOperation.Save));
    }