Exemple #1
0
 // [ApiAntiForgeryValidate]
 public string DeleteAll()
 {
     _dbProvider.ContextAction(c =>
     {
         _authUsersInitializer.DeleteAll(c);
         return(true);
     });
     return("Ok");
 }
        public void DeleteAll(IDbConnection connection)
        {
            var scheme = @"[dbo].";
            //@createFkOrDeleteFk bit
            //@createFkOrDeleteFk
            var sqlBefore = $"EXEC {scheme}[g_detail_planet_change_fk_userId] 0; " +
                            $"EXEC {scheme}[g_detail_system_fk_allianceId] 0; " +
                            $"EXEC {scheme}[c_officer_delete_all]; " +
                            $"EXEC {scheme}[c_officer_histroy_delete_all]; " +
                            $"EXEC {scheme}[c_vote_delete_all];" +
                            $"EXEC {scheme}[c_vote_history_delete_all]; " +
                            $"EXEC {scheme}[c_officer_candidat_delete_all]; " +
                            $"EXEC {scheme}[c_officer_candidat_histrory_delete_all]; " +
                            $"EXEC {scheme}[help_reset_index] 'c_officer',0; " +
                            $"EXEC {scheme}[help_reset_index] 'c_officer_histroy',0; " +
                            $"EXEC {scheme}[help_reset_index] 'c_officer_candidat',0; " +
                            $"EXEC {scheme}[help_reset_index] 'c_officer_candidat_histrory',0; " +
                            $"EXEC {scheme}[help_reset_index] 'c_vote',0; " +
                            $"EXEC {scheme}[help_reset_index] 'c_vote_history',0; " +
                            $"";

            var sqlAfter = $"EXEC {scheme}[g_detail_planet_change_fk_userId] 1;" +
                           $"EXEC {scheme}[g_detail_system_fk_allianceId] 1;";

            _provider.Exec(connection, sqlBefore);

            //c.g_detail_planet_change_fk_userId(false);
            //c.g_detail_system_fk_allianceId(false);
            //c.c_officer_delete_all();
            //c.c_officer_histroy_delete_all();

            //c.c_officer_candidat_delete_all();
            //c.c_officer_candidat_histrory_delete_all();

            //c.c_vote_delete_all();
            //c.c_vote_history_delete_all();
            _gameUserService.DeleteAll(connection);
            _allianceInitializer.DeleteAll(connection);
            if (deletAuthUsers)
            {
                _authUsersInitializer.DeleteAll(connection);
            }
            _mapGInitializer.DeleteAll(connection);

            _provider.Exec(connection, sqlAfter);

            //c.g_detail_planet_change_fk_userId(true);
            //c.g_detail_system_fk_allianceId(true);
        }