예제 #1
0
        /*驗貨情況*/
        void prepareProcessCommentList()
        {
            string sqlstr = "select 0 as Form_No, '' as comment union(select Form_No, comment from Verify) order by Form_No ";

            CommentList.DataSource = mydb.GetDataTable(sqlstr);
            CommentList.DataBind();
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!User.Identity.IsAuthenticated)
     {
         RedirectToLoginPage();
     }
     CommentList.DataSource = AuctionList_GetData();
     CommentList.DataBind();
 }
 protected void ShowComment_Click(object sender, EventArgs e)
 {
     if (TaskList.SelectedIndex != -1)
     {
         string cs = ConfigurationManager.ConnectionStrings["LoginConnectionString"].ConnectionString;
         using (SqlConnection conn = new SqlConnection(cs))
         {
             SqlCommand cmd = new SqlCommand("Select Comment, CommentedBy, DateTime from TaskComment where TaskName='" + TaskList.SelectedItem.ToString() + "'", conn);
             //SqlCommand cmd = new SqlCommand("Select * from TimeTable", con);
             conn.Open();
             CommentList.DataSource = cmd.ExecuteReader();
             CommentList.DataBind();
             conn.Close();
         }
     }
 }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dal.Story story = StoryCache.GetStory(UrlParameters.StoryIdentifier, HostProfile.HostID);

            if (story == null || story.IsSpam && !this.KickUserProfile.IsModerator)
            {
                Response.Redirect("/missingstory");
            }


            Title   = story.Title;
            Caption = "";
            UsersWhoKicked.DataBind(story.UsersWhoKicked);
            StorySummary.DataBind(story);
            StorySummary.ShowMoreLink             = false;
            StorySummary.ShowGetKickImageCodeLink = true;
            CommentList.DataBind(StoryCache.GetComments(story.StoryID));
            AddComment.DataBind(story.StoryID);
            DisplayAds = true;

            KickMenu.DisplayAds        = true;
            KickMenu.DisplayCategories = false;
            KickMenu.DisplayWhatElse   = false;

            KickItImagePersonalization.StoryUrl = story.Url;

            if (!String.IsNullOrEmpty(story.AdsenseID))
            {
                if (KickUserProfile.UserID != story.UserID)
                {
                    //flick a coin
                    if (ThreadSafeRandom.FlickCoin())
                    {
                        System.Diagnostics.Debug.WriteLine("Showing author ads " + story.AdsenseID);
                        AdSenseID = story.AdsenseID;
                    }
                }
            }


            //related stories control
            RelatedStories.DataBind(SimilarStoriesCache.GetSimilarStoryCollection(this.HostProfile.HostID, story.StoryID));
        }
예제 #5
0
 void Bind()
 {
     CommentList.DataSource = Comments_B.CommentsListPager(CommentPager.PageSize.ToString(), CommentPager.CurrentPageIndex.ToString());
     CommentList.DataBind();
 }
예제 #6
0
    private void BuildPage()
    {
        if (Request.QueryString["id"] == null)
        {
            //CommentCollection cc = new CommentCollection();
            Query q = Comment.CreateQuery();

            if (!(Request.QueryString["a"] == "d"))
            {
                q.AndWhere(Comment.Columns.IsPublished, !(Request.QueryString["a"] == "f"));
            }

            q.AndWhere(Comment.Columns.IsDeleted, (Request.QueryString["a"] == "d"));

            if (!String.IsNullOrEmpty(Request.QueryString["pid"]))
            {
                q.AndWhere(Comment.Columns.PostId, Request.QueryString["pid"]);
            }

            q.OrderByDesc(Comment.Columns.Id);

            CommentCollection tempCC = CommentCollection.FetchByQuery(q);

            CommentCollection permissionsFilteredCount = new CommentCollection();
            permissionsFilteredCount.AddRange(tempCC);

            foreach (Comment c in tempCC)
            {
                if (!RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Read)
                {
                    permissionsFilteredCount.Remove(c);
                }
            }

            q.PageIndex = Int32.Parse(Request.QueryString["p"] ?? "1");
            q.PageSize  = 25;

            CommentCollection cc = CommentCollection.FetchByQuery(q);

            CommentCollection permissionsFiltered = new CommentCollection();
            permissionsFiltered.AddRange(cc);

            foreach (Comment c in cc)
            {
                if (!RolePermissionManager.GetPermissions(c.Post.CategoryId, GraffitiUsers.Current).Read)
                {
                    permissionsFiltered.Remove(c);
                }
            }

            CommentList.DataSource = permissionsFiltered;
            CommentList.DataBind();

            string qs = Request.QueryString["a"] != null ? "?a=" + Request.QueryString["a"] : "?a=t";

            Pager.Text = Util.Pager(q.PageIndex, q.PageSize, permissionsFilteredCount.Count, "navigation", qs);

            if (Request.QueryString["a"] == "f")
            {
                CommentLinks.SetActiveView(PendingComments);
            }
            else if (Request.QueryString["a"] == "d")
            {
                CommentLinks.SetActiveView(DeletedComments);
            }
        }
        else
        {
            the_Views.SetActiveView(Comment_Form);
            Comment comment = new Comment(Request.QueryString["id"]);
            if (comment.IsNew)
            {
                throw new Exception("Invalid Comment Id");
            }

            txtName.Text       = Server.HtmlDecode(comment.Name);
            txtSite.Text       = comment.WebSite;
            txtEmail.Text      = comment.Email;
            CommentEditor.Text = comment.Body;
        }

        #region build the page title

        StringBuilder sb = new StringBuilder();

        string page = Request.QueryString["a"] ?? "t";

        switch (page)
        {
        case "t":
            sb.Append("Published ");
            break;

        case "f":
            sb.Append("Pending ");
            break;

        case "d":
            sb.Append("Deleted ");
            break;
        }

        sb.Append(" Comments");

        lblPageTitle.Text = sb.ToString();

        string post = Request.QueryString["pid"];

        if (!String.IsNullOrEmpty(post))
        {
            Post p = new Post(Convert.ToInt32(post));

            lblPageTitle.Text += " for \"" + p.Name + "\"";
        }

        #endregion
    }
예제 #7
0
 private void fetchData(List <CommentsView> comments)
 {
     CommentList.DataSource = comments;
     CommentList.DataBind();
 }