public TopicPage getTopicPage(int id) { TopicPage topicPage = new TopicPage(); List <CommentPage> commentPages = new List <CommentPage>(); string query = "SELECT NAME,AUTHOR,DISCUSSION FROM [TOPIC] WHERE Id = @Id"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@Id", id); try { con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { topicPage.Name = rdr["Name"].ToString(); topicPage.Author = rdr["Author"].ToString(); topicPage.Discussion = rdr["Discussion"].ToString(); } else { return(null); } } catch (Exception ex) { Console.WriteLine(ex.Message); throw new FaultException <Exception>(ex, new FaultReason(ex.Message)); } finally { con.Close(); } query = "SELECT COMMENT,AUTHOR,TIMESTAMP FROM [COMMENT] WHERE TopicId = @TopicId"; cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@TopicId", id); try { con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { CommentPage commentPage = new CommentPage(); commentPage.Author = rdr["Author"].ToString(); commentPage.Comment = rdr["Comment"].ToString(); commentPage.Timestamp = rdr["Timestamp"].ToString(); commentPages.Add(commentPage); } } catch (Exception ex) { Console.WriteLine(ex.Message); throw new FaultException <Exception>(ex, new FaultReason(ex.Message)); } finally { con.Close(); } topicPage.comments = commentPages; return(topicPage); }
public void display() { if (commentPage == null) { commentPage = new CommentPage(); } commentPage.display(); }
public async void DisplayComments() { try { CommentPage page = new CommentPage(PostVM); await PushAsync(page); } catch (Exception ex) { await Dialog.AlertAsync(ex.Message, "Erro", "Ok"); } }
public void SetUp() { driver.Manage().Window.Maximize(); loginPage = new LoginPage(driver); mainPage = new MainPage(driver); issuesPage = new IssuesPage(driver); commentPage = new CommentPage(driver); loginPage .GoToLoginPage() .LogIn(); mainPage .OpenProject(); }
/// <summary> /// 获取新的完整状态树 /// </summary> /// <param name="state">当前 UI 状态</param> /// <param name="userManager"><see cref="KeylolUserManager"/></param> /// <param name="dbContext"><see cref="KeylolDbContext"/></param> /// <param name="coupon"><see cref="CouponProvider"/></param> /// <param name="cachedData"><see cref="CachedDataProvider"/></param> /// <param name="pointIdCode">据点识别码</param> /// <param name="authorIdCode">作者识别码</param> /// <param name="userIdCode">用户识别码</param> /// <param name="sidForAuthor">文章在作者名下的序号</param> /// <param name="keyword">搜索关键字</param> /// <returns>完整状态树</returns> public static async Task <Root> Locate(string state, [Injected] KeylolUserManager userManager, [Injected] KeylolDbContext dbContext, [Injected] CouponProvider coupon, [Injected] CachedDataProvider cachedData, string pointIdCode = null, string authorIdCode = null, string userIdCode = null, int sidForAuthor = 0, string keyword = null) { var root = new Root(); var currentUserId = StateTreeHelper.GetCurrentUserId(); var isOperator = StateTreeHelper.GetCurrentUser().IsInRole(KeylolRoles.Operator); if (await StateTreeHelper.CanAccessAsync <Root>(nameof(CurrentUser))) { var user = await userManager.FindByIdAsync(currentUserId); root.CurrentUser = await CurrentUser.CreateAsync(user, userManager, dbContext, coupon, cachedData); } switch (state) { case "entrance": root.Entrance = await EntranceLevel.CreateAsync(currentUserId, States.Entrance.EntrancePage.Auto, dbContext, cachedData); break; case "entrance.discovery": root.Entrance = await EntranceLevel.CreateAsync(currentUserId, States.Entrance.EntrancePage.Discovery, dbContext, cachedData); break; case "entrance.points": root.Entrance = await EntranceLevel.CreateAsync(currentUserId, States.Entrance.EntrancePage.Points, dbContext, cachedData); break; case "entrance.timeline": root.Entrance = await EntranceLevel.CreateAsync(currentUserId, States.Entrance.EntrancePage.Timeline, dbContext, cachedData); break; case "aggregation.point": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.Auto, dbContext, cachedData) }; break; case "aggregation.point.frontpage": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.Frontpage, dbContext, cachedData) }; break; case "aggregation.point.intel": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.Intel, dbContext, cachedData) }; break; case "aggregation.point.product": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.Product, dbContext, cachedData) }; break; case "aggregation.point.timeline": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.Timeline, dbContext, cachedData) }; break; case "aggregation.point.edit.info": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.EditInfo, dbContext, cachedData) }; break; case "aggregation.point.edit.style": root.Aggregation = new AggregationLevel { Point = await PointLevel.CreateAsync(currentUserId, pointIdCode, States.Aggregation.Point.EntrancePage.EditStyle, dbContext, cachedData) }; break; case "aggregation.user": root.Aggregation = new AggregationLevel { User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Auto, dbContext, cachedData, userManager) }; break; case "aggregation.user.dossier": root.Aggregation = new AggregationLevel { User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Dossier, dbContext, cachedData, userManager) }; break; case "aggregation.user.people": root.Aggregation = new AggregationLevel { User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.People, dbContext, cachedData, userManager) }; break; case "aggregation.user.timeline": root.Aggregation = new AggregationLevel { User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Timeline, dbContext, cachedData, userManager) }; break; case "aggregation.user.edit": root.Aggregation = new AggregationLevel { User = await UserLevel.CreateAsync(currentUserId, userIdCode, EntrancePage.Edit, dbContext, cachedData, userManager) }; break; case "content.article": root.Content = new ContentLevel { Article = await States.Content.Article.ArticlePage.CreateAsync(authorIdCode, sidForAuthor, currentUserId, isOperator, dbContext, cachedData, userManager) }; break; case "content.activity": root.Content = new ContentLevel { Activity = await ActivityPage.CreateAsync(authorIdCode, sidForAuthor, currentUserId, isOperator, dbContext, cachedData, userManager) }; break; case "post-office.unread": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice))) { root.PostOffice = new PostOfficeLevel { Unread = await UnreadPage.CreateAsync(currentUserId, dbContext, cachedData) } } ; break; case "post-office.social-activity.comment": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice))) { root.PostOffice = new PostOfficeLevel { SocialActivity = new SocialActivityLevel { Comment = await CommentPage.CreateAsync(currentUserId, dbContext, cachedData) } } } ; break; case "post-office.social-activity.like": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice))) { root.PostOffice = new PostOfficeLevel { SocialActivity = new SocialActivityLevel { Like = await LikePage.CreateAsync(currentUserId, dbContext, cachedData) } } } ; break; case "post-office.social-activity.subscriber": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice))) { root.PostOffice = new PostOfficeLevel { SocialActivity = new SocialActivityLevel { Subscriber = await SubscriberPage.CreateAsync(currentUserId, dbContext, cachedData) } } } ; break; case "post-office.missive": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(PostOffice))) { root.PostOffice = new PostOfficeLevel { Missive = await MissivePage.CreateAsync(currentUserId, dbContext, cachedData) } } ; break; case "coupon.detail": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(Coupon))) { root.Coupon = new CouponLevel { Detail = await DetailPage.CreateAsync(currentUserId, dbContext, userManager) } } ; break; case "coupon.store": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(Coupon))) { root.Coupon = new CouponLevel { Store = await StorePage.CreateAsync(currentUserId, dbContext, cachedData, userManager, coupon) } } ; break; case "coupon.ranking": if (await StateTreeHelper.CanAccessAsync <Root>(nameof(Coupon))) { root.Coupon = new CouponLevel { Ranking = await RankingPage.CreateAsync(currentUserId, dbContext, cachedData) } } ; break; case "search.point": root.Search = new SearchLevel { Point = await PointPage.CreateAsync(currentUserId, keyword, dbContext, cachedData) }; break; case "search.article": root.Search = new SearchLevel { Article = await ArticlePage.CreateAsync(keyword, dbContext, cachedData) }; break; case "search.user": root.Search = new SearchLevel { User = await UserPage.CreateAsync(currentUserId, keyword, dbContext, cachedData) }; break; default: throw new NotSupportedException("Not supported state."); } return(root); }
public IActionResult CommentPage(CommentPage commentPage) { this.dataService.DeleteCommentPage(commentPage.Id); return(this.RedirectToAction("CommentPages", "Admin")); }
public IActionResult CommentPage(int id) { CommentPage model = this.dataService.GetObjectByPropertyValue <CommentPage>("Id", id); return(this.View(model)); }
/// <summary> /// Navigate to comment's detail page. /// </summary> /// <param name="sender">The control/object that raised the event.</param> /// <param name="e">Event Data.</param> /// <param name="c">Comment. Detail page will be opened about it.</param> private void CommentButton_Click(object sender, RoutedEventArgs e, Comment c) { CommentPage commentPage = new CommentPage(c, this); NavigationService.Navigate(commentPage); }