Ejemplo n.º 1
0
        /// <summary>
        /// Creates a basic ReportSource
        /// </summary>
        static public ReportSource Create(Repository repository, bool createConnection)
        {
            ReportSource result = new ReportSource()
            {
                GUID = Guid.NewGuid().ToString(), Name = "Data Source", Repository = repository
            };

            if (createConnection)
            {
                result.AddDefaultConnection(repository);
            }

            return(result);
        }
Ejemplo n.º 2
0
        static public ReportSource Create(Repository repository, bool createConnection)
        {
            ReportSource result = new ReportSource()
            {
                GUID = Guid.NewGuid().ToString(), Name = "Data Source", Repository = repository
            };
            //Add master table
            MetaTable master = MetaTable.Create();

            master.DynamicColumns = true;
            master.IsEditable     = true;
            master.Alias          = MetaData.MasterTableName;
            master.Source         = result;
            result.MetaData.Tables.Add(master);

            if (createConnection)
            {
                result.AddDefaultConnection(repository);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public void RemoveSource(ReportSource source)
        {
            if (Sources.Count == 1) throw new Exception("The report must contain at least a Data Source");

            foreach (var model in Models.Where(i => i.SourceGUID == source.GUID))
            {
                if (model.Elements.Count > 0 || !string.IsNullOrEmpty(model.RestrictionText)) throw new Exception(string.Format("The source '{0}' is already used by a model.", source.Name));
                model.SourceGUID = Sources.First(i => i.GUID != source.GUID).GUID;
            }
            Sources.Remove(source);
        }
Ejemplo n.º 4
0
        static public ReportSource Create(Repository repository, bool createConnection)
        {
            ReportSource result = new ReportSource() { GUID = Guid.NewGuid().ToString(), Name = "Data Source", Repository = repository };
            //Add master table
            MetaTable master = MetaTable.Create();
            master.DynamicColumns = true;
            master.IsEditable = true;
            master.Alias = MetaData.MasterTableName;
            master.Source = result;
            result.MetaData.Tables.Add(master);

            if (createConnection) result.AddDefaultConnection(repository); 

            return result;
        }