private void SaveButton_Click(object sender, EventArgs e) { var commentProvider = new CommentProvider(); var request = new CommentCreateRequest(); request.Body = CommentBodyTextBox.Text; request.CreatedBy = FormHelper.Username; request.WallPostId = FormId; commentProvider.AddComment(request); var feedProvider = new NewsfeedProvider(); var newsFeedEntry = new NewsfeedItem { By = FormHelper.Username, ReferencePostId = FormId, FeedType = NewsfeedActionType.comment, WallOwner = new Core.Models.Wall.NewsfeedWallModel { IsPublic = true, OwnerId = FormHelper.Username, WallOwnerType = Core.Models.Wall.WallType.user } }; feedProvider.AddNewsfeedItem(newsFeedEntry); this.Close(); }
// // GET: /Posts/ public ActionResult Index(int?Id) { int id = 0; if (Id != 0 && Id != null) { id = (int)Id; tbl_Post p = PostProvider.GetPost(id); List <tbl_Comment> c = CommentProvider.GetAllCommentByPostId(id); PostModel _PostModel = new PostModel { Id = p.Id, ContentMsg = p.ContentMsg, Title = p.Title, UpdatedBy = p.UpdatedBy }; List <CommentModel> _commentModel = (from temp in c select new CommentModel { Id = temp.Id, CommentText = temp.CommentText, PostId = temp.PostId, CommentedBy = temp.CommentedBy }).ToList(); PostViewModel Model = new PostViewModel(); Model.Comments = _commentModel; Model.Post = _PostModel; return(View(Model)); } else { return(View()); } }
public FlvDownloader(string roomid, string savePath, bool saveComment, CommentProvider cmtProvider) { _roomid = roomid; _savePath = savePath; _saveComment = saveComment; _cmtProvider = cmtProvider; }
public async void Init() { await RefreshInfo(); commentProvider = ReceiveComment(); init_ready = true; }
public async Task ConnectedEventTest() { var options = new Mock <ICommentOptions>(); var serverMock = new Mock <IYouTubeLibeServer>(); serverMock.Setup(s => s.GetEnAsync("https://www.youtube.com/channel/UCv1fFr156jc65EMiLbaLImw/live")).Returns(Task.FromResult(Tools.GetSampleData("Channel_live.txt"))); serverMock.Setup(s => s.GetAsync("https://www.youtube.com/live_chat?v=klvzbBP7zM8&is_popout=1", It.Is <CookieContainer>(c => true))).Returns(Task.FromResult(Tools.GetSampleData("LiveChat.txt"))); var siteOptions = new YouTubeLiveSiteOptions(); var logger = new Mock <ILogger>(); var userStore = new Mock <IUserStoreManager>(); var broweserProfileMock = new Mock <IBrowserProfile>(); broweserProfileMock.Setup(x => x.GetCookieCollection(It.IsAny <string>())).Returns(new List <Cookie>()); var b = false; var cp = new CommentProvider(options.Object, serverMock.Object, siteOptions, logger.Object, userStore.Object); cp.Connected += (s, e) => { b = e.IsInputStoringNeeded; }; await cp.ConnectAsync("https://www.youtube.com/channel/UCv1fFr156jc65EMiLbaLImw", broweserProfileMock.Object); Assert.IsTrue(b); }
public CommentBuilder(string xmlPath, long nowTime, CommentProvider cmtProvider) { _xmlPath = xmlPath; _nowTime = nowTime; _cmtProvider = cmtProvider; _cmtQueue = new ConcurrentQueue <CommentModel>(); }
public void ConvertToModelTest() { CommentProvider target = new CommentProvider(); // TODO: Initialize to an appropriate value baseCommentView item = _baseCommentView; Comment expected = _Comment; Comment actual; actual = target.ConvertToModel(item); CompareModelObject(expected, actual); }
public PartialViewResult SubmitComment(string commenttext) { List <tbl_Comment> c = CommentProvider.GetAllCommentByPostId(1); List <CommentModel> _commentModel = (from temp in c select new CommentModel { Id = temp.Id, CommentText = temp.CommentText, PostId = temp.PostId, CommentedBy = temp.CommentedBy }).ToList(); _commentModel.Add(new CommentModel { CommentText = commenttext }); return(PartialView("_Comment", _commentModel)); }
public void GetCommentTest() { CommentProvider target = new CommentProvider(); // TODO: Initialize to an appropriate value int id = 0; // TODO: Initialize to an appropriate value baseCommentView expected = null; // TODO: Initialize to an appropriate value baseCommentView actual; actual = target.GetComment(id); Assert.AreEqual(expected.Description, actual.Description); Assert.AreEqual(expected.ID, actual.ID); Assert.AreEqual(expected.RequirementID, actual.RequirementID); }
public object CommentMerge(string content, int productID, int userID, int rating, int reply) { Comment comment = new Comment() { ProductID = productID, UserID = userID, Content = content, Rating = rating, Reply = reply }; return(JsonConvert.SerializeObject(CommentProvider.commentMerge(dbConnection, comment))); }
private CommentProvider ReceiveComment() { try { _commentProvider = new CommentProvider(_roomid, _mw); _commentProvider.OnDisconnected += CommentProvider_OnDisconnected; _commentProvider.OnReceivedRoomCount += CommentProvider_OnReceivedRoomCount; _commentProvider.OnReceivedComment += CommentProvider_OnReceivedComment; _commentProvider.Connect(); return(_commentProvider); }catch (Exception e) { _mw.AppendLogln("ERROR", "弹幕服务器出错:" + e.Message); return(null); } }
public async Task GetCurrentUserInfoAsync_NotLoggedInTest() { var data = Tools.GetSampleData("Embed_notloggedin.txt"); var options = new Mock <ICommentOptions>(); var serverMock = new Mock <IYouTubeLibeServer>(); serverMock.Setup(s => s.GetAsync(It.IsAny <string>(), It.IsAny <CookieContainer>())).Returns(Task.FromResult(data)); var siteOptions = new YouTubeLiveSiteOptions(); var loggerMock = new Mock <ILogger>(); var userStore = new Mock <IUserStoreManager>(); var broweserProfileMock = new Mock <IBrowserProfile>(); var cp = new CommentProvider(options.Object, serverMock.Object, siteOptions, loggerMock.Object, userStore.Object); var info = await cp.GetCurrentUserInfo(broweserProfileMock.Object); Assert.IsFalse(info.IsLoggedIn); }
public void ConvertToViewTest() { CommentProvider target = new CommentProvider(); // TODO: Initialize to an appropriate value baseCommentView expected = new baseCommentView() { Description = "Description", ID = 1, RequirementID = 1 }; // TODO: Initialize to an appropriate value Comment item = new Comment() { Description = "Description", ID = 1, RequirementID = 1 }; baseCommentView actual; actual = target.ConvertToView(item); CompareViewObject(expected, actual); }
private CommentProvider ReceiveComment() { try { var _commentProvider = new CommentProvider(realRoomid); _commentProvider.OnDisconnected += CommentProvider_OnDisconnected; _commentProvider.OnReceivedRoomCount += CommentProvider_OnReceivedRoomCount; _commentProvider.OnReceivedComment += CommentProvider_OnReceivedComment; _commentProvider.Connect(); return(_commentProvider); } catch (Exception e) { InfoLogger.SendInfo(Roomid, "ERROR", "弹幕服务器出错:" + e.Message); return(null); } }
public async void Init() { PropertyChange("TimelineType"); PropertyChange("RecordStatus"); RecordSize = "0B"; PropertyChange("RecordSize"); RecordTime = "0:00:00.0"; PropertyChange("RecordTime"); BitRate = "0Kbps"; PropertyChange("BitRate"); OnlineValue = "1"; PropertyChange("OnlineValue"); await RefreshInfo(); commentProvider = ReceiveComment(); init_ready = true; }
public void ConvertToViewListTest() { CommentProvider target = new CommentProvider(); // TODO: Initialize to an appropriate value List <Comment> itemlist = new List <Comment>(); itemlist.Add(_Comment); itemlist.Add(_Comment); List <baseCommentView> expected = new List <baseCommentView>(); expected.Add(_baseCommentView); expected.Add(_baseCommentView); List <baseCommentView> actual; actual = target.ConvertToViewList(itemlist); Assert.AreEqual(expected.Count, actual.Count); CompareViewObject(expected[0], actual[0]); CompareViewObject(expected[1], actual[1]); }
private void InitializeComments() { var provider = new CommentProvider(); var comments = provider.GetComments(FormId, 0, 1000); CommentsGridView.Columns.Add("Id", "Id"); CommentsGridView.Columns.Add("Body", "İçerik"); CommentsGridView.Columns.Add("CreatedBy", "Paylaşan"); CommentsGridView.Columns.Add("CreatedDate", "Paylaşım Tarihi"); CommentsGridView.Columns.Add("ModifiedDate", "Güncellenme Tarihi"); CommentsGridView.Columns.Add("LikeCount", "Beğeni Sayısı"); var likeButton = new DataGridViewCheckBoxColumn(); likeButton.Name = "Like"; likeButton.HeaderText = "Beğen"; CommentsGridView.Columns.Add(likeButton); foreach (var comment in comments) { CommentsGridView.Rows.Add(comment.Id, comment.Body, comment.CreatedBy, comment.CreatedDate, comment.ModifiedDate, comment.LikeCount, false); } }
private async Task GenerateAsyncCore(string projectPath, string baseNamespace, CancellationToken cancellationToken) { var projectFileInfo = FileSystem.FileInfo.FromFileName(projectPath); if (projectFileInfo.Exists) { projectFileInfo.Delete(); } if (!projectFileInfo.Directory.Exists) { projectFileInfo.Directory.Create(); } FileSystem.File.WriteAllText(projectPath, ProjectDefinition); var tableGenerator = new PocoTableGenerator(FileSystem, NameTranslator, baseNamespace); var viewGenerator = new PocoViewGenerator(FileSystem, NameTranslator, baseNamespace); var tables = await Database.GetAllTables(cancellationToken).ToListAsync(cancellationToken).ConfigureAwait(false); var comments = await CommentProvider.GetAllTableComments(cancellationToken).ToListAsync(cancellationToken).ConfigureAwait(false); var tableCommentsLookup = new Dictionary <Identifier, IRelationalDatabaseTableComments>(); foreach (var comment in comments) { tableCommentsLookup[comment.TableName] = comment; } var views = await Database.GetAllViews(cancellationToken).ToListAsync(cancellationToken).ConfigureAwait(false); var viewComments = await CommentProvider.GetAllViewComments(cancellationToken).ToListAsync(cancellationToken).ConfigureAwait(false); var viewCommentsLookup = new Dictionary <Identifier, IDatabaseViewComments>(); foreach (var comment in viewComments) { viewCommentsLookup[comment.ViewName] = comment; } foreach (var table in tables) { var tableComment = tableCommentsLookup.ContainsKey(table.Name) ? Option <IRelationalDatabaseTableComments> .Some(tableCommentsLookup[table.Name]) : Option <IRelationalDatabaseTableComments> .None; var tableClass = tableGenerator.Generate(tables, table, tableComment); var tablePath = tableGenerator.GetFilePath(projectFileInfo.Directory, table.Name); if (!tablePath.Directory.Exists) { tablePath.Directory.Create(); } if (tablePath.Exists) { tablePath.Delete(); } FileSystem.File.WriteAllText(tablePath.FullName, tableClass); } foreach (var view in views) { var viewComment = viewCommentsLookup.ContainsKey(view.Name) ? Option <IDatabaseViewComments> .Some(viewCommentsLookup[view.Name]) : Option <IDatabaseViewComments> .None; var viewClass = viewGenerator.Generate(view, viewComment); var viewPath = viewGenerator.GetFilePath(projectFileInfo.Directory, view.Name); if (!viewPath.Directory.Exists) { viewPath.Directory.Create(); } if (viewPath.Exists) { viewPath.Delete(); } FileSystem.File.WriteAllText(viewPath.FullName, viewClass); } }
public void CommentProviderConstructorTest() { CommentProvider target = new CommentProvider(); }
public static IList <Comment> GetComment(int productID) { return(CommentProvider.getComment(dbConnection, productID)); }
public Downloader(string roomid, CommentProvider cmtProvider) { _commentProvider = cmtProvider; _roomid = roomid; }
public IList <Comment> GetReply(int commentID) { return(CommentProvider.getReply(dbConnection, commentID)); }