Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public static string GetConnectionStringByOrganizationId(Guid organizationId)
 {
     MasterDataSet.DatabaseRow row = GetDatabaseRowByOrganizationId(organizationId);
     if (row != null)
     {
         return(CreateConnectionString(row.Name, row.UserName, row.Password, row["DatabaseServerName"].ToString(), row["InstanceName"].ToString(), (int)row["Port"]));
     }
     return(string.Empty);
 }
Exemplo n.º 3
0
        public static void DeleteDatabase(Guid databaseId)
        {
            MasterDataSet.DatabaseRow row = GetDatabaseRow(databaseId);
            if (row == null)
            {
                return;
            }

            row.Deleted = true;

            using (DatabaseTableAdapter adapter = new DatabaseTableAdapter())
            {
                adapter.Update(row);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Returns the name of the specified database.
 /// </summary>
 /// <param name="databaseId">Specifies the database identifier.</param>
 /// <returns>The System.String that represents the name of the specified database.</returns>
 internal static string GetDatabaseName(Guid databaseId)
 {
     MasterDataSet.DatabaseRow row = GetDatabaseRow(databaseId);
     return((row == null) ? string.Empty : row.Name);
 }