Example #1
0
        private static string GetConnectionString(Guid organizationId)
        {
            string connectionString      = null;
            DatabaseTableAdapter adapter = null;

            MasterDataSet.DatabaseDataTable table = null;
            MasterDataSet.DatabaseRow       row   = null;

            try
            {
                adapter = new DatabaseTableAdapter();

                table = adapter.GetDatabaseByOrganizationId(organizationId);
                row   = table[0];

                connectionString = CreateConnectionString(row.DatabaseName, row.UserName, row.Password, row.ServerName, row.ServerInstanceName, row.Port);
            }
            finally
            {
                if (adapter != null)
                {
                    adapter.Dispose();
                }

                if (table != null)
                {
                    table.Dispose();
                }
            }

            return(connectionString);
        }
Example #2
0
        private static DataTable GetPublicDatabases(Guid organizationId, bool includeAdditionalInfo)
        {
            DataTable table = new MasterDataSet.DatabaseDataTable();

            foreach (MasterDataSet.DatabaseRow row in GetDatabases())
            {
                if (row.Private)
                {
                    if (organizationId != Guid.Empty)
                    {
                        Organization org = OrganizationProvider.GetOrganization(organizationId);
                        if (org != null)
                        {
                            if (org.DatabaseId == row.DatabaseId)
                            {
                                table.ImportRow(row);
                            }
                        }
                    }
                }
                else
                {
                    table.ImportRow(row);
                }
            }

            if (includeAdditionalInfo)
            {
                IncludeAdditionalInfo(ref table);
            }

            table.AcceptChanges();

            return(table);
        }
Example #3
0
 private static MasterDataSet.DatabaseRow GetDatabaseRowByOrganizationId(Guid organizationId)
 {
     using (DatabaseTableAdapter adapter = new DatabaseTableAdapter())
     {
         MasterDataSet.DatabaseDataTable table = adapter.GetDatabaseByOrganizationId(organizationId);
         return((table.Count > 0) ? table[0] : null);
     }
 }
Example #4
0
 public static MasterDataSet.DatabaseRow GetDatabaseRow(Guid databaseId)
 {
     using (DatabaseTableAdapter adapter = new DatabaseTableAdapter())
     {
         MasterDataSet.DatabaseDataTable table = adapter.GetDatabase(databaseId);
         return((table.Count > 0) ? table[0] : null);
     }
 }