public ContactTest() { try { Amns.GreyFox.Data.MsJetUtility.CreateDB("Test.mdb"); } catch {} try { GreyFoxContactManager manager = new GreyFoxContactManager("TestContacts"); manager.CreateTable(); } catch { } // For load testing please make sure "Run unit tests in application domain" is set to // true in the Run Settings! contactA = PeopleTestData.GetInstance().ContactA; contactB = PeopleTestData.GetInstance().ContactB; contactC = PeopleTestData.GetInstance().ContactC; }
public void CreateTable() { StringBuilder query; Database database; DbCommand dbCommand; database = DatabaseFactory.CreateDatabase(); if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0")) { // Microsoft Jet SQL query = new StringBuilder("CREATE TABLE sysGlobal_Users "); query.Append(" (GreyFoxUserID COUNTER(1,1) CONSTRAINT PK_sysGlobal_Users PRIMARY KEY, " + "UserName TEXT(25) CONSTRAINT UniqueUserName UNIQUE," + "IsDisabled BIT," + "LoginDate DATETIME," + "LoginCount LONG," + "LoginPassword TEXT(50)," + "ContactID LONG," + "ActivationID TEXT(25));"); } else { // Microsoft SQL Server query = new StringBuilder("CREATE TABLE sysGlobal_Users "); query.Append(" (GreyFoxUserID INT IDENTITY(1,1) CONSTRAINT PK_sysGlobal_Users PRIMARY KEY, " + "UserName NVARCHAR(25) CONSTRAINT UniqueUserName UNIQUE," + "IsDisabled BIT," + "LoginDate DATETIME," + "LoginCount INT," + "LoginPassword NVARCHAR(50)," + "ContactID INT," + "ActivationID NVARCHAR(25));"); } dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); // // Create object level table for Contact. // GreyFoxContactManager contactManager = new GreyFoxContactManager("sysGlobal_Contacts"); contactManager.CreateTable(); // // Create children table for Roles. // query.Length = 0; if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0")) { query.Append("CREATE TABLE sysGlobal_UsersChildren_Roles "); query.Append("(GreyFoxUserID LONG, GreyFoxRoleID LONG);"); dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); } else { query.Append("CREATE TABLE sysGlobal_UsersChildren_Roles "); query.Append("(GreyFoxUserID INT, GreyFoxRoleID INT);"); dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); } }
public void CreateTable() { StringBuilder query; Database database; DbCommand dbCommand; database = DatabaseFactory.CreateDatabase(); if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0")) { // Microsoft Jet SQL query = new StringBuilder("CREATE TABLE kitTessen_Organizations "); query.Append(" (DojoOrganizationID COUNTER(1,1) CONSTRAINT PK_kitTessen_Organizations PRIMARY KEY, " + "Name TEXT(75)," + "Description MEMO," + "LocationID LONG," + "AdministrativeContactID LONG," + "WebServiceUrl TEXT(255)," + "RefreshTime DOUBLE," + "IsPrimary BIT," + "DefaultMemberTypeID LONG," + "PromotionFlagEnabled BIT);"); } else { // Microsoft SQL Server query = new StringBuilder("CREATE TABLE kitTessen_Organizations "); query.Append(" (DojoOrganizationID INT IDENTITY(1,1) CONSTRAINT PK_kitTessen_Organizations PRIMARY KEY, " + "Name NVARCHAR(75)," + "Description NTEXT," + "LocationID INT," + "AdministrativeContactID INT," + "WebServiceUrl NVARCHAR(255)," + "RefreshTime FLOAT," + "IsPrimary BIT," + "DefaultMemberTypeID INT," + "PromotionFlagEnabled BIT);"); } dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); // // Create object level table for Location. // GreyFoxContactManager locationManager = new GreyFoxContactManager("kitTessen_Locations"); locationManager.CreateTable(); // // Create object level table for ClassLocations. // GreyFoxContactManager classLocationsManager = new GreyFoxContactManager("kitTessen_Locations"); classLocationsManager.CreateTable(); // // Create children table for ClassLocations. // query.Length = 0; if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0")) { query.Append("CREATE TABLE kitTessen_OrganizationsChildren_ClassLocations "); query.Append("(DojoOrganizationID LONG, GreyFoxContactID LONG);"); dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); } else { query.Append("CREATE TABLE kitTessen_OrganizationsChildren_ClassLocations "); query.Append("(DojoOrganizationID INT, GreyFoxContactID INT);"); dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); } // // Create object level table for AdministrativeContact. // GreyFoxContactManager administrativeContactManager = new GreyFoxContactManager("sysGlobal_Contacts"); administrativeContactManager.CreateTable(); }
public void CreateTable() { StringBuilder query; Database database; DbCommand dbCommand; database = DatabaseFactory.CreateDatabase(); if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0")) { // Microsoft Jet SQL query = new StringBuilder("CREATE TABLE kitTessen_Seminars "); query.Append(" (DojoSeminarID COUNTER(1,1) CONSTRAINT PK_kitTessen_Seminars PRIMARY KEY, " + "Name TEXT(75)," + "StartDate DATETIME," + "EndDate DATETIME," + "Description MEMO," + "IsLocal BIT," + "LocationID LONG," + "ClassUnitFee CURRENCY," + "ClassUnitType BYTE," + "BaseRegistrationFee CURRENCY," + "RegistrationEnabled BIT," + "RegistrationStart DATETIME," + "FullEarlyRegistrationFee CURRENCY," + "EarlyEndDate DATETIME," + "FullRegistrationFee CURRENCY," + "LateStartDate DATETIME," + "FullLateRegistrationFee CURRENCY," + "RegistrationEnd DATETIME," + "Details MEMO," + "DetailsOverrideUrl TEXT(255)," + "PdfUrl TEXT(255)," + "ItemID LONG);"); } else { // Microsoft SQL Server query = new StringBuilder("CREATE TABLE kitTessen_Seminars "); query.Append(" (DojoSeminarID INT IDENTITY(1,1) CONSTRAINT PK_kitTessen_Seminars PRIMARY KEY, " + "Name NVARCHAR(75)," + "StartDate DATETIME," + "EndDate DATETIME," + "Description NTEXT," + "IsLocal BIT," + "LocationID INT," + "ClassUnitFee MONEY," + "ClassUnitType TINYINT," + "BaseRegistrationFee MONEY," + "RegistrationEnabled BIT," + "RegistrationStart DATETIME," + "FullEarlyRegistrationFee MONEY," + "EarlyEndDate DATETIME," + "FullRegistrationFee MONEY," + "LateStartDate DATETIME," + "FullLateRegistrationFee MONEY," + "RegistrationEnd DATETIME," + "Details NTEXT," + "DetailsOverrideUrl NVARCHAR(255)," + "PdfUrl NVARCHAR(255)," + "ItemID INT);"); } dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); // // Create object level table for Location. // GreyFoxContactManager locationManager = new GreyFoxContactManager("kitTessen_Locations"); locationManager.CreateTable(); // // Create children table for Options. // query.Length = 0; if (database.ConnectionStringWithoutCredentials.StartsWith("provider=microsoft.jet.oledb.4.0")) { query.Append("CREATE TABLE kitTessen_SeminarsChildren_Options "); query.Append("(DojoSeminarID LONG, DojoSeminarOptionID LONG);"); dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); } else { query.Append("CREATE TABLE kitTessen_SeminarsChildren_Options "); query.Append("(DojoSeminarID INT, DojoSeminarOptionID INT);"); dbCommand = database.GetSqlStringCommand(query.ToString()); database.ExecuteNonQuery(dbCommand); } }