public void SaveCategory()
        {
            BlogCategory category = null;

            //Create new audit record
            var newLog = new BlogLog()
            {
                BlogConfigId = this.blogConfig.BlogConfigId,
                CreateDate = DateTime.Now,
                EventLevel = "Audit",
                Logger = "CategoriesEditScreen"
            };

            if (this.BlogCategoryId.HasValue && this.BlogCategoryId > 0)
            {
                category = repo.GetBlogCategoryByCategoryId(this.blogConfig.BlogConfigId, this.BlogCategoryId.Value);

                newLog.Message = "Changing Category with ID = " + this.BlogCategoryId.Value +
                    "\nOld Title: " + category.Title + " \nNew Title: " + this.Title +
                    "\nOld Description: " + category.Description + " \nNew Desccription: " + this.Description +
                    "\nOld Active: " + category.IsActive + " \nNew Active: " + this.IsActive +
                    "\nBy user: "******"New Category "+
                    "\nNew Title: " + this.Title +
                    "\nNew Desccription: " + this.Description +
                    "\nNew Active: " + this.IsActive;

                category = new BlogCategory()
                {
                    BlogConfigId = this.blogConfig.BlogConfigId,
                    CreateDate = DateTime.Now,
                    CreatedById = SessionHandler.CurrentUserId,
                    Description = this.Description,
                    IsActive = this.IsActive,
                    Title = this.Title
                };
                repo.Add(category);
            }

            category.LastUpdateDate = DateTime.Now;
            category.LastUpdatedById = SessionHandler.CurrentUserId;
            repo.Add(newLog);

            repo.Save();
        }
        public void SaveUser()
        {
            //Create new audit record
            var newLog = new BlogLog()
            {
                BlogConfigId = this.blogConfig.BlogConfigId,
                CreateDate = DateTime.Now,
                EventLevel = "Audit",
                Logger = "UsersEditScreen"
            };

            if (this.BlogUser.BlogUserId > 0)
            {
                //newLog.Message = "Changing Page with ID = " + this.BlogPage.BlogPageId +
                //    "\nOld Content: " + this.OriginalContent + " \nNew Content: " + this.BlogPage.PageContent +
                //    "\nOld Description: " + this.OriginalDescription + " \nNew Description: " + this.BlogPage.Description +
                //    "\nOld Title: " + this.OriginalTitle + " \nNew Title: " + this.BlogPage.PageTitle +
                //    "\nOld Keywords: " + this.OriginalKeywords + " \nNew Keywords: " + this.BlogPage.Keywords +
                //    "\nBy user: "******"New User " +
                    "\nOld Username: "******"\nNew Username: "******"\nOld Email: " + this.OldEmail + "\nNew email: " + this.BlogUser.EmailAddress +
                    "\nOld About: " + this.OldAbout + "\nNew About: " + this.BlogUser.About +
                    "\nby user: "******"New Page " +
                //    "\nNew Content: " + this.BlogPage.PageContent +
                //    "\nNew Description: " + this.BlogPage.Description +
                //    "\nNew Title: " + this.BlogPage.PageTitle +
                //    "\nNew Keywords: " + this.BlogPage.Keywords;
                newLog.Message = "New User " +
                    "\nNew Username: "******"\nNew email: " + this.BlogUser.EmailAddress +
                    "\nNew About: " + this.BlogUser.About +
                    "\nby user: " + SessionHandler.CurrentUser.Username;

                this.BlogUser.CreateDate = DateTime.Now;
                this.BlogUser.BlogConfigId = this.blogConfig.BlogConfigId;

                repo.Add(this.BlogUser);
            }
            this.BlogUser.LastUpdateDate = DateTime.Now;
            repo.Add(newLog);

            repo.Save();
        }
        public void SaveEntry()
        {
            //Create new audit record
            var newLog = new BlogLog()
            {
                BlogConfigId = this.blogConfig.BlogConfigId,
                CreateDate = DateTime.Now,
                EventLevel = "Audit",
                Logger = "EntriesEditScreen"
            };

            if (this.BlogEntry.BlogEntryId > 0)
            {
                newLog.Message = "Changing Entry with ID = " + this.BlogEntry.BlogEntryId +
                    "\nOld Text: " + this.OriginalText + " \nNew Text: " + this.BlogEntry.Text +
                    "\nOld Short: " + this.OriginalShort + " \nNew Short: " + this.BlogEntry.Short +
                    "\nOld Title: " + this.OriginalTitle + " \nNew Title: " + this.BlogEntry.Title +
                    "\nOld PostType: " + this.OriginalPostType + " \nNew PostType: " + this.BlogEntry.PostType +
                    "\nOld Keywords: " + this.OriginalKeywords + " \nNew Keywords: " + this.BlogEntry.Keywords +
                    "\nBy user: "******"New Page " +
                    "\nNew Text: " + this.BlogEntry.Text +
                    "\nNew Short: " + this.BlogEntry.Short +
                    "\nNew Title: " + this.BlogEntry.Title +
                    "\nNew PostType: " + this.BlogEntry.PostType +
                    "\nNew Keywords: " + this.BlogEntry.Keywords;

                this.BlogEntry.CreateDate = DateTime.Now;
                this.BlogEntry.BlogAuthorId = SessionHandler.CurrentUserId;
                this.BlogEntry.BlogConfigId = this.blogConfig.BlogConfigId;
                this.BlogEntry.PublishDate = DateTime.Now;
                this.CheckAndUpdateEntryTitle();

                repo.Add(this.BlogEntry);
            }
            this.BlogEntry.LastUpdateDate = DateTime.Now;
            //this.BlogEntry.LastUpdatedById = SessionHandler.CurrentUserId;
            //repo.Add(newLog);

            repo.Save();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the BlogLogs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBlogLogs(BlogLog blogLog)
 {
     base.AddObject("BlogLogs", blogLog);
 }
 /// <summary>
 /// Create a new BlogLog object.
 /// </summary>
 /// <param name="blogLogId">Initial value of the BlogLogId property.</param>
 /// <param name="blogConfigId">Initial value of the BlogConfigId property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 /// <param name="eventLevel">Initial value of the EventLevel property.</param>
 /// <param name="logger">Initial value of the Logger property.</param>
 public static BlogLog CreateBlogLog(global::System.Int64 blogLogId, global::System.Int32 blogConfigId, global::System.DateTime createDate, global::System.String eventLevel, global::System.String logger)
 {
     BlogLog blogLog = new BlogLog();
     blogLog.BlogLogId = blogLogId;
     blogLog.BlogConfigId = blogConfigId;
     blogLog.CreateDate = createDate;
     blogLog.EventLevel = eventLevel;
     blogLog.Logger = logger;
     return blogLog;
 }
 public static BlogLog GetFakeBlogLog(int blogConfigId)
 {
     var blogLog = new BlogLog()
     {
         BlogConfigId = blogConfigId,
         CreateDate = DateTime.Now,
         EventLevel = "Test",
         Exception = "Test",
         Logger = "Test",
         Message = "Test",
         Url = "Test"
     };
     return blogLog;
 }
 public void Delete(BlogLog blogLog)
 {
     db.BlogLogs.DeleteObject(blogLog);
 }
 public void Add(BlogLog blogLog)
 {
     db.BlogLogs.AddObject(blogLog);
 }
 private static BlogLog GetBlogLog(Exception ex, string logger, string level)
 {
     BlogLog log = new BlogLog()
     {
         BlogConfigId = CacheHandler.BlogConfigId,
         CreateDate = DateTime.Now,
         EventLevel = level,
         Exception = GetInfoFromException(ex),
         Message = ex.Message,
         Url = HttpContext.Current.Request.Url.ToString(),
         Logger = logger
     };
     return log;
 }
Exemple #10
0
 private static BlogLog GetBlogLog(string message, string details, string level, string logger)
 {
     BlogLog log = new BlogLog()
     {
         BlogConfigId = CacheHandler.BlogConfigId,
         CreateDate = DateTime.Now,
         EventLevel = level,
         Exception = details,
         Message = message,
         Url = HttpContext.Current.Request.Url.ToString(),
         Logger = logger
     };
     return log;
 }
        public void SavePage()
        {
            //Create new audit record
            var newLog = new BlogLog()
            {
                BlogConfigId = this.blogConfig.BlogConfigId,
                CreateDate = DateTime.Now,
                EventLevel = "Audit",
                Logger = "PagesEditScreen"
            };

            if (this.BlogPage.BlogPageId > 0)
            {
                newLog.Message = "Changing Page with ID = " + this.BlogPage.BlogPageId +
                    "\nOld Content: " + this.OriginalContent + " \nNew Content: " + this.BlogPage.PageContent +
                    "\nOld Description: " + this.OriginalDescription + " \nNew Description: " + this.BlogPage.Description +
                    "\nOld Title: " + this.OriginalTitle + " \nNew Title: " + this.BlogPage.PageTitle +
                    "\nOld Keywords: " + this.OriginalKeywords + " \nNew Keywords: " + this.BlogPage.Keywords +
                    "\nBy user: "******"New Page " +
                    "\nNew Content: " + this.BlogPage.PageContent +
                    "\nNew Description: " + this.BlogPage.Description +
                    "\nNew Title: " + this.BlogPage.PageTitle +
                    "\nNew Keywords: " + this.BlogPage.Keywords;

                this.BlogPage.CreateDate = DateTime.Now;
                this.BlogPage.CreatedById = SessionHandler.CurrentUserId;
                this.BlogPage.BlogConfigId = this.blogConfig.BlogConfigId;
                this.CheckAndUpdateEncodedTitle();

                repo.Add(this.BlogPage);
            }
            this.BlogPage.LastUpdateDate = DateTime.Now;
            this.BlogPage.LastUpdatedById = SessionHandler.CurrentUserId;
            repo.Add(newLog);

            repo.Save();
        }
        public void SaveFeedback()
        {
            //Create new audit record
            var newLog = new BlogLog()
            {
                BlogConfigId = this.blogConfig.BlogConfigId,
                CreateDate = DateTime.Now,
                EventLevel = "Audit",
                Logger = "FeedbacksEditScreen"
            };

            if (this.BlogFeedback.BlogFeedbackId > 0)
            {
                //category = repo.GetBlogCategoryByCategoryId(this.blogConfig.BlogConfigId, this.BlogCategoryId.Value);

                newLog.Message = "Changing Feedback with ID = " + this.BlogFeedback.BlogFeedbackId +
                    "\nOld Body: " + this.OriginalBody + " \nNew Body: " + this.BlogFeedback.Body +
                    "\nOld Status: " + this.OriginalStatus + " \nNew Status: " + this.BlogFeedback.Status +
                    "\nBy user: "******"Not currently capable of adding new feedback here.  Need to handle creating the author (if necessary) or " +
                    " looking up the author from the feedback author table as well as setting all the other inital data");
                newLog.Message = "New Feedback " +
                    "\nNew Body: " + this.BlogFeedback.Body +
                    "\nNew Status: " + this.BlogFeedback.Status;

                this.BlogFeedback.CreateDate = DateTime.Now;

                repo.Add(this.BlogFeedback);
            }
            this.BlogFeedback.LastUpdateDate = DateTime.Now;
            repo.Add(newLog);

            repo.Save();
        }