/// <summary> /// Envia los cambios del sy_SentenciasReplicacionDataset.sy_SentenciasReplicacionDataTable a la base de datos. /// </summary> public static void Update(sy_SentenciasReplicacionDataset.sy_SentenciasReplicacionDataTable dataTable) { ApplicationAssert.Check(dataTable != null, "El argumento dataTable no debe ser nulo.", ApplicationAssert.LineNumber); ApplicationAssert.Check(dataTable.Rows.Count > 0, "El argumento dataTable debe poseer alguna fila.", ApplicationAssert.LineNumber); mz.erp.dataaccess.sy_SentenciasReplicacion.Update(dataTable); }
public static void Update(sy_SentenciasReplicacionDataset.sy_SentenciasReplicacionDataTable dataTable, SqlTransaction trx) { //German 20110301 - Tarea 0000079 /* * SqlDataAdapter adapter = new SqlDataAdapter(); * * adapter.TableMappings.AddRange( * new System.Data.Common.DataTableMapping[] { * new System.Data.Common.DataTableMapping( "Table", "sy_SentenciasReplicacion", * new System.Data.Common.DataColumnMapping[] { * new System.Data.Common.DataColumnMapping( "IdSentenciaReplicacion", "IdSentenciaReplicacion" ), * new System.Data.Common.DataColumnMapping( "IdTabla", "IdTabla" ), * new System.Data.Common.DataColumnMapping( "IdTipoSentencia", "IdTipoSentencia" ), * new System.Data.Common.DataColumnMapping( "Sentencia", "Sentencia" ), * new System.Data.Common.DataColumnMapping( "SentenciaRowId", "SentenciaRowId" ), * new System.Data.Common.DataColumnMapping( "NombreArchivo", "NombreArchivo" ), * new System.Data.Common.DataColumnMapping( "FechaCreacion", "FechaCreacion" ), * new System.Data.Common.DataColumnMapping( "IdConexionCreacion", "IdConexionCreacion" ), * new System.Data.Common.DataColumnMapping( "UltimaModificacion", "UltimaModificacion" ), * new System.Data.Common.DataColumnMapping( "IdConexionUltimaModificacion", "IdConexionUltimaModificacion" ), * new System.Data.Common.DataColumnMapping( "RowId", "RowId" ), * new System.Data.Common.DataColumnMapping( "IdSucursalGeneradora", "IdSucursalGeneradora" ), * new System.Data.Common.DataColumnMapping( "IdConexion", "IdConexion" ), * new System.Data.Common.DataColumnMapping( "Destino", "Destino" ), * new System.Data.Common.DataColumnMapping( "VersionBD", "VersionBD" ) * } * ) * } * ); * * SqlCommand sqlCommandUpdate = new SqlCommand( "Pr_sy_SentenciasReplicacion_Update", trx.Connection ); * sqlCommandUpdate.Transaction = trx; * sqlCommandUpdate.CommandType = CommandType.StoredProcedure; * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@IdSentenciaReplicacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "IdSentenciaReplicacion", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@IdTabla", SqlDbType.VarChar, 300, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "IdTabla", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@IdTipoSentencia", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "IdTipoSentencia", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@Sentencia", SqlDbType.Text, 2147483647, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "Sentencia", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@SentenciaRowId", SqlDbType.UniqueIdentifier, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "SentenciaRowId", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@NombreArchivo", SqlDbType.VarChar, 250, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "NombreArchivo", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@UltimaModificacion", SqlDbType.Timestamp, 8, ParameterDirection.InputOutput, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "UltimaModificacion", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@IdConexionUltimaModificacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "IdConexionUltimaModificacion", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@IdSucursalGeneradora", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "IdSucursalGeneradora", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@IdConexion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "IdConexion", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@Destino", SqlDbType.VarChar, 50, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "Destino", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@VersionBD", SqlDbType.VarBinary, 50, ParameterDirection.Input, false, ( ( System.Byte )( 0 )), ( ( System.Byte )( 0 ) ), "VersionBD", DataRowVersion.Current, null ) ); * sqlCommandUpdate.Parameters.Add( new SqlParameter( "@OldIdSentenciaReplicacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdSentenciaReplicacion", DataRowVersion.Original, null ) ); * * SqlCommand sqlCommandDelete = new SqlCommand( "Pr_sy_SentenciasReplicacion_Delete", trx.Connection ); * sqlCommandDelete.Transaction = trx; * sqlCommandDelete.CommandType = CommandType.StoredProcedure; * sqlCommandDelete.Parameters.Add( new SqlParameter( "@IdSentenciaReplicacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdSentenciaReplicacion", DataRowVersion.Original, null ) ); * sqlCommandDelete.Parameters.Add( new SqlParameter( "@UltimaModificacion", SqlDbType.Timestamp, 8, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "UltimaModificacion", DataRowVersion.Original, null ) ); * * SqlCommand sqlCommandInsert = new SqlCommand("Pr_sy_SentenciasReplicacion_Insert", trx.Connection ); * sqlCommandInsert.Transaction = trx; * sqlCommandInsert.CommandType = CommandType.StoredProcedure; * sqlCommandInsert.Parameters.Add( new SqlParameter( "@IdTabla", SqlDbType.VarChar, 300, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdTabla", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@IdTipoSentencia", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdTipoSentencia", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@Sentencia", SqlDbType.Text, 2147483647, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "Sentencia", DataRowVersion.Current, null ) ); * //sqlCommandInsert.Parameters.Add( new SqlParameter( "@SentenciaRowId", SqlDbType.UniqueIdentifier, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "SentenciaRowId", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@NombreArchivo", SqlDbType.VarChar, 250, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "NombreArchivo", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@FechaCreacion", SqlDbType.DateTime, 0, ParameterDirection.InputOutput, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "FechaCreacion", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@IdConexionCreacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdConexionCreacion", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@IdSucursalGeneradora", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdSucursalGeneradora", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@IdConexion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdConexion", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@Destino", SqlDbType.VarChar, 50, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "Destino", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@VersionBD", SqlDbType.VarBinary, 50, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "VersionBD", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add( new SqlParameter( "@IdSentenciaReplicacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ( ( System.Byte )( 0 ) ), ( ( System.Byte )( 0 ) ), "IdSentenciaReplicacion", DataRowVersion.Current, null ) ); * sqlCommandInsert.Parameters.Add("@SentenciaRowId", SqlDbType.UniqueIdentifier).Value = System.DBNull.Value; * * adapter.UpdateCommand = sqlCommandUpdate; * adapter.DeleteCommand = sqlCommandDelete; * adapter.InsertCommand = sqlCommandInsert; * * System.Diagnostics.Debug.WriteLine((string)dataTable.Rows[0]["Sentencia"]); * * adapter.Update ( dataTable ); */ //Fin German 20110301 - Tarea 0000079 }
public static void Update(sy_SentenciasReplicacionDataset.sy_SentenciasReplicacionDataTable dataTable, string IdTransaction) { SqlTransaction trx = PoolTransaction.GetTransactionById(IdTransaction); Update(dataTable, trx); }