Example #1
0
    public override void CreateNewOutputRows()
    {
        int oldest = 2100;
        int newest = 0;

        while (sqlReader.Read())
        {
            int current = sqlReader.GetInt32(0);
            if (current < oldest)
            {
                oldest = current;
            }
            if (current > newest)
            {
                newest = current;
            }
        }
        while (oldest < newest)
        {
            Output0Buffer.AddRow();
            Output0Buffer.Rocznik = oldest;
            oldest += 1;
        }
        Output0Buffer.AddRow();
        Output0Buffer.Rocznik = oldest;

        /*
         * Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
         * For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
         */
    }
Example #2
0
    public override void CreateNewOutputRows()
    {
        var oldest = new DateTime(2100, 12, 31);
        var newest = new DateTime(1900, 1, 1);

        while (sqlReader.Read())
        {
            var current = sqlReader.GetDateTime(0);
            if (DateTime.Compare(oldest, current) > 0)
            {
                oldest = current;
            }
            if (DateTime.Compare(newest, current) < 0)
            {
                newest = current;
            }
        }
        for (var date = oldest; newest.CompareTo(date) >= 0; date = date.AddDays(1))
        {
            Output0Buffer.AddRow();
            Output0Buffer.Rok     = date.Year;
            Output0Buffer.Miesiac = date.Month;
            Output0Buffer.Dzien   = date.Day;
        }
        //Output0Buffer.AddRow();
        //Output0Buffer.Rocznik = oldest;

        /*
         * Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
         * For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
         */
    }
Example #3
0
    public override void CreateNewOutputRows()
    {
        DateTime startDateTime = DateTime.Now;
        bool     fireAgain     = true;

        string theFile = Variables.JsonFile.ToString();

        var result = GetData <List <Address> >(theFile);

        ComponentMetaData.FireInformation(0, ComponentMetaData.Name, $"Time span: {(DateTime.Now - startDateTime).Seconds} seconds", string.Empty, 0, ref fireAgain);

        foreach (Address theAddress in result)
        {
            Output0Buffer.AddRow();
            Output0Buffer.StreetNumber     = theAddress.StreetNumber;
            Output0Buffer.StreetName       = theAddress.StreetName;
            Output0Buffer.StreetSubAddress = theAddress.StreetSubAddress;
            Output0Buffer.PropertyTypeCode = theAddress.PropertyTypeCode;
            Output0Buffer.Municipality     = theAddress.Municipality;
            Output0Buffer.UAID             = theAddress.UAID;
            Output0Buffer.UUAID            = theAddress.UUAID;
            Output0Buffer.Province         = theAddress.Province;
            Output0Buffer.PostalCode       = theAddress.PostalCode;
            Output0Buffer.Country          = theAddress.Country;
            Output0Buffer.Lat = theAddress.Coordinates.Lat;
            Output0Buffer.Lon = theAddress.Coordinates.Lon;
        }
    }
    public override void CreateNewOutputRows()
    {
        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls
                                                | SecurityProtocolType.Tls11
                                                | SecurityProtocolType.Tls12
                                                | SecurityProtocolType.Ssl3;

        string serviceUrl = Variables.ServiceUrl.ToString();
        string endpoint   = Variables.Endpoint.ToString();

        _client.BaseAddress = new Uri(serviceUrl);
        _client.DefaultRequestHeaders.Accept.Clear();
        _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        var result = GetDataAsync(endpoint, this).GetAwaiter().GetResult();

        foreach (Address theAddress in result)
        {
            Output0Buffer.AddRow();
            Output0Buffer.StreetNumber     = theAddress.StreetNumber;
            Output0Buffer.StreetName       = theAddress.StreetName;
            Output0Buffer.StreetSubAddress = theAddress.StreetSubAddress;
            Output0Buffer.PropertyTypeCode = theAddress.PropertyTypeCode;
            Output0Buffer.Municipality     = theAddress.Municipality;
            Output0Buffer.UAID             = theAddress.UAID;
            Output0Buffer.UUAID            = theAddress.UUAID;
            Output0Buffer.Province         = theAddress.Province;
            Output0Buffer.PostalCode       = theAddress.PostalCode;
            Output0Buffer.Country          = theAddress.Country;
            Output0Buffer.Lat = theAddress.Coordinates.Lat;
            Output0Buffer.Lon = theAddress.Coordinates.Lon;
        }
    }
Example #5
0
    public override void CreateNewOutputRows()
    {
        foreach (var sruba in sruby)
        {
            foreach (var smar in smary)
            {
                foreach (var srubokret in srubokrety)
                {
                    foreach (var wiertarka in wiertarki)
                    {
                        foreach (var klucz in klucze)
                        {
                            Output0Buffer.AddRow();
                            Output0Buffer.klucze     = klucz;
                            Output0Buffer.wiertarki  = wiertarka;
                            Output0Buffer.smary      = smar;
                            Output0Buffer.sruby      = sruba;
                            Output0Buffer.srubokrety = srubokret;
                        }
                    }
                }
            }
        }

        /*
         * Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
         * For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
         */
    }
 /// <summary>
 /// Create data rows and fill those buckets
 /// </summary>
 public override void CreateNewOutputRows()
 {
     foreach (var item in this.GetData())
     {
         Output0Buffer.AddRow();
         Output0Buffer.Content = item;
     }
 }
 private void addRow(string accountnumber, string name, Guid ownerid, string ownertype)
 {
     Output0Buffer.AddRow();
     Output0Buffer.accountnumber = accountnumber;
     Output0Buffer.name          = name;
     Output0Buffer.ownerid       = ownerid;
     Output0Buffer.ownertype     = ownertype;
 }
    public override void CreateNewOutputRows()
    {
        Server server = new Server();

        server.Connect(Variables.ASTabularServerCRConnectionString);
        Regex rx = new Regex(@"_.*_*-"); // Exclude Temp DB ConnexysReporting_UserName_3f2d309e-237d-4755-8e89-69b33f5f5992

        foreach (Role role in server.Roles)
        {
            foreach (Microsoft.AnalysisServices.RoleMember member in role.Members)
            {
                Output0Buffer.AddRow();
                Output0Buffer.DatabaseType   = "Tabular";
                Output0Buffer.DatabaseName   = server.Name;
                Output0Buffer.SourceType     = "Server";
                Output0Buffer.SourceName     = server.Name;
                Output0Buffer.RoleName       = role.Name;
                Output0Buffer.RoleMemberName = member.Name;
            }
        }

        foreach (Database database in server.Databases)
        {
            if (rx.Matches(database.Name).Count != 0)
            {
                continue;
            }

            foreach (ModelRole role in database.Model.Roles)
            {
                foreach (ModelRoleMember member in role.Members)
                {
                    Output0Buffer.AddRow();
                    Output0Buffer.DatabaseType   = "Tabular";
                    Output0Buffer.DatabaseName   = server.Name;
                    Output0Buffer.SourceType     = "Model";
                    Output0Buffer.SourceName     = database.Name;
                    Output0Buffer.RoleName       = role.Name;
                    Output0Buffer.RoleMemberName = member.Name;

                    var permission = role.ModelPermission.ToString();
                    Output0Buffer.Read          = permission == "Read" || permission == "ReadRefresh" || permission == "Administrator" ? "Allowed" : "None";
                    Output0Buffer.Process       = permission == "ReadRefresh" || permission == "Administrator" ? "True" : "False";
                    Output0Buffer.Administrator = permission == "Administrator" ? "True" : "False";
                }
            }
        }
    }
Example #9
0
 /// <summary>
 /// This is the process to generate new rows. As we only want to
 /// generate rows once all the rows have arrived, only call this
 /// at the point our internal collection has accumulated all the
 /// input rows.
 /// </summary>
 public override void CreateNewOutputRows()
 {
     foreach (var item in this.data.GroupBy(d => d.ID).Select(d => new { Item = d.Key }))
     {
         //Then pick out the highest OneToMany ID for that row to use with it.
         // Magic happens
         // I don't "get" LINQ so I can't implement the poster's action
         int    id             = 0;
         int    maxOneToManyID = 2;
         string title          = string.Empty;
         id = item.Item;
         Output0Buffer.AddRow();
         Output0Buffer.ID = id;
         Output0Buffer.OneToManyDataID = maxOneToManyID;
         Output0Buffer.Title           = title;
     }
 }
    public override void CreateNewOutputRows()
    {
        string json = @"{""data"":[{""created_at"":""2016-03-12 09:45:00"",""created_at_unix"":1457772300,""shop_name"":""DK - Some name"",""location_id"":1111,""custom_location_id"":""2222"",""custom_shop_id"":""2222"",""shop_id"":3333,""count_in"":""1"",""count_out"":""1"",""timekey"":3},{""created_at"":""2016-03-12 09:45:00"",""created_at_unix"":1457772300,""shop_name"":""test2"",""location_id"":1111,""custom_location_id"":""2222"",""custom_shop_id"":""2222"",""shop_id"":3333,""count_in"":""1"",""count_out"":""1"",""timekey"":3}]}";

        RootObject Test = new JavaScriptSerializer().Deserialize <RootObject>(json);

        /*
         * This is where data gets added to the output buffer.
         * After AddRow() you are basically mapping the column you manually added(on the left) to the data(on the right).
         * using a foreach loop to loop through the deserialize json
         */
        foreach (var item in Test.data)
        {
            Output0Buffer.AddRow();
            Output0Buffer.createdat = item.created_at;
            Output0Buffer.shopname  = item.shop_name;
        }
    }
Example #11
0
    public override void CreateNewOutputRows()
    {
        foreach (var keyVal in models)
        {
            for (int i = 0; i < keyVal.Value.Length; i++)
            {
                Output0Buffer.AddRow();
                Output0Buffer.Marka  = keyVal.Key;
                Output0Buffer.Model  = keyVal.Value[i].Item1;
                Output0Buffer.Rodzaj = keyVal.Value[i].Item2;
            }
        }

        /*
         * Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
         * For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
         */
    }
    /// <summary>
    /// This method is called once for every row that passes through the component from Input0.
    ///
    /// Example of reading a value from a column in the the row:
    ///  string zipCode = Row.ZipCode
    ///
    /// Example of writing a value to a column in the row:
    ///  Row.ZipCode = zipCode
    /// </summary>
    /// <param name="Row">The row that is currently passing through the component</param>
    public override void Input0_ProcessInputRow(Input0Buffer Row)
    {
        string previousName = "test";

        while (!Row.name.Equals(previousName) && !Row.EndOfRowset())
        {
            previousName = Row.name;
            if (Row.accountid_IsNull)
            {
                Output0Buffer.AddRow();
                Output0Buffer.accountnumber = Row.accountnumber;
                Output0Buffer.name          = Row.name;
                Output0Buffer.ownerid       = Row.ownerid;
                Output0Buffer.ownertype     = Row.ownertype;
            }
            Row.NextRow();
        }
    }
    public override void CreateNewOutputRows()
    {
        Server OLAPServer = new Server();

        OLAPServer.Connect(Variables.ASCubeServerCRConnectionString);
        foreach (Database OLAPDatabase in OLAPServer.Databases)
        {
            foreach (DatabasePermission OLAPDatabasePermission in OLAPDatabase.DatabasePermissions)
            {
                foreach (RoleMember OLAPRoleMember in OLAPDatabasePermission.Role.Members)
                {
                    Output0Buffer.AddRow();
                    Output0Buffer.DatabaseName   = OLAPDatabase.Name;
                    Output0Buffer.SourceType     = "Database";
                    Output0Buffer.SourceName     = OLAPDatabase.Name;
                    Output0Buffer.RoleName       = OLAPDatabasePermission.Role.Name;
                    Output0Buffer.RoleMemberName = OLAPRoleMember.Name;
                    Output0Buffer.Read           = OLAPDatabasePermission.Read.ToString();
                    Output0Buffer.Write          = OLAPDatabasePermission.Write.ToString();
                    Output0Buffer.Process        = OLAPDatabasePermission.Process.ToString();
                    Output0Buffer.Administrator  = OLAPDatabasePermission.Administer.ToString();
                }
            }

            foreach (Cube OLAPCube in OLAPDatabase.Cubes)
            {
                foreach (CubePermission OLAPCubePermission in OLAPCube.CubePermissions)
                {
                    foreach (RoleMember OLAPRoleMember in OLAPCubePermission.Role.Members)
                    {
                        Output0Buffer.AddRow();
                        Output0Buffer.DatabaseName   = OLAPDatabase.Name;
                        Output0Buffer.SourceType     = "Cube";
                        Output0Buffer.SourceName     = OLAPCube.Name;
                        Output0Buffer.RoleName       = OLAPCubePermission.Role.Name;
                        Output0Buffer.RoleMemberName = OLAPRoleMember.Name;
                        Output0Buffer.Read           = OLAPCubePermission.Read.ToString();
                        Output0Buffer.Write          = OLAPCubePermission.Write.ToString();
                        Output0Buffer.Process        = OLAPCubePermission.Process.ToString();
                    }
                }
            }
        }
    }
    public override void CreateNewOutputRows()
    {
        string sourceDirectory = @"C:\ssisdata";
        string fileMask        = "*.txt";
        // Variable for storing file properties
        FileInfo fileInfo;

        foreach (var currentFile in Directory.GetFiles(sourceDirectory, fileMask, SearchOption.AllDirectories))
        {
            fileInfo = new FileInfo(currentFile);
            Output0Buffer.AddRow();
            Output0Buffer.FullName      = fileInfo.FullName;
            Output0Buffer.Name          = fileInfo.Name;
            Output0Buffer.LastWriteTime = fileInfo.LastWriteTime;
            // fileInfo.Length is type Long
            // Output0Buffer.Length is type Int64
            // Too lazy to look, but I think Long could overflow Int64
            Output0Buffer.Length = fileInfo.Length;
        }
    }
Example #15
0
    private void processDataSet(DataSet dataSet)
    {
        foreach (DataTable table in dataSet.Tables)
        {
            foreach (DataRow row in table.Rows)
            {
                //foreach (DataColumn column in table.Columns) table.TableName | column.ColumnName | row[column]

                int    column     = -1;
                string value      = "";
                var    properties = Output0Buffer.GetType().GetProperties();

                Output0Buffer.AddRow();

                for (int i = 0; i < properties.Length; i++)
                {
                    var property = properties[i];
                    if (ReferenceEquals(property.PropertyType, typeof(string)))
                    {
                        if (column == -1)
                        {
                            value = table.TableName;
                        }
                        else if (column < table.Columns.Count)
                        {
                            value = row[column] is DBNull ? null : row[column].ToString();
                        }
                        else
                        {
                            continue;
                        }

                        property.SetValue(Output0Buffer, value, null);
                        column++;
                    }
                }
            }
        }
    }
Example #16
0
    public override void CreateNewOutputRows()
    {
        using (DirectorySearcher ds = new DirectorySearcher())
        {
            //ds.SearchRoot = new DirectoryEntry("LDAP://");
            ds.SearchScope = SearchScope.Subtree;
            ds.PageSize    = 100000; // This will page through the records 1000 at a time

            // Select all the users
            ds.Filter = "(&(objectCategory=User))";
            using (SearchResultCollection src = ds.FindAll())
            {
                foreach (SearchResult sr in src)
                {
                    Output0Buffer.AddRow();
                    Output0Buffer.FirstName = GetStringProperty(sr, "givenName");
                    Output0Buffer.LastName  = GetStringProperty(sr, "sn");
                    string userLogin = GetStringProperty(sr, "sAMAccountName");
                    Output0Buffer.UserLogin      = userLogin;
                    Output0Buffer.UserMail       = GetStringProperty(sr, "mail");
                    Output0Buffer.UserDomainName = GetStringProperty(sr, "userPrincipalName");
                    Output0Buffer.UserAdPath     = GetStringProperty(sr, "distinguishedName");

                    Output0Buffer.Company     = GetStringProperty(sr, "company");
                    Output0Buffer.Description = GetStringProperty(sr, "description");
                    Output0Buffer.DisplayName = GetStringProperty(sr, "displayName");
                    Output0Buffer.EmployeeNr  = GetStringProperty(sr, "employeeNumber");
                    Output0Buffer.EmployeeID  = GetStringProperty(sr, "employeeID");

                    Output0Buffer.LastLogon          = GetFileTimeProperty(sr, "lastLogon");
                    Output0Buffer.AccountExpires     = GetFileTimeProperty(sr, "accountExpires");
                    Output0Buffer.WhenCreated        = GetStringProperty(sr, "whenCreated");
                    Output0Buffer.UserAccountControl = IsActiveAccount(sr);

                    Output0Buffer.Department = GetStringProperty(sr, "department");
                    Output0Buffer.Manager    = GetStringProperty(sr, "manager");
                    Output0Buffer.Mobile     = GetStringProperty(sr, "mobile");
                    Output0Buffer.Title      = GetStringProperty(sr, "title");

                    Output0Buffer.ObjectGUID      = GetObjectGUID(sr);
                    Output0Buffer.IsCiberEmployee = GetStringProperty(sr, "distinguishedName").IndexOf(",OU=Ciber,") > 0 ? true : false;
                }
            }

            // Select the group names
            var userGroups = new List <string>()
            {
                "*"
            };
            var userGroupsDN = new List <string>();

            foreach (string group in userGroups)
            {
                ds.Filter = "(&(objectCategory=Group)(cn=" + group + "))";
                using (SearchResultCollection src = ds.FindAll())
                    foreach (SearchResult results in src)
                    {
                        userGroupsDN.Add(results.Properties["distinguishedName"][0].ToString());
                    }
            }

            foreach (string groupDN in userGroupsDN)
            {
                ds.Filter = "(&(objectCategory=User)(memberOf=" + groupDN + "))";
                using (SearchResultCollection src = ds.FindAll())
                {
                    foreach (SearchResult sr in src)
                    {
                        Output1Buffer.AddRow();
                        string userLogin = GetStringProperty(sr, "sAMAccountName");
                        Output1Buffer.UserLogin       = userLogin;
                        Output1Buffer.UserGroupName   = groupDN.Substring(3, (groupDN.IndexOf(',') - 3));
                        Output1Buffer.UserGroupAdPath = groupDN;
                    }
                }
            }
        }
    }
    public override void CreateNewOutputRows()
    {
        Server OLAPServer = new Server();

        OLAPServer.Connect(Variables.ASCubeServerCRConnectionString);
        foreach (Database OLAPDatabase in OLAPServer.Databases)
        {
            foreach (Cube OLAPCube in OLAPDatabase.Cubes)
            {
                // CUBES
                foreach (MeasureGroup OLAPMeasureGroup in OLAPCube.MeasureGroups)
                {
                    foreach (Measure OLAPMeasure in OLAPMeasureGroup.Measures)
                    {
                        Output0Buffer.AddRow();
                        Output0Buffer.DatabaseName     = OLAPDatabase.Name;
                        Output0Buffer.SourceType       = "Cube";
                        Output0Buffer.SourceName       = OLAPCube.Name;
                        Output0Buffer.MeasureGroupName = OLAPMeasureGroup.Name;
                        Output0Buffer.ObjectType       = "Measure";
                        Output0Buffer.ObjectName       = OLAPMeasure.Name;
                    }

                    foreach (MeasureGroupDimension OLAPMeasureGroupDimension in OLAPMeasureGroup.Dimensions)
                    {
                        Output0Buffer.AddRow();
                        Output0Buffer.DatabaseName     = OLAPDatabase.Name;
                        Output0Buffer.SourceType       = "Cube";
                        Output0Buffer.SourceName       = OLAPCube.Name;
                        Output0Buffer.MeasureGroupName = OLAPMeasureGroup.Name;
                        Output0Buffer.ObjectType       = "Dimension";
                        if (OLAPMeasureGroupDimension.CubeDimension.Name == OLAPMeasureGroupDimension.CubeDimension.DimensionID)
                        {
                            Output0Buffer.ObjectName = OLAPMeasureGroupDimension.CubeDimension.Name;
                        }
                        else
                        {
                            Output0Buffer.ObjectName = string.Format("{0} ({1})"
                                                                     , OLAPMeasureGroupDimension.CubeDimension.Name
                                                                     , OLAPMeasureGroupDimension.CubeDimension.DimensionID);
                        }
                    }
                }


                // PERSPECTIVES
                foreach (Perspective OLAPPerspective in OLAPCube.Perspectives)
                {
                    var mappedDimensions      = new List <CubeDimension>();
                    var perspectiveDimensions = new List <CubeDimension>();
                    foreach (PerspectiveDimension OLAPPerspectiveDimension in OLAPPerspective.Dimensions)
                    {
                        perspectiveDimensions.Add(OLAPPerspectiveDimension.CubeDimension);
                    }

                    foreach (PerspectiveMeasureGroup OLAPPerspectiveMeasureGroup in OLAPPerspective.MeasureGroups)
                    {
                        foreach (PerspectiveMeasure OLAPPerspectiveMeasure in OLAPPerspectiveMeasureGroup.Measures)
                        {
                            Output0Buffer.AddRow();
                            Output0Buffer.DatabaseName     = OLAPDatabase.Name;
                            Output0Buffer.SourceType       = "Perspective";
                            Output0Buffer.SourceName       = OLAPPerspective.Name;
                            Output0Buffer.MeasureGroupName = OLAPPerspectiveMeasureGroup.MeasureGroup.Name;
                            Output0Buffer.ObjectType       = "Measure";
                            Output0Buffer.ObjectName       = OLAPPerspectiveMeasure.Measure.Name;
                        }

                        foreach (MeasureGroupDimension OLAPMeasureGroupDimension in OLAPPerspectiveMeasureGroup.MeasureGroup.Dimensions)
                        {
                            if (perspectiveDimensions.Exists((x) => x.Equals(OLAPMeasureGroupDimension.CubeDimension)))
                            {
                                mappedDimensions.Add(OLAPMeasureGroupDimension.CubeDimension);

                                Output0Buffer.AddRow();
                                Output0Buffer.DatabaseName     = OLAPDatabase.Name;
                                Output0Buffer.SourceType       = "Perspective";
                                Output0Buffer.SourceName       = OLAPPerspective.Name;
                                Output0Buffer.MeasureGroupName = OLAPPerspectiveMeasureGroup.MeasureGroup.Name;
                                Output0Buffer.ObjectType       = "Dimension";
                                if (OLAPMeasureGroupDimension.CubeDimension.Name == OLAPMeasureGroupDimension.CubeDimension.DimensionID)
                                {
                                    Output0Buffer.ObjectName = OLAPMeasureGroupDimension.CubeDimension.Name;
                                }
                                else
                                {
                                    Output0Buffer.ObjectName = string.Format("{0} ({1})"
                                                                             , OLAPMeasureGroupDimension.CubeDimension.Name
                                                                             , OLAPMeasureGroupDimension.CubeDimension.DimensionID);
                                }
                            }
                        }
                    }

                    // PERSPECTIVE UNMAPPED DIMENSIONS

                    perspectiveDimensions.RemoveAll((x) => mappedDimensions.Contains(x));

                    foreach (CubeDimension UnmappedDimension in perspectiveDimensions)
                    {
                        Output0Buffer.AddRow();
                        Output0Buffer.DatabaseName     = OLAPDatabase.Name;
                        Output0Buffer.SourceType       = "Perspective";
                        Output0Buffer.SourceName       = OLAPPerspective.Name;
                        Output0Buffer.MeasureGroupName = null;
                        Output0Buffer.ObjectType       = "Dimension";
                        if (UnmappedDimension.Name == UnmappedDimension.DimensionID)
                        {
                            Output0Buffer.ObjectName = UnmappedDimension.Name;
                        }
                        else
                        {
                            Output0Buffer.ObjectName = string.Format("{0} ({1})"
                                                                     , UnmappedDimension.Name
                                                                     , UnmappedDimension.DimensionID);
                        }
                    }
                }
            }
        }
    }
    public override void CreateNewOutputRows()
    {
        Server server = new Server();

        server.Connect(Variables.ASTabularServerCRConnectionString);
        Regex rx = new Regex(@"_.*_*-"); // Exclude Temp DB ConnexysReporting_UserName_GUID

        foreach (Database database in server.Databases)
        {
            if (rx.Matches(database.Name).Count != 0)
            {
                continue;
            }

            var model         = database.Model;
            var relationships = new List <Relation>();
            foreach (Relationship relationship in model.Relationships)
            {
                relationships.Add(new Relation(relationship.FromTable.Name, relationship.ToTable.Name));
            }

            // Dimensions
            foreach (Relation relation in relationships)
            {
                Output0Buffer.AddRow();
                Output0Buffer.DatabaseType     = "Tabular";
                Output0Buffer.DatabaseName     = database.Name;
                Output0Buffer.SourceType       = "Model";
                Output0Buffer.SourceName       = model.Name;
                Output0Buffer.MeasureGroupName = relation.Fact;
                Output0Buffer.ObjectType       = "Dimension";
                Output0Buffer.ObjectName       = relation.Dimension;
            }

            foreach (Table table in model.Tables)
            {
                // Measures
                if (table.Measures.Count > 0)
                {
                    foreach (Measure measure in table.Measures)
                    {
                        Output0Buffer.AddRow();
                        Output0Buffer.DatabaseType     = "Tabular";
                        Output0Buffer.DatabaseName     = database.Name;
                        Output0Buffer.SourceType       = "Model";
                        Output0Buffer.SourceName       = model.Name;
                        Output0Buffer.MeasureGroupName = table.Name;
                        Output0Buffer.ObjectType       = "Measure";
                        Output0Buffer.ObjectName       = measure.Name;
                    }
                }
                // Unmapped tables
                else if (!relationships.Exists(x => x.Dimension.Equals(table.Name)))
                {
                    Output0Buffer.AddRow();
                    Output0Buffer.DatabaseType     = "Tabular";
                    Output0Buffer.DatabaseName     = database.Name;
                    Output0Buffer.SourceType       = "Model";
                    Output0Buffer.SourceName       = model.Name;
                    Output0Buffer.MeasureGroupName = null;
                    Output0Buffer.ObjectType       = "Table";
                    Output0Buffer.ObjectName       = table.Name;
                }
            }

            // Perspectives
            foreach (Perspective perspective in model.Perspectives)
            {
                var perspectiveFacts = new List <string>();
                foreach (PerspectiveTable table in perspective.PerspectiveTables)
                {
                    if (table.PerspectiveMeasures.Count > 0)
                    {
                        perspectiveFacts.Add(table.Name);
                    }
                }

                foreach (PerspectiveTable table in perspective.PerspectiveTables)
                {
                    if (relationships.Exists(x => x.Dimension.Equals(table.Name)))
                    {
                        // Dimension
                        foreach (Relation relation in relationships.FindAll(x => x.Dimension.Equals(table.Name)))
                        {
                            if (perspectiveFacts.Exists(x => x.Equals(relation.Fact)))
                            {
                                Output0Buffer.AddRow();
                                Output0Buffer.DatabaseType     = "Tabular";
                                Output0Buffer.DatabaseName     = database.Name;
                                Output0Buffer.SourceType       = "Perspective";
                                Output0Buffer.SourceName       = perspective.Name;
                                Output0Buffer.MeasureGroupName = relation.Fact;
                                Output0Buffer.ObjectType       = "Dimension";
                                Output0Buffer.ObjectName       = relation.Dimension;
                            }
                        }
                    }
                    else if (table.PerspectiveMeasures.Count > 0)
                    {
                        // Fact Measures
                        foreach (PerspectiveMeasure measure in table.PerspectiveMeasures)
                        {
                            Output0Buffer.AddRow();
                            Output0Buffer.DatabaseType     = "Tabular";
                            Output0Buffer.DatabaseName     = database.Name;
                            Output0Buffer.SourceType       = "Perspective";
                            Output0Buffer.SourceName       = perspective.Name;
                            Output0Buffer.MeasureGroupName = table.Name;
                            Output0Buffer.ObjectType       = "Measure";
                            Output0Buffer.ObjectName       = measure.Name;
                        }
                    }
                    else
                    {
                        // Unmapped table
                        Output0Buffer.AddRow();
                        Output0Buffer.DatabaseType     = "Tabular";
                        Output0Buffer.DatabaseName     = database.Name;
                        Output0Buffer.SourceType       = "Perspective";
                        Output0Buffer.SourceName       = perspective.Name;
                        Output0Buffer.MeasureGroupName = null;
                        Output0Buffer.ObjectType       = "Table";
                        Output0Buffer.ObjectName       = table.Name;
                    }
                }
            }
        }
    }