Guest User

Untitled

a guest
Jan 12th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. using (OracleTransaction txn = ConnectionManagerProxy.BeginTransaction(conn))
  2. {
  3. try
  4. {
  5. string id = ConnectionManagerProxy.GetNextId();
  6. string parentId = id;
  7.  
  8. OracleParameter[] binds;
  9. string sqltext = GetCsgHouseSyncInsertSql(id, location, out binds);
  10.  
  11. ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
  12.  
  13. // CSG_HOUSE_SYNC_LINEOFBUSINESS Table
  14. foreach (var item in location.Location.LineOfBusiness)
  15. {
  16. id = ConnectionManagerProxy.GetNextId();
  17. sqltext = GetCsgHouseSyncLineOfBusinessInsertSql(id, parentId, item, out binds);
  18. ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
  19. }
  20.  
  21. // CSG_HOUSE_SYNC_COMMENT Table
  22. foreach (var item in location.Location.Comment)
  23. {
  24. id = ConnectionManagerProxy.GetNextId();
  25. sqltext = GetCsgHouseSyncCommentInsertSql(id, parentId, item, out binds);
  26. ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
  27. }
  28.  
  29. // CSG_HOUSE_SYNC_CUSTOM_FIELD Table
  30. foreach (var item in location.Location.CustomField)
  31. {
  32. id = ConnectionManagerProxy.GetNextId();
  33. sqltext = GetCsgHouseSyncCustomFieldInsertSql(id, parentId, item, out binds);
  34. ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
  35. }
  36.  
  37. // CSG_HOUSE_SYNC_DROP_TAG Table
  38. foreach (var item in location.Location.Drop.Tag)
  39. {
  40. id = ConnectionManagerProxy.GetNextId();
  41. sqltext = GetCsgHouseSyncDropTagInsertSql(id, parentId, item, out binds);
  42. ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
  43. }
  44.  
  45. txn.Commit();
  46. }
  47. catch (Exception ex)
  48. {
  49. txn.Rollback();
  50.  
  51. response.ExitState = Resource.FailureExitState;
  52. response.ExitMessage = Resource.InsertErrorDesc;
  53. response.ExitMessageException =
  54. String.Format(
  55. "Exception: LocationAdded failed to insert. Message = {0}, StackTrace = {1}, InnerException = {2}",
  56. ex.Message, ex.StackTrace.Trim(), ex.InnerException == null ? String.Empty : ex.InnerException.Message.Trim());
  57. EventLogger.Log(EventType.LocationAdded, response.ExitMessageException, StatusCode.Failed, 0);
  58. }
  59. finally
  60. {
  61. ConnectionManagerProxy.Close(conn);
  62. }
  63. }
  64.  
  65. return response;
  66. }
Add Comment
Please, Sign In to add comment