Esempio n. 1
0
 internal void RefreshColumns()
 {
     if (View != null)
     {
         // add new columns
         foreach (DataColumn column in View.Table.Columns)
         {
             if (Columns.FindByName(column.ColumnName) == null)
             {
                 Column c = CreateColumn(column);
                 c.Enabled = true;
                 Columns.Add(c);
             }
         }
         // delete obsolete columns
         int i = 0;
         while (i < Columns.Count)
         {
             Column c = Columns[i];
             if (!c.Calculated && !View.Table.Columns.Contains(c.Name))
             {
                 c.Dispose();
             }
             else
             {
                 i++;
             }
         }
     }
 }
        /// <inheritdoc/>
        public override void Deserialize(FRReader reader)
        {
            base.Deserialize(reader);

            // compatibility with old reports: try to use last part of ReferenceName as a value for PropName
            if (!String.IsNullOrEmpty(ReferenceName) && ReferenceName.Contains("."))
            {
                string[] names = ReferenceName.Split(new char[] { '.' });
                PropName      = names[names.Length - 1];
                ReferenceName = "";
            }

            // gather all nested datasource names (PropName properties)
            List <string> dataSourceNames = new List <string>();

            foreach (Column column in Columns)
            {
                if (column is BusinessObjectDataSource)
                {
                    dataSourceNames.Add(column.PropName);
                }
            }

            // delete simple columns that have the same name as a datasource. In old version,
            // there was an invisible column used to support BO infrastructure
            for (int i = 0; i < Columns.Count; i++)
            {
                Column column = Columns[i];
                if (!(column is BusinessObjectDataSource) && dataSourceNames.Contains(column.PropName))
                {
                    column.Dispose();
                    i--;
                }
            }
        }