Esempio n. 1
0
 public ActionResult BaseDropDownList(DropDownListRender render)
 {
     return(View(render));
 }
Esempio n. 2
0
        public List <OutputNode> GetNodes(Table Table, Field field)
        {
            int rowIndex = this.RowIndex;
            int rowCount = this.RowCount;
            DropDownListRender dropDownRender = null;

            if (field.DropDownListSource != null)
            {
                string[] values = field.DropDownListSource.GetStringValues();
                if (values.Length > 0)
                {
                    dropDownRender = new DropDownListRender()
                    {
                        ValueList = values,
                        FillArea  = new Location()
                        {
                            RowIndex = rowIndex,
                            RowCount = rowCount,
                            ColIndex = field.ColIndex,
                            ColCount = field.ColSpan
                        }
                    };
                }
            }
            List <OutputNode> nodes  = new List <OutputNode>();
            Source            source = this.Source;

            if (this.IsValid(field))
            {
                IDictionary <int, object> dict = this.GetGroupedValues(field);
                IList <int> indexes            = dict.Keys.ToList();
                indexes.Add(rowCount);
                AbstractValueSetter converter = GetConvert(field);
                for (int i = 0; i < indexes.Count - 1; i++)
                {
                    OutputNode node = new OutputNode()
                    {
                        Content     = dict[indexes[i]],
                        RowIndex    = rowIndex + indexes[i],
                        ColumnIndex = field.ColIndex,
                        ColumnSpan  = field.ColSpan,
                        RowSpan     = indexes[i] < rowCount - 1 ? indexes[i + 1] - indexes[i] : 1,
                        Convertor   = converter
                    };
                    nodes.Add(node);
                    //1、只需要第一行的结点设置
                    if (i == 0 && dropDownRender != null)
                    {
                        node.AddRender(dropDownRender);
                    }
                    //2、批注
                    if (!string.IsNullOrEmpty(field.CommentColumn))
                    {
                        string value = (this.GetValue(indexes[i], field.CommentColumn) ?? "").ToString();
                        if (!string.IsNullOrEmpty(value))
                        {
                            CommentRender render = new CommentRender();
                            render.Author  = field.Table.ProductRule.CommentAuthor;
                            render.Comment = value;
                            node.AddRender(render);
                        }
                    }
                    //3、链接
                    if (!string.IsNullOrEmpty(field.RefColumn))
                    {
                        string value = (this.GetValue(indexes[i], field.RefColumn) ?? "").ToString();
                        if (!string.IsNullOrEmpty(value))
                        {
                            HyperLinkRender render = new HyperLinkRender();
                            render.Address  = value;
                            render.LinkType = field.LinkType;
                            node.AddRender(render);
                        }
                    }
                }
            }
            return(nodes);
        }