示例#1
0
        public static Table CreateUsersTable(ITable profileTable)
        {
            Table            table            = new Table(SystemeConstants.UsersTableName);
            DataTypesFactory dataTypesFactory = DataTypesFactory.GetDataTypesFactory();
            Column           userColumn       = new Column(SystemeConstants.UsersNameColumnName, dataTypesFactory.GetDataType(SystemeConstants.UsersNameColumnType));
            Column           profileColumn    = new Column(SystemeConstants.UsersProfileColumnName, dataTypesFactory.GetDataType(SystemeConstants.UsersProfileColumnType));

            table.AddColumn(userColumn);
            table.AddColumn(new Column(SystemeConstants.UsersPasswordColumnName, dataTypesFactory.GetDataType(SystemeConstants.UsersPasswordColumnType)));
            table.AddColumn(profileColumn);
            table.primaryKey.AddKey(userColumn);
            table.foreignKey.AddForeignKey(profileColumn, profileTable.GetColumn(SystemeConstants.ProfileNameColumn));
            Row row = table.CreateRowDefinition();

            row.GetCell(userColumn.columnName).data = SystemeConstants.AdminUser;
            row.GetCell(SystemeConstants.UsersPasswordColumnName).data = SystemeConstants.AdminPassword;
            row.GetCell(profileColumn.columnName).data = SystemeConstants.DefaultProfile;
            table.AddRow(row);
            row = table.CreateRowDefinition();
            row.GetCell(userColumn.columnName).data = SystemeConstants.AnonimousUser;
            row.GetCell(SystemeConstants.UsersPasswordColumnName).data = SystemeConstants.AnonimousPassword;
            row.GetCell(profileColumn.columnName).data = SystemeConstants.AnonimousProfile;
            table.AddRow(row);
            return(table);
        }
        public void TestGetDoubleTypeDataType()
        {
            DataTypesFactory dataTypesFactory = GetDataTypesFactory();
            DoubleType       doubleType       = DoubleType.GetDoubleType();

            Assert.AreEqual(doubleType, dataTypesFactory.GetDataType(TypesKeyConstants.DoubleTypeKey));
        }
        public void TestGetIntTypeDataType()
        {
            DataTypesFactory dataTypesFactory = GetDataTypesFactory();
            IntType          intType          = IntType.GetIntType();

            Assert.AreEqual(intType, dataTypesFactory.GetDataType(TypesKeyConstants.IntTypeKey));
        }
        public void TestGetStringTypeDataType()
        {
            DataTypesFactory dataTypesFactory = GetDataTypesFactory();
            StringType       stringType       = StringType.GetStringType();

            Assert.AreEqual(stringType, dataTypesFactory.GetDataType(TypesKeyConstants.StringTypeKey));
        }
示例#5
0
        public static Table CreatePrivilegesOfProfilesInDatabasesTable(ITable profilesTable, ITable privilegesTable)
        {
            Table            table               = new Table(SystemeConstants.PrivilegesOfProfilesOnDatabasesTableName);
            DataTypesFactory dataTypesFactory    = DataTypesFactory.GetDataTypesFactory();
            Column           profilesNameColumn  = new Column(SystemeConstants.PrivilegesOfProfilesOnDatabasesProfileColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnDatabasesProfileColumnType));
            Column           databaseNameColumn  = new Column(SystemeConstants.PrivilegesOfProfilesOnDatabasesDatabaseNameColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnDatabasesDatabaseNameColumnType));
            Column           privilegeNameColumn = new Column(SystemeConstants.PrivilegesOfProfilesOnDatabasesPrivilegeColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnDatabasesPrivilegeColumnType));

            table.AddColumn(profilesNameColumn);
            table.AddColumn(databaseNameColumn);
            table.AddColumn(privilegeNameColumn);
            table.primaryKey.AddKey(profilesNameColumn);
            table.primaryKey.AddKey(databaseNameColumn);
            table.primaryKey.AddKey(privilegeNameColumn);
            table.foreignKey.AddForeignKey(profilesNameColumn, profilesTable.GetColumn(SystemeConstants.ProfileNameColumn));
            table.foreignKey.AddForeignKey(privilegeNameColumn, privilegesTable.GetColumn(SystemeConstants.DatabasesPrivilegesPrivilegeNameColumnName));
            return(table);
        }
示例#6
0
        public static Table CreatePrivilegesOfProfilesTable(ITable profilesTable, ITable privilegesTable)
        {
            Table            table               = new Table(SystemeConstants.PrivilegesOfProfilesOnTablesTableName);
            DataTypesFactory dataTypesFactory    = DataTypesFactory.GetDataTypesFactory();
            Column           profilesNameColumn  = new Column(SystemeConstants.PrivilegesOfProfilesOnTablesProfileColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnTablesProfileColumnType));
            Column           databaseNameColumn  = new Column(SystemeConstants.PrivilegesOfProfilesOnTablesDatabaseNameColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnTablesDatabaseNameColumnType));
            Column           tableNameColumn     = new Column(SystemeConstants.PrivilegesOfProfilesOnTablesTableNameColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnTablesTableNameColumnNameColumnType));
            Column           privilegeNameColumn = new Column(SystemeConstants.PrivilegesOfProfilesOnTablesPrivilegeColumnName, dataTypesFactory.GetDataType(SystemeConstants.PrivilegesOfProfilesOnTablesPrivilegeColumnType));

            table.AddColumn(profilesNameColumn);
            table.AddColumn(databaseNameColumn);
            table.AddColumn(tableNameColumn);
            table.AddColumn(privilegeNameColumn);
            table.primaryKey.AddKey(profilesNameColumn);
            table.primaryKey.AddKey(databaseNameColumn);//Se podria crear una tabla para guardar datos de las tablas y otras para los datos de las databases, pero bueno, no me ha dado la gana de hacerlo.
            table.primaryKey.AddKey(tableNameColumn);
            table.primaryKey.AddKey(privilegeNameColumn);
            table.foreignKey.AddForeignKey(profilesNameColumn, profilesTable.GetColumn(SystemeConstants.ProfileNameColumn));
            table.foreignKey.AddForeignKey(privilegeNameColumn, privilegesTable.GetColumn(SystemeConstants.PrivilegesPrivilegeNameColumnName));
            return(table);
        }