本文整理汇总了C#中Comment类的典型用法代码示例。如果您正苦于以下问题:C# Comment类的具体用法?C# Comment怎么用?C# Comment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Comment类属于命名空间,在下文中一共展示了Comment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Post
// POST /Api/v1/LogBooks/33/Entries/1/Comments
public HttpResponseMessage Post([FromUri]int? logBookId, [FromUri]int? entryId, CommentInput commentInput)
{
var logBook = base.RavenSession.Load<LogBook>(logBookId);
if (logBook == null)
return NotFound();
if (logBook.IsOwnedBy(base.User.Identity.Name) == false)
return Forbidden();
var entry = logBook.GetEntries()
.SingleOrDefault(x => x.Id == entryId);
if (entry == null)
return NotFound();
var comment = new Comment<Entry>();
commentInput.MapToInstance(comment);
entry.AddComment(comment);
base.RavenSession.Store(logBook);
var commentView = comment.MapTo<LogBookView.CommentView>();
return Created(commentView);
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string strTitle, strDescription, strMetaTitle, strMetaDescription;
if (!string.IsNullOrEmpty(Request.QueryString["tv"]))
{
var oComment = new Comment();
var dv = oComment.CommentSelectOne(Request.QueryString["tv"]).DefaultView;
if (dv != null && dv.Count <= 0) return;
var row = dv[0];
strTitle = Server.HtmlDecode(row["Title"].ToString());
strDescription = Server.HtmlDecode(row["Title"].ToString());
strMetaTitle = Server.HtmlDecode(row["Title"].ToString());
strMetaDescription = Server.HtmlDecode(row["Title"].ToString());
}
else
{
strTitle = strMetaTitle = "Tư Vấn";
strDescription = "";
strMetaDescription = "";
}
Page.Title = !string.IsNullOrEmpty(strMetaTitle) ? strMetaTitle : strTitle;
var meta = new HtmlMeta() { Name = "description", Content = !string.IsNullOrEmpty(strMetaDescription) ? strMetaDescription : strDescription };
Header.Controls.Add(meta);
}
}
示例3: Addcomment
public Comment Addcomment(int pageId, string commentText, string urlstring, string commentId)
{
var commentStore = DynamicDataStoreFactory.Instance.GetStore(typeof(Comment));
string CommentGuid = Guid.NewGuid().ToString();
var comment = new Comment()
{
CommentId = CommentGuid,
CommentText = commentText,
Date = DateTime.Now,
UserName = "AP",
PageId = pageId,
IsCommentDeleted = false,
ParentCommentId = commentId == "" ? "" : commentId
};
commentStore.Save(comment);
{ }
var er = commentStore.Items<Comment>();
var query = from comments in er
where comments.CommentId == CommentGuid
select comments;
var list = query.ToList<Comment>();
return list[0];
}
示例4: CreateComment
/// <summary>
/// Adds a new comment to the database
/// </summary>
public override void CreateComment(Comment commentToCreate)
{
var entity = ConvertCommentToCommentEntity(commentToCreate);
_entities.AddToCommentEntitySet(entity);
_entities.SaveChanges();
}
示例5: Check
/// <summary>
/// Check if comment is spam
/// </summary>
/// <param name="comment">
/// The comment
/// </param>
/// <returns>
/// True if comment is spam
/// </returns>
public bool Check(Comment comment)
{
try
{
var url = string.Format("http://www.stopforumspam.com/api?ip={0}", comment.IP);
var request = (HttpWebRequest)WebRequest.Create(url);
var response = (HttpWebResponse)request.GetResponse();
var responseStream = response.GetResponseStream();
if (responseStream != null)
{
var reader = new StreamReader(responseStream);
var value = reader.ReadToEnd();
reader.Close();
var spam = value.ToLowerInvariant().Contains("<appears>yes</appears>") ? true : false;
// if comment IP appears in the stopforumspam list
// it is for sure spam; no need to pass to others.
passThrough = spam ? false : true;
return spam;
}
return false;
}
catch (Exception e)
{
Utils.Log(string.Format("Error checking stopforumspam.com: {0}", e.Message));
return false;
}
}
示例6: btnlogin_Click
protected void btnlogin_Click(object sender, EventArgs e)
{
if (txtsubject.Text.Trim() == "") {
Alert.Show("กรุณากรอกชื่อเรื่องด้วย !!!");
txtsubject.Focus();
return;
}
if (txtcomment.Text.Trim() == "") {
Alert.Show("กรุณากรอกข้อเสนอแนะด้วย !!!");
txtcomment.Focus();
return;
}
try
{
MemberService service = new MemberService();
Comment _comment = new Comment();
_comment.ID = 1;
_comment.IP = "192.18.1.1";
_comment.Subject = txtsubject.Text.Trim();
_comment.CommentDecription = txtcomment.Text.Trim();
if (service.CreateComment(_comment) == true)
{
clear();
Alert.Show("บันทึกเรียบร้อยแล้ว");
}
}
catch (Exception ex) {
Alert.Show("ไม่สามารถบันทึกได้เนื่องจาก " + ex.Message);
}
}
示例7: Add
public int Add(string commentContent, string creator, int postId)
{
var currentUser = this.users
.All()
.FirstOrDefault(u => u.UserName == creator);
var currentPost = this.posts
.All()
.FirstOrDefault(p => p.PostId == postId);
var newComment = new Comment()
{
CommentContent = commentContent,
User = currentUser,
UserId = currentUser.Id,
Post = currentPost,
PostId = postId
};
this.comments.Add(newComment);
this.comments.SaveChanges();
return newComment.CommentId;
}
示例8: PostComment
public HttpResponseMessage PostComment(Comment comment)
{
comment = repository.Add(comment);
var response = Request.CreateResponse<Comment>(HttpStatusCode.Created, comment);
response.Headers.Location = new Uri(Request.RequestUri, "/api/comments/" + comment.ID.ToString());
return response;
}
示例9: CreatesItem
public void CreatesItem()
{
//Arrange
var context = Context.Create(Utilities.CreateStandardResolver());
var db = Sitecore.Configuration.Factory.GetDatabase("master");
var scContext = new SitecoreService(db);
var parentItem = db.GetItem("/sitecore/content/Tests/Issues/AlexGriciucCreateItemIssue");
var parent = scContext.GetItem<CommentPage>("/sitecore/content/Tests/Issues/AlexGriciucCreateItemIssue");
using (new SecurityDisabler())
{
parentItem.DeleteChildren();
}
var newItem = db.GetItem("/sitecore/content/Tests/Issues/AlexGriciucCreateItemIssue/TestName");
Assert.IsNull(newItem);
//Act
// scContext.GlassContext.Load(new OnDemandLoader<SitecoreTypeConfiguration>(typeof(Comment)));
var newClass = new Comment();
newClass.Name = "TestName";
using (new SecurityDisabler())
{
scContext.Create(parent, newClass);
}
//Asset
newItem = db.GetItem("/sitecore/content/Tests/Issues/AlexGriciucCreateItemIssue/TestName");
Assert.IsNotNull(newItem);
}
示例10: AddComment
public void AddComment(Comment c)
{
alert = new Alert();
alert.CreateDate = c.CreateDate;
if (c.SystemObjectID == 1)
{
_statusUpdateRepository = new StatusUpdateRepository();
StatusUpdate st = _statusUpdateRepository.GetStatusUpdateByID((int)c.SystemObjectRecordID);
account=_accountRepository.GetAccountByID(st.SenderID);
alertMessage = GetProfileUrl(c.CommentByUsername)+" bình luận status của "+ GetProfileUrl(account.UserName)+":" + c.Body;
alert.Message = alertMessage;
alert.AccountID = c.CommentByAccountID;
alert.AlertTypeID = (int)AlertType.AlertTypes.Comment;
SaveAlert(alert);
Notification notification = new Notification();
string notify = "<a href=\"/UserProfile2.aspx?AccountID=" + c.CommentByAccountID.ToString() + "\">" +
c.CommentByUsername + "</a>" +
"vừa mới bình luận status của bạn: " + c.Body;
notification.AccountID = st.SenderID;
notification.CreateDate = c.CreateDate;
notification.IsRead =false;
notification.Body = notify;
_notifycationRepository.SaveNotification(notification);
}
}
示例11: Create
public ActionResult Create(Comment comment, string returlUrl)
{
if (ModelState.IsValid)
{
comment.Date = DateTime.Now;
db.Comments.AddObject(comment);
db.SaveChanges();
var success = String.Format(Resource.CommentSuccess, comment.Author);
if (Request.IsAjaxRequest())
{
return Content(success);
}
TempData["Result"] = success;
return Redirect(returlUrl ?? Url.Action("Index", "About"));
}
else
{
if (Request.IsAjaxRequest())
{
return PartialView("_CommentForm");
}
return View();
}
}
示例12: BindDataToCell
public void BindDataToCell(Comment comment, NSIndexPath indexPath, UITableView tableView)
{
CellUserImageButton.SetUserImage(comment.user);
CellUsernameLabel.SetTitle (comment.user.username);
CellComment.AttributedText = NativeStringUtils.ParseStringForKeywords (comment, comment.text);
CellTimestamp.Text = StringUtils.GetPrettyDateAbs (comment.datestamp);
}
示例13: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
var oComment = new Comment();
string strUserName = User.Identity.Name;
string strLink = Request.Url.Scheme + "://" + Request.Url.Host + Request.RawUrl;
string strPriority = "";
string strIsApproved = "True";
string strIsAvailable = "True";
//Sửa chỗ này, các phần trên để nguyên
string strTitle = Page.Title;
string strContent = TextBox1.Text.Trim();
//End
oComment.CommentInsert(
strUserName,
strLink,
strTitle,
"",
"",
strContent,
strPriority,
strIsApproved,
strIsAvailable
);
}
示例14: CommentDTO
public CommentDTO(Comment cm)
{
NOIDUNG = cm.NOIDUNG;
THOIGIAN = cm.THOIGIAN;
TKCOMMENT = cm.TKCOMMENT;
MAVOUCHERCOMMENT = cm.MAVOUCHERCOMMENT;
}
示例15: getComments
public List<Comment> getComments(int RequestId)
{
List<Comment> _Comments = new List<Comment>();
Query = "SELECT comment.id, comment.userid, comment.statusid, comment.text, comment.datetime FROM Comment WHERE Comment.Id = " + RequestId + " ORDER BY Comment.DateTime";
try
{
Data.SqlCommand cm = new Data.SqlCommand();
cm.CommandText = Query;
Data.SqlDataReader rd = cm.ExecuteReader();
while (rd.Read())
{
Comment _Comment = new Comment();
_Comment.Id = rd.GetInt16(0);
_Comment.User = getUser(rd.GetInt16(1));
_Comment.Status = getStatusById(rd.GetInt16(2));
_Comment.Text = rd.GetString(3);
_Comment.DateTime = rd.GetString(4);
_Comments.Add(_Comment);
}
rd.Close();
}
catch (Exception)
{
throw;
}
return (_Comments);
}