private void UpdateDatabase() { // Get ids int toDoId = Int32.Parse(hdfToDoListId.Value); string toDolistType = hdfFmType.Value; int companyId = Int32.Parse(hdfCompanyId.Value); // Delete DB.Open(); DB.BeginTransaction(); try { ToDoListToDoListActivity toDoListToDoListActivity = new ToDoListToDoListActivity(toDolistInformationTDS); toDoListToDoListActivity.DeleteAllDirect(toDoId, companyId); ToDoListToDoList toDoList = new ToDoListToDoList(null); toDoList.DeleteDirect(toDoId, companyId); DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }