public CommentsList SelectAll() { lcomments = new CommentsList(); cmd.CommandText = "SELECT * From Comment"; lcomments = new CommentsList(base.Select()); return(lcomments); }
public CommentsList CommentsByLocation(Location l) { cmd.CommandText = "SELECT * From Comment WHERE Location =@l"; cmd.Parameters.Add(new OleDbParameter("@l", l.ID)); lcomments = new CommentsList(base.Select()); return(lcomments); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Details); // Retrieve navigation parameter and set as current "DataContext" Vm = GlobalNavigation.GetAndRemoveParameter <FlowerViewModel>(Intent); var headerView = LayoutInflater.Inflate(Resource.Layout.CommentsListHeaderView, null); headerView.FindViewById <TextView>(Resource.Id.NameText).Text = Vm.Model.Name; headerView.FindViewById <TextView>(Resource.Id.DescriptionText).Text = Vm.Model.Description; CommentsList.AddHeaderView(headerView); CommentsList.Adapter = Vm.Model.Comments.GetAdapter(GetCommentTemplate); ImageDownloader.AssignImageAsync(FlowerImageView, Vm.Model.Image, this); AddCommentButton.SetCommand(Vm.AddCommentCommand); // Subscribing to events to avoid linker issues in release mode --------------------------------- // This "fools" the linker into believing that the events are used. // In fact we don't even subscribe to them. // See https://developer.xamarin.com/guides/android/advanced_topics/linking/ if (_falseFlag) { AddCommentButton.Click += (s, e) => { }; } }
private string GetHTMLComment(Comment comment, bool isPreview) { var creator = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo; var info = new CommentInfo { CommentID = comment.ID.ToString(), UserID = comment.CreateBy, TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), UserPost = creator.Title, Inactive = comment.Inactive, CommentBody = comment.Content, UserFullName = DisplayUserSettings.GetFullUserName(creator), UserAvatar = Global.GetHTMLUserAvatar(creator) }; var defComment = new CommentsList(); ConfigureComments(defComment, null); if (!isPreview) { info.IsRead = true; info.IsEditPermissions = ProjectSecurity.CanEditComment(Task.Project, comment); info.IsResponsePermissions = ProjectSecurity.CanCreateComment(); } return(CommentsHelper.GetOneCommentHtmlWithContainer( defComment, info, comment.Parent == Guid.Empty, false)); }
private static string GetHTMLComment(Comment comment, bool isPreview) { var info = new CommentInfo { CommentID = comment.ID.ToString(), UserID = comment.UserID, TimeStamp = comment.Datetime, TimeStampStr = comment.Datetime.Ago(), IsRead = true, Inactive = comment.Inactive, CommentBody = comment.Content, UserFullName = DisplayUserSettings.GetFullUserName(comment.UserID), UserAvatar = ImageHTMLHelper.GetHTMLUserAvatar(comment.UserID), UserPost = CoreContext.UserManager.GetUsers(comment.UserID).Title }; if (!isPreview) { info.IsEditPermissions = CommunitySecurity.CheckPermissions(comment, Constants.Action_EditRemoveComment); info.IsResponsePermissions = CommunitySecurity.CheckPermissions(comment.Post, Constants.Action_AddComment); } var defComment = new CommentsList(); ConfigureComments(defComment, 0, null); return(CommentsHelper.GetOneCommentHtmlWithContainer( defComment, info, comment.IsRoot(), false)); }
public string GetPreview(string text, string commentID) { var storage = FeedStorageFactory.Create(); var comment = new FeedComment(1) { Date = TenantUtil.DateTimeNow(), Creator = SecurityContext.CurrentAccount.ID.ToString() }; if (!string.IsNullOrEmpty(commentID)) { comment = storage.GetFeedComment(long.Parse(commentID, CultureInfo.CurrentCulture)); } comment.Comment = text; var commentInfo = GetCommentInfo(comment); commentInfo.IsEditPermissions = false; commentInfo.IsResponsePermissions = false; var defComment = new CommentsList(); ConfigureComments(defComment, null); return(CommentsHelper.GetOneCommentHtmlWithContainer( defComment, commentInfo, true, false)); }
private string GetHTMLComment(Comment comment, bool isPreview) { var info = new CommentInfo { CommentID = comment.Id.ToString(), UserID = new Guid(comment.UserID), TimeStamp = comment.Timestamp, TimeStampStr = comment.Timestamp.Ago(), IsRead = true, Inactive = comment.Inactive, CommentBody = comment.Text, UserFullName = DisplayUserSettings.GetFullUserName(new Guid(comment.UserID)), UserAvatar = ImageHTMLHelper.GetHTMLImgUserAvatar(new Guid(comment.UserID)), UserPost = CoreContext.UserManager.GetUsers(new Guid(comment.UserID)).Title }; if (!isPreview) { info.IsEditPermissions = CommunitySecurity.CheckPermissions(image, PhotoConst.Action_EditRemoveComment); info.IsResponsePermissions = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddComment); } var defComment = new CommentsList(); ConfigureCommentsList(defComment, null); return(Web.Controls.CommentInfoHelper.CommentsHelper.GetOneCommentHtmlWithContainer(defComment, info, comment.ParentId <= 0, false)); }
protected override void InitBindings() { Bindings.Add(this.SetBinding(() => ViewModel.Comments).WhenSourceChanges(() => { CommentsList.ClearFlingAdapter(); CommentsList.InjectFlingAdapter(ViewModel.Comments, view => new CommentViewHolder(view), DataTemplateFull, DataTemplateFling, DataTemplateBasic, ContainerTemplate, null, false, OnScrolled); })); Bindings.Add(this.SetBinding(() => ViewModel.LoadingComments).WhenSourceChanges(() => { if (ViewModel.LoadingComments) { LoadingMoreBar.Visibility = ViewStates.Visible; } else { LoadingMoreBar.Visibility = ViewStates.Gone; OnScrolled(); } })); Bindings.Add( this.SetBinding(() => ViewModel.CommentInput, () => CommentTextBox.Text, BindingMode.TwoWay)); CommentButton.SetOnClickListener(new OnClickListener(view => ViewModel.PostCommentCommand.Execute(null))); var refresh = RootView as ScrollableSwipeToRefreshLayout; refresh.ScrollingView = CommentsList; refresh.Refresh -= RefreshOnRefresh; refresh.Refresh += RefreshOnRefresh; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Details); // Retrieve navigation parameter and set as current "DataContext" Vm = GlobalNavigation.GetAndRemoveParameter <FlowerViewModel>(Intent); var headerView = LayoutInflater.Inflate(Resource.Layout.CommentsListHeaderView, null); headerView.FindViewById <TextView>(Resource.Id.NameText).Text = Vm.Model.Name; headerView.FindViewById <TextView>(Resource.Id.DescriptionText).Text = Vm.Model.Description; CommentsList.AddHeaderView(headerView); CommentsList.Adapter = Vm.Model.Comments.GetAdapter(GetCommentTemplate); ImageDownloader.AssignImageAsync(FlowerImageView, Vm.Model.Image, this); // Avoid aggressive linker problem which removes the Click event AddCommentButton.Click += (s, e) => { }; AddCommentButton.SetCommand( "Click", Vm.AddCommentCommand); }
protected override async void OnExit(object sender, RoutedEventArgs e) { base.OnExit(sender, e); await StorageManager.SetPostCommentDraft( SettingsManager.PersistentSettings.CurrentUser.Id, ViewModel.CurrentPostData.Id, WriteComment.CommentText, WriteComment.IsAnonymous) .ConfigureAwait(true); CommentsList.CommentsWrapPanel.Children.Clear(); CommentsList.UpdateLayout(); UpdateLayout(); GC.WaitForPendingFinalizers(); GC.Collect(); if (!IsOnExitActive) { e.Handled = true; return; } }
protected void displayComments() { DataSet ds = this.ConnSQL.getComemnts(Request.QueryString["id"].ToString()); CommentsList.DataSource = ds.Tables["comments"].DefaultView; CommentsList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { getUserId(); if (Session["User"] != null) { //cmtComment.Text = "Please login to comment"; //btnSubmit.Visible = false; User user = (User)Session["User"]; ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:UserSignedIn(); ", true); } if (Request.QueryString["postId"] != null) { Guid postId = new Guid(Request.QueryString["postId"]); CommentsList comments = new CommentsList(); comments = comments.GetByPostId(postId); Post post = new Post(); post = post.GetById(postId); //imgPost.ImageUrl = post.ImagePath; //lblHeader.Text = string.Format("Posted by: {0}", post.UserName); //lblTitle.Text = string.Format("Title: {0}", post.Title); //lblDescription.Text = string.Format("Description: {0}", post.Description); MasterPage masterpage = Page.Master; HtmlAnchor anchor = (HtmlAnchor)masterpage.FindControl("ancLogin"); anchor.HRef = "/Account/Login.aspx?returnURL=/ExpandedPost.aspx?postId=" + postId; } }
public static CommentsList CommentsGetDefault() { var commentList = new CommentsList(); CommentsConfigure(commentList); return(commentList); }
public AjaxResponse AddComment(string parentCommentId, string newsId, string text, string pid) { var resp = new AjaxResponse { rs1 = parentCommentId }; var comment = new FeedComment(long.Parse(newsId)); comment.Comment = text; var storage = FeedStorageFactory.Create(); if (!string.IsNullOrEmpty(parentCommentId)) { comment.ParentId = Convert.ToInt64(parentCommentId); } var feed = storage.GetFeed(long.Parse(newsId, CultureInfo.CurrentCulture)); comment = storage.SaveFeedComment(feed, comment); var commentInfo = GetCommentInfo(comment); var defComment = new CommentsList(); ConfigureComments(defComment, feed); var visibleCommentsCount = 0; storage.GetFeedComments(feed.Id).ForEach((cmm) => { visibleCommentsCount += (cmm.Inactive ? 0 : 1); }); resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer( defComment, commentInfo, comment.IsRoot(), visibleCommentsCount % 2 == 1); return(resp); }
public CommentsList CommentsByPerson(Person p) { cmd.CommandText = "SELECT * From Comment WHERE Creator =@p"; cmd.Parameters.Add(new OleDbParameter("@p", p.ID)); lcomments = new CommentsList(base.Select()); return(lcomments); }
public ActionResult AddComment(int weaponID, String comment) { Avatar avatar = Session[SessionKey.AvatarKey] as Avatar; CommentsList comlist = new CommentsList(); comlist.WeaponID = weaponID; comlist.Comments = comment; comlist.CreateTS = DateTime.Now; comlist.AreaID = avatar.GameAreaID; comlist.AvatarID = avatar.AvatarID; if (!CheckText(comlist.Comments, 200, false)) { return(Jsonp(ErrorCode.CommentError, null)); } else { int result = WeapDesignBll.AddCommentsList(comlist); if (result > 0) { return(Jsonp(ErrorCode.Succuess, null)); } else { return(Jsonp(ErrorCode.AddCommentError, null)); } } }
public AjaxResponse AddComment(string parentCommentId, string pageName, string text, string pid) { text = HtmlUtility.GetFull(text); var resp = new AjaxResponse(); resp.rs1 = parentCommentId; var parentIdGuid = String.IsNullOrEmpty(parentCommentId) ? Guid.Empty : new Guid(parentCommentId); var newComment = Wiki.CreateComment(new Comment { Body = text, PageName = pageName, ParentId = parentIdGuid }); var info = GetCommentInfo(newComment); var defComment = new CommentsList(); ConfigureComments(defComment, pageName); var visibleCommentsCount = Wiki.GetComments(pageName).Count; resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer( defComment, info, string.IsNullOrEmpty(parentCommentId), visibleCommentsCount % 2 == 1); return(resp); }
private string GetHTMLComment(Comment comment) { var creator = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo; var oCommentInfo = new CommentInfo { TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), CommentBody = comment.Content, CommentID = comment.ID.ToString(), UserID = comment.CreateBy, UserFullName = creator.DisplayUserName(), Inactive = comment.Inactive, IsEditPermissions = ProjectSecurity.CanEditComment(Task != null ? Task.Project : null, comment), IsResponsePermissions = ProjectSecurity.CanCreateComment(), IsRead = true, UserAvatar = Global.GetHTMLUserAvatar(creator), UserPost = creator.Title }; if (commentList == null) { commentList = new CommentsList(); ConfigureComments(commentList, null); } return(CommentsHelper.GetOneCommentHtmlWithContainer( commentList, oCommentInfo, comment.Parent == Guid.Empty, false)); }
public override void Delete(BaseEntity entity) { Person u = entity as Person; GroupUserDB gudb = new GroupUserDB(); GroupUserList gul = new GroupUserList(); gul = gudb.SelectByPerson(u); foreach (GroupUser g in gul) { gudb.Delete(g); } CommentsDB cdb = new CommentsDB(); CommentsList lc = cdb.CommentsByPerson(u); foreach (Comments c in lc) { cdb.Delete(c); } MsgsDB mdb = new MsgsDB(); MsgsList ml = new MsgsList(); ml = mdb.MsgsBySender(u); foreach (Msgs m in ml) { mdb.Delete(m); } base.Delete(entity); }
protected void Post_Click(object sender, EventArgs e) { string connectionString = WebConfigurationManager.ConnectionStrings["photocatconnection"].ConnectionString; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); string commentdata = CommentBox.Text; int photodata = int.Parse(Request.QueryString["photoID"]); DateTime dateNow = DateTime.Now; int id = (int)Session["id"]; string query = "INSERT INTO Comments (CmtText, PhotoId, UserId) VALUES ('" + commentdata + "', '" + photodata + "', '" + id + "')"; SqlCommand myCommand = new SqlCommand(query, myConnection); myCommand.ExecuteNonQuery(); CommentBox.Text = ""; CommentsList.DataBind(); myConnection.Close(); }
private string GetHTMLComment(string text, string commentID) { Comment comment = new Comment() { Content = text, Datetime = ASC.Core.Tenants.TenantUtil.DateTimeNow(), UserID = SecurityContext.CurrentAccount.ID }; if (!String.IsNullOrEmpty(commentID)) { comment = ServiceHelper.GetCommentById(commentID); comment.Content = text; comment.Parent = string.Empty; } var defComment = new CommentsList(); ConfigureComments(defComment); ASC.Web.Controls.CommentInfoHelper.CommentInfo ci = BookmarkingConverter.ConvertComment(comment, BookmarkingServiceHelper.GetCurrentInstanse().BookmarkToAdd.Comments); ci.IsEditPermissions = false; ci.IsResponsePermissions = false; bool isRoot = string.IsNullOrEmpty(comment.Parent) || comment.Parent.Equals(Guid.Empty.ToString(), StringComparison.CurrentCultureIgnoreCase); return(ASC.Web.Controls.CommentInfoHelper.CommentsHelper.GetOneCommentHtmlWithContainer( defComment, ci, isRoot, false)); }
public string GetUserCommentsById(string userId) { CommentsList commentsList = new CommentsList(); commentsList = commentsList.GetByUserId(new Guid(userId)); return(JsonConvert.SerializeObject(commentsList.List)); }
public CommentsList SelectCbyP(Person p) { CommentsDB db = new CommentsDB(); CommentsList l = new CommentsList(); l = db.CommentsByPerson(p); return(l); }
public CommentsList SelectAllC() { CommentsDB db = new CommentsDB(); CommentsList l = new CommentsList(); l = db.SelectAll(); return(l); }
public AjaxResponse AddComment(string parrentCommentID, string photoID, string text, string pid) { var resp = new AjaxResponse { rs1 = parrentCommentID }; CommunitySecurity.DemandPermissions(PhotoConst.Action_AddComment); var storage = StorageFactory.GetStorage(); image = storage.GetAlbumItem(Convert.ToInt64(photoID)); var newComment = new Comment(image.Id) { Text = text, Timestamp = ASC.Core.Tenants.TenantUtil.DateTimeNow(), UserID = SecurityContext.CurrentAccount.ID.ToString() }; if (!string.IsNullOrEmpty(parrentCommentID)) { newComment.ParentId = Convert.ToInt64(parrentCommentID); } var count = storage.SaveComment(image, newComment); storage.ReadAlbumItem(newComment.ItemID, SecurityContext.CurrentAccount.ID.ToString()); var odd = count % 2 == 1; var comment = newComment; var info = new CommentInfo { CommentID = comment.Id.ToString(), UserID = new Guid(comment.UserID), TimeStampStr = comment.Timestamp.Ago(), IsRead = true, Inactive = comment.Inactive, CommentBody = comment.Text, UserFullName = DisplayUserSettings.GetFullUserName(new Guid(comment.UserID)), UserAvatar = ImageHTMLHelper.GetHTMLImgUserAvatar(new Guid(comment.UserID)), UserPost = CoreContext.UserManager.GetUsers(new Guid(comment.UserID)).Title, IsEditPermissions = CommunitySecurity.CheckPermissions(image, PhotoConst.Action_EditRemoveComment), IsResponsePermissions = CommunitySecurity.CheckPermissions(PhotoConst.Action_AddComment) }; //postParser.Parse(comment.Text); var defComment = new CommentsList(); ConfigureCommentsList(defComment, image); resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer(defComment, info, newComment.ParentId == 0, odd); return(resp); }
public string GetRepliesByParentId(string parentId) { CommentsList comments = new CommentsList(); comments = comments.GetByParentId(new Guid(parentId)); string jsoncomments = JsonConvert.SerializeObject(comments.List); return(jsoncomments); }
public String GetCommentsByPostId(string postId) { CommentsList comments = new CommentsList(); comments = comments.GetByPostId(new Guid(postId)); string jsoncomments = JsonConvert.SerializeObject(comments.List); return(jsoncomments); }
public string GetPreview(string text, string commentID) { var info = GetPrevHTMLComment(text, commentID); var defComment = new CommentsList(); ConfigureComments(defComment, null); return(CommentsHelper.GetOneCommentHtmlWithContainer(defComment, info, true, false)); }
public List<CommentDetailsResponse> Get(CommentsList request) { var issue = IssueRepository.GetById(request.Id); if (issue == null) throw HttpError.NotFound("Issue does not exist: " + request.Id); var comments = CommentRepository.GetForIssue(issue.Id); return comments.Select(ToCommentDetails).ToList(); }
private static void ConfigureComments(CommentsList commentList, FeedNS.Feed feed) { CommonControlsConfigurer.CommentsConfigure(commentList); commentList.BehaviorID = "_commentsObj"; commentList.FckDomainName = "news_comments"; commentList.ModuleName = "news"; commentList.ObjectID = feed != null?feed.Id.ToString(CultureInfo.CurrentCulture) : ""; }
private static void ConfigureComments(CommentsList commentList) { CommonControlsConfigurer.CommentsConfigure(commentList); commentList.BehaviorID = "_commentsWikiObj"; commentList.IsShowAddCommentBtn = CommunitySecurity.CheckPermissions(Common.Constants.Action_AddComment); commentList.ModuleName = "wiki"; commentList.FckDomainName = "wiki_comments"; commentList.ObjectID = "wiki_page"; }
public void CommentsReadBySite_ValidCache_ReturnsValidList() { var lastUpdate = DateTime.Now.AddDays(1); var comments = new Comments(null, null, null, null); var validCommentsList = new CommentsList {comments = new List<CommentInfo>()}; var siteList = mocks.DynamicMock<ISiteList>(); var readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>(); var site = mocks.DynamicMock<ISite>(); var readerComments = mocks.DynamicMock<IDnaDataReader>(); var readerLastUpdate = mocks.DynamicMock<IDnaDataReader>(); var cacheManager = mocks.DynamicMock<ICacheManager>(); var siteName = "h2g2"; string cacheKey = comments.CommentListCacheKey(0, ""); cacheManager.Stub(x => x.GetData(cacheKey)).Return(validCommentsList); cacheManager.Stub(x => x.GetData(cacheKey + "|LASTUPDATED")).Return(lastUpdate); site.Stub(x => x.ModerationStatus).Return(ModerationStatus.SiteStatus.UnMod); site.Stub(x => x.IsEmergencyClosed).Return(false); site.Stub(x => x.IsSiteScheduledClosed(DateTime.Now)).Return(false); readerComments.Stub(x => x.HasRows).Return(true); readerComments.Stub(x => x.Read()).Return(true).Repeat.Once(); readerComments.Stub(x => x.GetInt32NullAsZero("totalresults")).Return(1); readerCreator.Stub(x => x.CreateDnaDataReader("commentsreadbysitename")).Return(readerComments); readerCreator.Stub(x => x.CreateDnaDataReader("commentsgetlastupdatebysite")).Return(readerLastUpdate); readerLastUpdate.Stub(x => x.HasRows).Return(true); readerLastUpdate.Stub(x => x.Read()).Return(true).Repeat.Once(); readerLastUpdate.Stub(x => x.GetDateTime("lastupdated")).Return(lastUpdate); siteList.Stub(x => x.GetSite(siteName)).Return(site); mocks.ReplayAll(); comments = new Comments(null, readerCreator, cacheManager, siteList); var commentList = comments.GetCommentsListBySite(site); Assert.IsNotNull(commentList); readerCreator.AssertWasNotCalled(x => x.CreateDnaDataReader("commentsreadbysitename")); }