コード例 #1
0
        protected void BindData()
        {
            // Filter by x number of flags
            int count;

            Int32.TryParse(tbMinFlags.Text, out count);
            StringBuilder      sb       = new StringBuilder();
            List <WebpageInfo> subpages = BayshoreSolutions.WebModules.Webpage.GetWebpages(this.PageNavigationId);

            foreach (WebpageInfo list in subpages)
            {
                foreach (WebModuleInfo module in list.Modules)
                {
                    if (sb.Length == 0)
                    {
                        sb.Append(module.Id);
                    }
                    else
                    {
                        sb.Append("," + module.Id);
                    }

                    // Maximum length of idList for stored proc is 8000
                    if (sb.Length > 7990)
                    {
                        break;
                    }
                }
            }

            CommentsListRepeater.DataSource = SPs.MasterDetailGetCommentFlags(sb.ToString(), count, Convert.ToInt32(rblSortOrder.SelectedValue)).GetDataSet();
            CommentsListRepeater.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HtmlLink cssLink = new HtmlLink();

            cssLink.Href = "~/WebModules/MasterDetail/public/css/MasterDetail.css";
            cssLink.Attributes["rel"]  = "stylesheet";
            cssLink.Attributes["type"] = "text/css";
            this.Page.Header.Controls.AddAt(1, cssLink);

            // AntiSpam session var
            Session.Add("AntiSpamVar", "0");

            if (!IsPostBack)
            {
                WebpageInfo         page     = this.WebModuleInfo.Webpage;
                MasterDetailItem    item     = MasterDetailItem.GetSafeResource(this.ModuleId);
                MasterDetailSetting itemList = item.GetContentList();

                CurrentModuleId = item.ModuleId;

                if (itemList != null)
                {
                    lblPostDate.Visible   = itemList.IsPostDateVisible;
                    CommentsPanel.Visible = itemList.AllowComments;

                    if (itemList.AllowComments)
                    {
                        Query q = MasterDetailComment.Query().WHERE(MasterDetailComment.Columns.ModuleId, CurrentModuleId);
                        litCommentsLink.Text = "&nbsp;&nbsp;|&nbsp;&nbsp;<a href='#Comments'>" + q.GetCount(MasterDetailComment.Columns.Id) + " Comment(s)</a>";
                    }
                    if (Page.User.Identity.IsAuthenticated || !itemList.RequireAuthentication)
                    {
                        submitCommentsDiv.Visible = true;
                        lblLoginMsg.Visible       = false;
                    }
                    else
                    {
                        submitCommentsDiv.Visible = false;
                        lblLoginMsg.Visible       = true;
                    }
                }

                if (lblPostDate.Visible)
                {
                    if (page.PostDate.HasValue)
                    {
                        lblPostDate.Text = page.PostDate.Value.ToLongDateString();
                    }
                }

                if (string.IsNullOrEmpty(item.ImagePath))
                {
                    img.Visible = false;
                }
                else
                {
                    img.ImageUrl = ResolveUrl(item.ImagePath);
                }

                litTitle.Text       = page.Text;
                litBody.Text        = item.LongDescription;
                hypBack.NavigateUrl = this.WebModuleInfo.Webpage.Parent.Path;

                CommentsListRepeater.DataSource = new MasterDetailCommentCollection()
                                                  .Where(MasterDetailComment.Columns.ModuleId, CurrentModuleId)
                                                  .OrderByDesc(MasterDetailComment.Columns.CreatedOn)
                                                  .Load();
                CommentsListRepeater.DataBind();
            }
        }