Esempio n. 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);
        }
Esempio n. 2
0
        public override BaseEntity Clone(ProductRule productRule, BaseEntity container)
        {
            Sheet newObject = new Sheet(productRule)
            {
                _location = _location.Clone(),
                //_cells = cells,
                //_tables = tables,
                _container = _container,
                //_dynamicObject = _dynamicObject,
                //TempleteRows = TempleteRows,
                _nameRule     = _nameRule,
                _sourceName   = _sourceName,
                _isDynamic    = _isDynamic,
                _name         = _name,
                _copyFill     = _copyFill,
                _keepTemplate = _keepTemplate
            };

            //if (_dynamicObject != null && _dynamicObject.Source != null)
            //{
            //    newObject.SetDynamicSource(productRule.GetSource(_dynamicObject.Source.Name));
            //}
            newObject._cells  = _cells.Clone(productRule, newObject);
            newObject._tables = BaseEntity.Clone(_tables, productRule, newObject);
            return(newObject);
        }
Esempio n. 3
0
 public DynamicSource Clone(ProductRule productRule)
 {
     return(new DynamicSource(productRule)
     {
         _source = _source.Clone() as Source,
         DistinctFunc = DistinctFunc.Clone() as Func <DataTable, int, object>
     });
 }
Esempio n. 4
0
        /// <summary>
        /// 批量复制BaseContainer列表对象
        /// </summary>
        /// <param name="list">列表</param>
        /// <param name="productRule">规则实体</param>
        /// <param name="container">上级实体</param>
        /// <returns></returns>
        public static List <BaseEntity> Clone(IList <BaseEntity> list, ProductRule productRule, BaseEntity container)
        {
            List <BaseEntity> newList = new List <BaseEntity>();

            for (int i = 0; i < list.Count; i++)
            {
                newList.Add(list[i].Clone(productRule, container));
            }
            return(newList);
        }
Esempio n. 5
0
        /// <summary>
        /// 加载数据源
        /// </summary>
        /// <param name="productType">产出物类型名称</param>
        /// <param name="dataSet">数据源</param>
        /// <returns>产出物</returns>
        public ProductRule LoadData(string productType, DataSet dataSet)
        {
            ProductRule prod = GetProductRule(productType);

            if (prod != null)
            {
                prod.LoadData(dataSet);
            }
            return(prod);
        }
Esempio n. 6
0
        public override BaseEntity Clone(ProductRule productRule, BaseEntity container)
        {
            Cell tmpCell = new Cell(productRule, container, _location.Clone())
            {
                SourceName  = SourceName,
                Field       = Field,
                Value       = Value,
                DataIndex   = DataIndex,
                ValueAppend = ValueAppend,
                FillType    = FillType
            };

            //if (Source != null)
            //{
            //    tmpCell.Source = productRule.GetSource(Source.Name);
            //}
            return(tmpCell);
        }
Esempio n. 7
0
        public override BaseEntity Clone(ProductRule productRule, BaseEntity container)
        {
            DynamicArea newObject = new DynamicArea(productRule, container, _location.Clone())
            {
                //CopyFill = CopyFill,
                //_source = (Source)_source.Clone(),
                //_tables = tables,
                //_cells = cells,
                //_dynamicObject = _dynamicObject.Clone(productRule),
                SourceName = SourceName
            };

            //if (_source != null)
            //{
            //    newObject.Source = productRule.GetSource(_source.Name);
            //}
            newObject._tables = _tables.Clone(productRule, newObject);
            newObject._cells  = _cells.Clone(productRule, newObject);
            return(newObject);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        public ProductRule Clone()
        {
            ProductRule newObject = new ProductRule()
            {
                Name           = Name,
                Description    = Description,
                Template       = Template,
                Export         = Export,
                _commentAuthor = _commentAuthor,
                _dataFirst     = _dataFirst,
                ShrinkSheet    = ShrinkSheet,
                ShrinkExSheets = ShrinkExSheets.Clone <string>().ToArray()
            };

            //1、数据源的复制
            newObject._sourceDict = _sourceDict.Clone();
            //2、父级引用是否重置?
            newObject._sheets = _sheets.Clone(newObject, null);;

            return(newObject);
        }
Esempio n. 10
0
        public override BaseEntity Clone(ProductRule productRule, BaseEntity container)
        {
            Table newTable = new Table(productRule, container, _location.Clone())
            {
                CopyFill = CopyFill,
                //TempleteRows = TempleteRows,
                AutoFitHeight = AutoFitHeight,
                RowNumIndex   = RowNumIndex,
                SourceName    = SourceName,
                //_source = _source,
                SumLocation = SumLocation,
                SumOffset   = SumOffset,
                _sumColumns = new List <int>(_sumColumns)
            };

            //if (Source != null)
            //{
            //    newTable.Source = productRule.GetSource(Source.Name);
            //}
            newTable._fields = _fields.Clone(productRule, newTable);
            return(newTable);
        }
Esempio n. 11
0
 public Cell(ProductRule productRule, BaseEntity container, Location location) : base(productRule, container, location)
 {
 }
Esempio n. 12
0
 public Cell CloneEntity(ProductRule productRule, BaseEntity container)
 {
     return(this.Clone(productRule, container) as Cell);
 }
Esempio n. 13
0
 public Sheet(ProductRule productRule) : base(productRule, null, new Location("A1"))
 {
 }
Esempio n. 14
0
 public Sheet CloneEntity(ProductRule productRule, BaseEntity container)
 {
     return(this.Clone(productRule, container) as Sheet);
 }
Esempio n. 15
0
 public BaseEntity(ProductRule productRule, BaseEntity container, Location location)
 {
     _productRule = productRule;
     _container   = container;
     _location    = location;
 }
Esempio n. 16
0
 public override BaseEntity Clone(ProductRule productRule, BaseEntity container)
 {
     return(this.Clone());
 }
Esempio n. 17
0
        ///// <summary>
        ///// 用作模板的行数
        ///// </summary>
        //public virtual int TempleteRows { get { return _templeteRows; } set { _templeteRows = value; } }

        ///// <summary>
        ///// 实际行索引
        ///// </summary>
        //public int RowIndex
        //{
        //    get
        //    {
        //        //return _location.RowIndex + _sheet.Tables.Where(p => p.CopyFill && p._location.RowIndex < _location.RowIndex).Sum(p => p.RowCount > p.TempleteRows ? p.RowCount - p.TempleteRows : 0);
        //        return _location.RowIndex + AllIncreasedBefore;
        //    }
        //}

        ///// <summary>
        ///// 实际列索引
        ///// </summary>
        //public int ColIndex
        //{
        //    get { return _location.ColIndex; }
        //}

        ///// <summary>
        ///// 之前增长行数
        ///// </summary>
        //public int AllIncreasedBefore { get { return _container == null ? 0 : _container.IncreasedBefore(this) + _container.AllIncreasedBefore; } }

        ///// <summary>
        ///// (当前)增长行数
        ///// 注:对于容器对象需要覆盖此方法
        ///// </summary>
        //public virtual int IncreasedRows { get { return CopyFill && RowCount > TempleteRows ? RowCount - TempleteRows : 0; } }

        ///// <summary>
        ///// 同一父容器内前面对象增长行数
        ///// 注:对于容器对象需要覆盖此方法
        ///// </summary>
        ///// <param name="subObject"></param>
        ///// <returns></returns>
        //public virtual int IncreasedBefore(BaseContainer subObject) { return 0; }

        ///// <summary>
        ///// 列数
        ///// </summary>
        //public abstract int ColCount { get; }

        ///// <summary>
        ///// 行数
        ///// </summary>
        //public abstract int RowCount { get; }

        ///// <summary>
        ///// 获取输出结点
        ///// </summary>
        ///// <returns></returns>
        //public abstract IList<OutputNode> GetNodes();

        /// <summary>
        /// 获取克隆对象
        /// </summary>
        /// <returns></returns>
        public abstract BaseEntity Clone(ProductRule productRule, BaseEntity container);
Esempio n. 18
0
 public Table CloneEntity(ProductRule productRule, BaseEntity container)
 {
     return(this.Clone(productRule, container) as Table);
 }
Esempio n. 19
0
 public DynamicSource(ProductRule productRule)
 {
     this._productRule = productRule;
 }
Esempio n. 20
0
 public DynamicArea(ProductRule productRule, BaseEntity container, Location location)
     : base(productRule, container, location)
 {
 }
Esempio n. 21
0
 public DynamicSource(ProductRule productRule, Source source)
     : this(productRule)
 {
     this._source = source;
 }