/// <summary>
        /// Gets the change string for a change.
        /// </summary>
        /// <param name="change">The change.</param>
        /// <returns>The change string.</returns>
        private static string GetChangeString(ScrewTurn.Wiki.PluginFramework.Change change)
        {
            switch (change)
            {
            case ScrewTurn.Wiki.PluginFramework.Change.PageUpdated:
                return("U");

            case ScrewTurn.Wiki.PluginFramework.Change.PageDeleted:
                return("D");

            case ScrewTurn.Wiki.PluginFramework.Change.PageRolledBack:
                return("R");

            case ScrewTurn.Wiki.PluginFramework.Change.PageRenamed:
                return("N");

            case ScrewTurn.Wiki.PluginFramework.Change.MessagePosted:
                return("MP");

            case ScrewTurn.Wiki.PluginFramework.Change.MessageEdited:
                return("ME");

            case ScrewTurn.Wiki.PluginFramework.Change.MessageDeleted:
                return("MD");

            default:
                throw new NotSupportedException();
            }
        }
 public bool AddRecentChange(string page, string title, string messageSubject, DateTime dateTime, string user, ScrewTurn.Wiki.PluginFramework.Change change, string descr)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Adds a new change.
        /// </summary>
        /// <param name="page">The page name.</param>
        /// <param name="title">The page title.</param>
        /// <param name="messageSubject">The message subject (or <c>null</c>).</param>
        /// <param name="dateTime">The date/time.</param>
        /// <param name="user">The user.</param>
        /// <param name="change">The change.</param>
        /// <param name="descr">The description (optional).</param>
        /// <returns><c>true</c> if the change is saved, <c>false</c> otherwise.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="page"/>, <paramref name="title"/> or <paramref name="user"/> are <c>null</c>.</exception>
        /// <exception cref="ArgumentException">If <paramref name="page"/>, <paramref name="title"/> or <paramref name="user"/> are empty.</exception>
        public bool AddRecentChange(string page, string title, string messageSubject, DateTime dateTime, string user, ScrewTurn.Wiki.PluginFramework.Change change, string descr)
        {
            if (page == null)
            {
                throw new ArgumentNullException("page");
            }
            if (title == null)
            {
                throw new ArgumentNullException("title");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (page.Length == 0)
            {
                throw new ArgumentException("page");
            }
            if (title.Length == 0)
            {
                throw new ArgumentException("title");
            }
            if (user.Length == 0)
            {
                throw new ArgumentException("user");
            }

            try {
                RecentChangesEntity recentChangesEntity = new RecentChangesEntity()
                {
                    PartitionKey   = _wiki,
                    RowKey         = dateTime.Ticks + "-" + Guid.NewGuid().ToString("N"),
                    Page           = page,
                    Title          = title,
                    MessageSubject = messageSubject,
                    DateTime       = dateTime,
                    User           = user,
                    Change         = GetChangeString(change),
                    Description    = descr
                };
                _context.AddObject(RecentChangesTable, recentChangesEntity);
                _context.SaveChangesStandard();
                return(true);
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 4
0
 public bool AddRecentChange(string page, string title, string messageSubject, DateTime dateTime, string user,
                             Change change, string descr)
 {
     throw new NotImplementedException();
 }