public void InitalizeTables(
            AsyncRPGDataContext dbContext,
            Logger logger)
        {
            // Save the server constants into the DB
            ConfigQueries.InitializeConfig(
                dbContext,
                m_config.APPLICATION_VERSION,
                m_config.APPLICATION_WEB_URL,
                m_config.APPLICATION_DEBUG_WEB_URL,
                m_config.ACCOUNT_CLIENT_URL,
                m_config.WEB_SERVICE_EMAIL_ADDRESS,
                m_config.WEB_SERVICE_EMAIL_HOST,
                m_config.WEB_SERVICE_EMAIL_PORT,
                m_config.WEB_SERVICE_EMAIL_USERNAME,
                m_config.WEB_SERVICE_EMAIL_PASSWORD,
                m_config.DEFAULT_IRC_SERVER,
                m_config.DEFAULT_IRC_PORT);

            // Create test accounts
            AccountQueries.CreateAccountNoEmailVerify(
                dbContext,
                "test",
                AccountQueries.ClientPasswordHash("password"),
                "*****@*****.**",
                DatabaseConstants.OpsLevel.player);
            AccountQueries.CreateAccountNoEmailVerify(
                dbContext,
                "test2",
                AccountQueries.ClientPasswordHash("password"),
                "*****@*****.**",
                DatabaseConstants.OpsLevel.player);

            // Re-import the mob type JSON data into the DB
            {
                MobTypeImporter importer = new MobTypeImporter(logger);

                importer.ParseMobTypes(dbContext, m_config.MOBS_DIRECTORY + "/mob_types.json");
            }

            // Re-import the mob spawn tables JSON data into the DB (dependent on mob types)
            {
                MobSpawnTableImporter importer = new MobSpawnTableImporter(logger);

                importer.ParseMobSpawnTables(dbContext, m_config.MOBS_DIRECTORY + "/mob_spawn_tables.json");
            }

            // Re-import the room template XML into the DB (dependent on mob types and spawn tables)
            // This also does some import processing on the room templates (visibility, nav-mesh, etc).
            {
                RoomTemplateImporter importer = new RoomTemplateImporter(logger);

                importer.ParseRoomTemplates(dbContext, m_config.MAPS_DIRECTORY);
            }
        }
        public string AccountPlainTextLoginRequest(string username, string password)
        {
            BasicResponse loginResponse = new BasicResponse();

            if (RestUtilities.GetSessionUsername(Session) == null)
            {
                // Initially, we are not authenticated yet
                Session["Authenticated"] = false;

                if (username.Length > 0 && password.Length > 0)
                {
                    string hashedPassword = AccountQueries.ClientPasswordHash(password);

                    AccountLoginRequestProcessor loginProcessor =
                        new AccountLoginRequestProcessor(username, hashedPassword);

                    if (loginProcessor.ProcessRequest(
                            ApplicationConstants.CONNECTION_STRING,
                            Application,
                            out loginResponse.result))
                    {
                        Session["Authenticated"] = true;
                        Session["AccountId"]     = loginProcessor.AccountID;
                        Session["OpsLevel"]      = loginProcessor.OpsLevel;
                        Session["EmailAddress"]  = loginProcessor.EmailAddress;
                        Session["CharacterIDs"]  = loginProcessor.AccountCharacterIDs;
                        Session["Username"]      = username;

                        loginResponse.result = SuccessMessages.GENERAL_SUCCESS;
                    }
                }
                else
                {
                    loginResponse.result = ErrorMessages.MALFORMED_REQUEST;
                }
            }
            else
            {
                loginResponse.result = ErrorMessages.ALREADY_LOGGED_IN;
            }

            return(JSONUtilities.SerializeJSONResponse <BasicResponse>(loginResponse));
        }