Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using (OracleTransaction txn = ConnectionManagerProxy.BeginTransaction(conn))
- {
- try
- {
- string id = ConnectionManagerProxy.GetNextId();
- string parentId = id;
- OracleParameter[] binds;
- string sqltext = GetCsgHouseSyncInsertSql(id, location, out binds);
- ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
- // CSG_HOUSE_SYNC_LINEOFBUSINESS Table
- foreach (var item in location.Location.LineOfBusiness)
- {
- id = ConnectionManagerProxy.GetNextId();
- sqltext = GetCsgHouseSyncLineOfBusinessInsertSql(id, parentId, item, out binds);
- ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
- }
- // CSG_HOUSE_SYNC_COMMENT Table
- foreach (var item in location.Location.Comment)
- {
- id = ConnectionManagerProxy.GetNextId();
- sqltext = GetCsgHouseSyncCommentInsertSql(id, parentId, item, out binds);
- ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
- }
- // CSG_HOUSE_SYNC_CUSTOM_FIELD Table
- foreach (var item in location.Location.CustomField)
- {
- id = ConnectionManagerProxy.GetNextId();
- sqltext = GetCsgHouseSyncCustomFieldInsertSql(id, parentId, item, out binds);
- ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
- }
- // CSG_HOUSE_SYNC_DROP_TAG Table
- foreach (var item in location.Location.Drop.Tag)
- {
- id = ConnectionManagerProxy.GetNextId();
- sqltext = GetCsgHouseSyncDropTagInsertSql(id, parentId, item, out binds);
- ConnectionManagerProxy.ExecuteNonQueryWithBindParams(sqltext, ref binds, conn);
- }
- txn.Commit();
- }
- catch (Exception ex)
- {
- txn.Rollback();
- response.ExitState = Resource.FailureExitState;
- response.ExitMessage = Resource.InsertErrorDesc;
- response.ExitMessageException =
- String.Format(
- "Exception: LocationAdded failed to insert. Message = {0}, StackTrace = {1}, InnerException = {2}",
- ex.Message, ex.StackTrace.Trim(), ex.InnerException == null ? String.Empty : ex.InnerException.Message.Trim());
- EventLogger.Log(EventType.LocationAdded, response.ExitMessageException, StatusCode.Failed, 0);
- }
- finally
- {
- ConnectionManagerProxy.Close(conn);
- }
- }
- return response;
- }
Add Comment
Please, Sign In to add comment