Пример #1
0
        public Field CloneEntity(ProductRule productRule, BaseEntity container)
        {
            Table table     = container as Table;
            Field newObject = new Field(table, Name, Type)
            {
                Name               = Name,
                ColIndex           = ColIndex,
                ColSpan            = ColSpan,
                Spannable          = Spannable,
                EmptyFill          = EmptyFill,
                Format             = Format,
                CommentColumn      = CommentColumn,
                LinkType           = LinkType,
                RefColumn          = RefColumn,
                DropDownListSource = DropDownListSource,
                Convertor          = Convertor,
                SumField           = SumField
            };

            if (DropDownListSource != null)
            {
                newObject.DropDownListSource = productRule.GetSource(DropDownListSource.Name) as ListSource;
            }
            return(newObject);
        }
Пример #2
0
        /// <summary>
        /// 在动态Sheet中获取Table或Cell元素的数据源
        /// </summary>
        /// <param name="expression">表达式</param>
        /// <param name="index">索引号</param>
        /// <returns>数据源</returns>
        public Source GetDynamicSource(string expression, int index,
                                       IDictionary <string, string> preExParams = null, IDictionary <string, string> postExParams = null)
        {
            Source tmpSource  = null;
            string sourceName = GetDynamicValue(expression, index, preExParams, postExParams);

            if (!string.IsNullOrEmpty(sourceName))
            {
                tmpSource = _productRule.GetSource(sourceName);
            }
            //如果表达式包含".",可能是"TableName.FieldName"组成,解析出前TableName部分
            if (tmpSource == null && sourceName.Contains("."))
            {
                sourceName = sourceName.Substring(0, sourceName.IndexOf('.'));
                tmpSource  = _productRule.GetSource(sourceName);
            }
            return(tmpSource);
        }
Пример #3
0
        public SourceRelation Clone(ProductRule productRule)
        {
            SourceRelation newSourceRel = new SourceRelation()
            {
                //Source = Source.Clone() as Source,
                //ReferecedSource = ReferecedSource.Clone() as Source,
                Field          = Field,
                ReferecedField = ReferecedField
            };

            if (Source != null)
            {
                newSourceRel.Source = productRule.GetSource(Source.Name);
            }
            if (ReferecedSource != null)
            {
                newSourceRel.ReferecedSource = productRule.GetSource(ReferecedSource.Name);
            }
            return(newSourceRel);
        }