/// <summary> /// 添加评论 /// </summary> protected void SubmitComment() { try { SiteSettingHelper CDHelper = HelperFactory.GetHelper <SiteSettingHelper>(); IAccountHelper AccountHelper = AccountFactory.CreateInstance(); CommentsHelper CommentsHelper = HelperFactory.GetHelper <CommentsHelper>(); Comments cm = new Comments(); DateTime Createdtime = DateTime.Now; if (ArticleIDByRedirect != "") { cm.ArticleID = ArticleIDByRedirect; } else { cm.ArticleID = ArticleID; } if (CDHelper.Config.IsAuditComment) { cm.State = 0; } else { cm.State = 1; } if (IsSignin) { string actID = CurrentAccount; if (We7Helper.IsEmptyID(actID)) { cm.Author = "系统管理员"; } else { Account act = AccountHelper.GetAccount(CurrentAccount, new string[] { "FirstName", "LastName", "LoginName" }); cm.Author = String.Format("{0} {1}({2})", act.LastName, act.FirstName, act.LoginName); } cm.AccountID = actID; } else { cm.Author = Author; cm.AccountID = ""; } cm.Content = Content; cm.Created = Createdtime; cm.ID = We7Helper.CreateNewID(); cm.ArticleName = Title; CommentsHelper.AddComments(cm); Message = CDHelper.Config.IsAuditComment ? "评论发表成功,等待系统审核!" : "发表成功!"; Content = ""; } catch (Exception ex) { Message = ex.Message; } }