public void RegistrarInsidencia(ReturnHeader retorno, Operacion op) { _baseDeDatosServicio.BeginTransaction(); try { var sb = new StringBuilder(); sb.Append(" Update SWIFT_RECEPTION_HEADER"); sb.Append(" SET "); sb.AppendFormat(" IS_POSTED_ERP ={0}", Enums.GetStringValue(SiNo.No)); sb.AppendFormat(", POSTED_RESPONSE='{0}'", op.Mensaje); sb.Append(" , ATTEMPTED_WITH_ERROR = isnull(ATTEMPTED_WITH_ERROR,0) +1"); sb.AppendFormat(", POSTED_ERP={0}", " GetDate() "); sb.Append(" WHERE "); sb.AppendFormat(" RECEPTION_HEADER ={0}", retorno.DocEntry); _baseDeDatosServicio.ExecuteNonQuery(sb.ToString()); _baseDeDatosServicio.Commit(); } catch (Exception) { _baseDeDatosServicio.Rollback(); throw; } }
public Operacion InsertarLogDeTransaccion(string erpTarget, string operationType, string objectName, string message, string docId, string erpReference, int erpPostingAttempts) { try { _baseDeDatosServicio.BeginTransaction(); DbParameter[] parameters = { new OAParameter { ParameterName = "@ERP_TARGET", Value = erpTarget } , new OAParameter { ParameterName = "@OPERATION_TYPE", Value = operationType } , new OAParameter { ParameterName = "@OBJECT_NAME", Value = objectName } , new OAParameter { ParameterName = "@MESSAGE", Value = message } , new OAParameter { ParameterName = "@DOC_ID", Value = docId } , new OAParameter { ParameterName = "@ERP_REFERENCE", Value = erpReference } , new OAParameter { ParameterName = "@ERP_POSTING_ATTEMPTS", Value = erpPostingAttempts } }; var op = _baseDeDatosServicio.ExecuteQuery <Operacion>("SWIFT_SP_INSERT_LOG_INTERFACE", CommandType.StoredProcedure, parameters).ToList()[0]; _baseDeDatosServicio.Commit(); return(op); } catch (Exception e) { _baseDeDatosServicio.Rollback(); return(new Operacion { Codigo = -1, Mensaje = e.Message, Resultado = ResultadoOperacionTipo.Error }); } }