Example #1
0
        /// <summary>
        /// 获取标签的最终输出值
        /// </summary>
        public override object GetTagValue()
        {
            if (this.IsExist == true)
            {
                //OleDbHelper.AppendToFile("~/debug.log", this.Category.ToString() + Environment.NewLine + Environment.NewLine);
                //OleDbHelper.AppendToFile("~/debug.log", this.OuterDefineText + Environment.NewLine + Environment.NewLine);
                //OleDbHelper.AppendToFile("~/debug.log", this.Content + Environment.NewLine + Environment.NewLine);

                if (!ContainTags())
                {
                    return(this.GetHtmlOutPut());
                }
                else
                {
                    TagBase tag = new TagBase(this.Content);
                    if (tag.Category == TagCategory.DataListTag)
                    {
                        ListTag list = ListTag.Parse(tag, this.GetResourceDependency());
                        if (list.PageSize > 0)
                        {
                            string pagedAliaContent = (string.IsNullOrEmpty(list.IDentity)) ? Guid.NewGuid().ToString() : list.IDentity;
                            SetDynamicPagedAlia(pagedAliaContent, list);
                            return(pagedAliaContent);
                        }
                        else
                        {
                            return(list.GetTagValue());
                        }
                    }
                    else if (tag.Category == TagCategory.PagerTag)
                    {
                        PagerTag pager     = PagerTag.Parse(tag);
                        string   pagerAlia = (string.IsNullOrEmpty(pager.IDentity)) ? Guid.NewGuid().ToString() : pager.IDentity;
                        SetDynamicPagerDependency(pagerAlia, pager);
                        return(pagerAlia);
                    }
                    else
                    {
                        //Util.Debug(false, GetResourceDependency());
                        return(TagBase.InterpretContentWithTags(GetHtmlOutPut(), GetResourceDependency()));
                    }
                }
            }
            else
            {
                //OleDbHelper.AppendToFile("~/debug.log", "NULL:" + this.OuterDefineText + Environment.NewLine + Environment.NewLine);
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// 获取该标签的HTML输出
        /// </summary>
        public override object GetTagValue()
        {
            SetDataSource();
            StringBuilder sb = new StringBuilder();

            sb.Append(TagBase.InterpretContentWithTags(this.HeaderTemplet, this));
            if (this.DataSource != null && this.DataSource.Rows.Count > 0)
            {
                int rowCount = 0, rowIndex = 0;

                #region 设置开始结束索引
                this.StartIndex = 1 + (PageSize * (CurrentPageIndex - 1));
                this.EndIndex   = (this.StartIndex + this.DataSource.Rows.Count - 1);
                #endregion

                for (int i = 0; i < this.DataSource.Rows.Count; i++)
                {
                    ++rowCount;
                    //行在整个数据源中的索引
                    rowIndex = rowCount + (PageSize * (CurrentPageIndex - 1));

                    #region 单元项
                    if (rowCount % 2 == 0 && this.AlterItemTemplet != "")
                    {
                        sb.Append(TagBase.GetDataEscapedValue(rowIndex, this.AlterItemTemplet, this.DataSource.Rows[i], new MultiResDependency(this, GetResourceDependency())));
                    }
                    else
                    {
                        sb.Append(TagBase.GetDataEscapedValue(rowIndex, this.ItemTemplet, this.DataSource.Rows[i], new MultiResDependency(this, GetResourceDependency())));
                    }
                    #endregion

                    #region 单元项间隔
                    if (this.RowSize > 1 && (rowCount % this.RowSize != 0))
                    {
                        //多项分行间隔
                        sb.Append(this.SeparatorTemplet);
                    }
                    else
                    {
                        //单项间隔
                        if (rowCount < this.DataSource.Rows.Count)
                        {
                            sb.Append(this.SeparatorTemplet);
                        }
                    }
                    #endregion

                    #region 行分隔
                    if (this.RowSize > 1 && rowCount % this.RowSize == 0 &&
                        rowCount < this.DataSource.Rows.Count)
                    {
                        sb.Append(this.RowBreakTemplet);
                    }
                    #endregion
                }
            }
            else
            {
                sb.Append(this.EmptyTemplet);
            }
            sb.Append(TagBase.InterpretContentWithTags(this.FooterTemplet, this));
            return(sb.ToString());
        }