/// <summary>
        /// 呈现本元素的数据
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTagData(System.IO.TextWriter writer)
        {
            IEnumerable array = DMEWeb_Utility.GetResolvedDataSource(this.From.GetValue());
            int index = 0;
            DMEWeb_LoopIndex li = new DMEWeb_LoopIndex(0);
            if (this.Index != null) this.Index.Value = li;
            if (array != null)
            {
                IEnumerator list = array.GetEnumerator();
                int groupSize = this.GroupSize == null ? 0 : DMEWeb_Utility.ConverToInt32(this.GroupSize.GetTextValue());
                if (groupSize > 1) list = DMEWeb_Utility.SplitToGroup(list, groupSize);

                list.Reset();
                if (list.MoveNext())
                {
                    li.IsLast = false;
                    while (!li.IsLast)
                    {
                        object v = list.Current;
                        li.Value = ++index;
                        li.IsFirst = (index == 1);
                        li.IsLast = !list.MoveNext();
                        if (this.Index != null) this.Index.Reset();
                        if (this.Item != null) this.Item.Value = v;
                        base.RenderTagData(writer);
                    }
                }
            }
            if (index == 0 && this.Else != null)
            {
                //没有数据则输出Else节点的数据
                this.Else.Render(writer);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 呈现本元素的数据
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTagData(System.IO.TextWriter writer)
        {
            decimal from = DMEWeb_Utility.ConverToDecimal(this.From.Value.GetValue());
            decimal step = this.Step == null ? 1 : DMEWeb_Utility.ConverToDecimal(this.Step.Value.GetValue());
            decimal to = DMEWeb_Utility.ConverToDecimal(this.To.Value.GetValue());
            decimal index = from;

            DMEWeb_LoopIndex li = new DMEWeb_LoopIndex(index);
            if (this.Index != null) this.Index.Value = li;
            if (step >= 0)
            {
                while (index <= to)
                {
                    li.Value = index;
                    li.IsFirst = (index == from);
                    li.IsLast = (index == to);
                    if (this.Index != null) this.Index.Variable.Reset();
                    base.RenderTagData(writer);
                    index += step;
                }
            }
            else
            {
                while (index >= to)
                {
                    li.Value = index;
                    li.IsFirst = (index == from);
                    li.IsLast = (index == to);
                    if (this.Index != null) this.Index.Variable.Reset();
                    base.RenderTagData(writer);
                    index += step;
                }
            }
        }