本文整理汇总了C#中Comment类的典型用法代码示例。如果您正苦于以下问题:C# Comment类的具体用法?C# Comment怎么用?C# Comment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Comment类属于命名空间,在下文中一共展示了Comment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:GeorgeGoodchild,项目名称:BeatDave,代码行数:27,代码来源:CommentsController.cs
示例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);
}
}
开发者ID:hungtien408,项目名称:web-bezut,代码行数:30,代码来源:tu-van-chi-tiet.aspx.cs
示例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];
}
开发者ID:GitHubAdminADCX,项目名称:Epi2.0,代码行数:30,代码来源:CommentService.svc.cs
示例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();
}
开发者ID:bjeverett,项目名称:asp-net-mvc-unleashed,代码行数:10,代码来源:EntityFrameworkBlogRepository.cs
示例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;
}
}
开发者ID:clpereira2001,项目名称:Lelands-Master,代码行数:42,代码来源:StopForumSpam.cs
示例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);
}
}
开发者ID:marcpiulachs,项目名称:sttproject,代码行数:35,代码来源:comment.aspx.cs
示例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;
}
开发者ID:TelerikWebFormsOrganization,项目名称:SimpleBlogSystem,代码行数:25,代码来源:CommentsService.cs
示例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;
}
开发者ID:Jalalhejazi,项目名称:WebAPI,代码行数:7,代码来源:CommentsController.cs
示例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);
}
开发者ID:JamesHay,项目名称:Glass.Mapper,代码行数:33,代码来源:AlexGriciucCreateItemIssueFixture.cs
示例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);
}
}
开发者ID:SPKT,项目名称:MHX2,代码行数:26,代码来源:AlertService.cs
示例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();
}
}
开发者ID:Yankovsky,项目名称:Shamrock,代码行数:25,代码来源:CommentsController.cs
示例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);
}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:7,代码来源:CommentTableViewCell.cs
示例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
);
}
开发者ID:hungtien408,项目名称:web-bezut,代码行数:26,代码来源:comment-demo.aspx.cs
示例14: CommentDTO
public CommentDTO(Comment cm)
{
NOIDUNG = cm.NOIDUNG;
THOIGIAN = cm.THOIGIAN;
TKCOMMENT = cm.TKCOMMENT;
MAVOUCHERCOMMENT = cm.MAVOUCHERCOMMENT;
}
开发者ID:nlavu,项目名称:muachung-a4,代码行数:7,代码来源:CommentDTO.cs
示例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);
}
开发者ID:christiaandup,项目名称:scn_xxx,代码行数:28,代码来源:Request.cs
示例16: PostComment
public IHttpActionResult PostComment(int eventId, [FromBody] CommmentsResponseModel model)
{
if (!this.ModelState.IsValid)
{
return this.BadRequest(this.ModelState);
}
var eventToJoin = this.data.Events.All().Where(ev => ev.Id == eventId).FirstOrDefault();
if (eventToJoin == null)
{
return this.BadRequest();
}
var currentUserName = this.User.Identity.Name;
var currentUser = this.data.Users.All().Where(u => u.UserName == currentUserName).FirstOrDefault();
var commentToAdd = new Comment
{
Content = model.Content,
DateCreated = DateTime.UtcNow,
EventId = eventToJoin.Id,
AuthorId = currentUser.Id
};
this.data.Comments.Add(commentToAdd);
this.data.Savechanges();
return this.Created("api/commets/{eventId}", new
{
CommentId = commentToAdd.Id
});
}
开发者ID:team-hades,项目名称:EventsSystem,代码行数:33,代码来源:CommentsController.cs
示例17: DetailStoryViewModel
public DetailStoryViewModel()
{
//temp drit
UserStory = new Story();
UserStory.Description = "Random description. blablablablablablabla. blablalbllalblalbal";
UserStory.Title = "Random Title";
User tempUser = new User();
tempUser.UserName = "random username";
tempUser.RealName = "Hans Petter Naumann";
UserStory.Author = tempUser;
UserStory.CreatedDate = DateTime.Now;
Comment c1 = new Comment();
c1.Author = tempUser;
c1.Text = "random comment. blabla";
c1.TimeStamp = DateTime.Now;
Comment c2 = new Comment();
c2.Author = tempUser;
c2.Text = "random comment number 2. blabla";
c2.TimeStamp = DateTime.Now;
UserStory.Comments.Add(c1);
UserStory.Comments.Add(c2);
UserStory.Assignee = tempUser;
}
开发者ID:hansel88,项目名称:appathon,代码行数:27,代码来源:DetailStoryViewModel.cs
示例18: AddCommentOnFirstParagraph
// Insert a comment on the first paragraph.
public static void AddCommentOnFirstParagraph(string fileName,
string author, string initials, string comment)
{
// Use the file name and path passed in as an
// argument to open an existing Wordprocessing document.
using (WordprocessingDocument document =
WordprocessingDocument.Open(fileName, true))
{
// Locate the first paragraph in the document.
Paragraph firstParagraph =
document.MainDocumentPart.Document.Descendants<Paragraph>().First();
Comments comments = null;
string id = "0";
// Verify that the document contains a
// WordProcessingCommentsPart part; if not, add a new one.
if (document.MainDocumentPart.GetPartsCountOfType<WordprocessingCommentsPart>() > 0)
{
comments =
document.MainDocumentPart.WordprocessingCommentsPart.Comments;
if (comments.HasChildren)
{
// Obtain an unused ID.
id = comments.Descendants<Comment>().Select(e => e.Id.Value).Max();
}
}
else
{
// No WordprocessingCommentsPart part exists, so add one to the package.
WordprocessingCommentsPart commentPart =
document.MainDocumentPart.AddNewPart<WordprocessingCommentsPart>();
commentPart.Comments = new Comments();
comments = commentPart.Comments;
}
// Compose a new Comment and add it to the Comments part.
Paragraph p = new Paragraph(new Run(new Text(comment)));
Comment cmt =
new Comment()
{
Id = id,
Author = author,
Initials = initials,
Date = DateTime.Now
};
cmt.AppendChild(p);
comments.AppendChild(cmt);
comments.Save();
// Specify the text range for the Comment.
// Insert the new CommentRangeStart before the first run of paragraph.
firstParagraph.InsertBefore(new CommentRangeStart() { Id = id }, firstParagraph.GetFirstChild<Run>());
// Insert the new CommentRangeEnd after last run of paragraph.
var cmtEnd = firstParagraph.InsertAfter(new CommentRangeEnd() { Id = id }, firstParagraph.Elements<Run>().Last());
// Compose a run with CommentReference and insert it.
firstParagraph.InsertAfter(new Run(new CommentReference() { Id = id }), cmtEnd);
}
}
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:61,代码来源:Program.cs
示例19: mapCommentEntityToModel
public static CommentServiceModel mapCommentEntityToModel(Comment comment)
{
CommentServiceModel model = new CommentServiceModel();
model.comment = comment.Comment1;
model.id = comment.Id;
return model;
}
开发者ID:adramalech,项目名称:KolabApp,代码行数:7,代码来源:DefectUtil.cs
示例20: AddNew
public Comment AddNew(Comment toAdd)
{
this.comments.Add(toAdd);
this.comments.Save();
return toAdd;
}
开发者ID:IvoPaunov,项目名称:Course-Project-ASP.NET-MVC,代码行数:7,代码来源:CommentsService.cs
注:本文中的Comment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论