Index: branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs
===================================================================
--- branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs	(revision 9645)
+++ branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/BillingService.cs	(revision 10013)
@@ -19,4 +19,12 @@
     }
 
+    private ITransactionManager transaction;
+    private ITransactionManager Transaction {
+      get {
+        if (transaction == null) transaction = new TransactionManager();
+        return transaction;
+      }
+    }
+
     #endregion
 
@@ -25,12 +33,14 @@
     public IList<Product> GetProducts() {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      return BillingDao.FindAllProducts().ToList();
+      return Transaction.UseTransaction(() => {
+        return BillingDao.FindAllProducts().ToList();
+      });
     }
 
     public IList<Product> GetProductByName(string productName) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      return BillingDao.FindProdcutBy(prod => prod.Name == productName).ToList();
+      return Transaction.UseTransaction(() => {
+        return BillingDao.FindProdcutBy(prod => prod.Name == productName).ToList();
+      });
     }
 
@@ -41,25 +51,29 @@
     public void SaveOrder(Order order) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      BillingDao.InsertOrUpdateOrder(order);
+      Transaction.UseTransaction(() => {
+        BillingDao.InsertOrUpdateOrder(order);
+      });
     }
 
     public IList<Order> GetOrdersByState(OrderState state) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      return BillingDao.FindOrderBy(order => order.StateValue == (int)state).ToList();
+      return Transaction.UseTransaction(() => {
+        return BillingDao.FindOrderBy(order => order.StateValue == (int)state).ToList();
+      });
     }
 
     public IList<Order> GetOrders(string userName) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      User user = GetUser(userName);
-      return BillingDao.FindOrderBy(order => order.User == user).ToList();
+      return Transaction.UseTransaction(() => {
+        User user = GetUser(userName);
+        return BillingDao.FindOrderBy(order => order.User == user).ToList();
+      });
     }
 
     public void UpdateOrder(Order order) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      BillingDao.InsertOrUpdateOrder(order);
+      Transaction.UseTransaction(() => {
+        BillingDao.InsertOrUpdateOrder(order);
+      });
     }
 
@@ -70,12 +84,14 @@
     public User GetUser(string userName) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      return BillingDao.FindUserBy(u => u.Name == userName).First();
+      return Transaction.UseTransaction(() => {
+        return BillingDao.FindUserBy(u => u.Name == userName).First();
+      });
     }
 
     public void SaveUser(User user) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      BillingDao.InsertOrUpdateUser(user);
+      Transaction.UseTransaction(() => {
+        BillingDao.InsertOrUpdateUser(user);
+      });
     }
 
@@ -86,7 +102,8 @@
     public IList<UsageRecord> GetUsageRecords(string userName) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      User user = GetUser(userName);
-      return BillingDao.FindUsageRecordsBy(ur => ur.User == user).ToList();
+      return Transaction.UseTransaction(() => {
+        User user = GetUser(userName);
+        return BillingDao.FindUsageRecordsBy(ur => ur.User == user).ToList();
+      });
     }
 
@@ -101,13 +118,15 @@
     public IList<Invoice> GetInvoices(string userName) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      User user = GetUser(userName);
-      return BillingDao.FindInvoiceBy(inv => inv.User == user).ToList();
+      return Transaction.UseTransaction(() => {
+        User user = GetUser(userName);
+        return BillingDao.FindInvoiceBy(inv => inv.User == user).ToList();
+      });
     }
 
     public void SaveInvoice(Invoice invoice) {
       //TODO: Authentication
-      //TODO: Enable Transaction
-      BillingDao.InsertOrUpdateInvoice(invoice);
+      Transaction.UseTransaction(() => {
+        BillingDao.InsertOrUpdateInvoice(invoice);
+      });
     }
 
Index: branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/TransactionManager.cs
===================================================================
--- branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/TransactionManager.cs	(revision 10013)
+++ branches/OaaS/HeuristicLab.Services.Optimization.Billing/Business/TransactionManager.cs	(revision 10013)
@@ -0,0 +1,76 @@
+﻿using System;
+using System.Configuration;
+using System.Data.SqlClient;
+using System.Diagnostics;
+using System.Transactions;
+using HeuristicLab.Services.Optimization.Billing.Interfaces;
+
+namespace HeuristicLab.Services.Optimization.Billing.Business {
+  public class TransactionManager : ITransactionManager {
+    private const int retries = 10;
+    private readonly TimeSpan timeoutInterval;
+
+    public TransactionManager() {
+      timeoutInterval = TimeSpan.Parse(ConfigurationManager.AppSettings["LongRunningDbCommandTimeout"]);
+    }
+
+    public void UseTransaction(System.Action call, bool repeatableRead = false, bool longRunning = false) {
+      int n = retries;
+      while (n > 0) {
+        TransactionScope transaction = CreateTransaction(repeatableRead, longRunning);
+        try {
+          call();
+          transaction.Complete();
+          n = 0;
+        }
+        catch (SqlException ex) {
+          n--;
+          // TODO: log exception
+          Trace.WriteLine(string.Format("Exception occured, repeating transaction {0} more times: {1}", n, ex.ToString()));
+          if (n <= 0) throw;
+        }
+        finally {
+          transaction.Dispose();
+        }
+      }
+    }
+
+    public T UseTransaction<T>(System.Func<T> call, bool repeatableRead = false, bool longRunning = false) {
+      int n = retries;
+      while (n > 0) {
+        TransactionScope transaction = CreateTransaction(repeatableRead, longRunning);
+        try {
+          T result = call();
+          transaction.Complete();
+          n = 0;
+          return result;
+        }
+        catch (SqlException ex) {
+          n--;
+          // TODO: log exception
+          Trace.WriteLine(string.Format("Exception occured, repeating transaction {0} more times: {1}", n, ex.ToString()));
+          if (n <= 0) throw;
+        }
+        finally {
+          transaction.Dispose();
+        }
+      }
+      throw new Exception("This code should not be reached");
+    }
+
+    private TransactionScope CreateTransaction(bool repeatableRead, bool longRunning) {
+      var options = new TransactionOptions();
+      if (repeatableRead) {
+        options.IsolationLevel = IsolationLevel.RepeatableRead;
+      } else {
+        options.IsolationLevel = IsolationLevel.ReadUncommitted;
+      }
+
+      if (longRunning) {
+        options.Timeout = timeoutInterval;
+      }
+
+      return new TransactionScope(TransactionScopeOption.Required, options);
+    }
+  }
+}
