예제 #1
0
        /// <summary>
        /// Envia los cambios del tsa_FacturasImpagasDataset.tsa_FacturasImpagasDataTable a la base de datos.
        /// </summary>
        public static void Update(tsa_FacturasImpagasDataset.tsa_FacturasImpagasDataTable 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.tsa_FacturasImpagas.Update(dataTable);
        }
예제 #2
0
        public static void Update(tsa_FacturasImpagasDataset.tsa_FacturasImpagasDataTable dataTable, SqlTransaction trx)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.AddRange(
                new System.Data.Common.DataTableMapping[] {
                new System.Data.Common.DataTableMapping("Table", "tsa_FacturasImpagas",
                                                        new System.Data.Common.DataColumnMapping[] {
                    new System.Data.Common.DataColumnMapping("IdCuenta", "IdCuenta"),
                    new System.Data.Common.DataColumnMapping("Cuenta", "Cuenta"),
                    new System.Data.Common.DataColumnMapping("IdComprobante", "IdComprobante"),
                    new System.Data.Common.DataColumnMapping("Numero", "Numero"),
                    new System.Data.Common.DataColumnMapping("IdTipoDeComprobante", "IdTipoDeComprobante"),
                    new System.Data.Common.DataColumnMapping("TipoDeComprobante", "TipoDeComprobante"),
                    new System.Data.Common.DataColumnMapping("FechaEmision", "FechaEmision"),
                    new System.Data.Common.DataColumnMapping("FechaVencimiento", "FechaVencimiento"),
                    new System.Data.Common.DataColumnMapping("Vendedores", "Vendedores"),
                    new System.Data.Common.DataColumnMapping("Total", "Total"),
                    new System.Data.Common.DataColumnMapping("SaldoFactura", "SaldoFactura"),
                    new System.Data.Common.DataColumnMapping("IdTiposComprobantesPredecesores", "IdTiposComprobantesPredecesores"),
                    new System.Data.Common.DataColumnMapping("IdOrdenReparaciones", "IdOrdenReparaciones"),
                    new System.Data.Common.DataColumnMapping("SaldoCtaCte", "SaldoCtaCte"),
                    new System.Data.Common.DataColumnMapping("SaldoCtaCteDV", "SaldoCtaCteDV"),
                    new System.Data.Common.DataColumnMapping("SaldoCtaCteConsolidado", "SaldoCtaCteConsolidado"),
                    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")
                }
                                                        )
            }
                );

            SqlCommand sqlCommandUpdate = new SqlCommand("Pr_tsa_FacturasImpagas_Update", trx.Connection);

            sqlCommandUpdate.Transaction = trx;
            sqlCommandUpdate.CommandType = CommandType.StoredProcedure;
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdCuenta", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdCuenta", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@Cuenta", SqlDbType.VarChar, 500, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Cuenta", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdComprobante", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdComprobante", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@Numero", SqlDbType.VarChar, 50, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Numero", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdTipoDeComprobante", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTipoDeComprobante", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@TipoDeComprobante", SqlDbType.VarChar, 256, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "TipoDeComprobante", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@FechaEmision", SqlDbType.DateTime, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FechaEmision", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@FechaVencimiento", SqlDbType.DateTime, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FechaVencimiento", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@Vendedores", SqlDbType.VarChar, 1000, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Vendedores", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@Total", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Total", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@SaldoFactura", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoFactura", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdTiposComprobantesPredecesores", SqlDbType.VarChar, 4000, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTiposComprobantesPredecesores", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdOrdenReparaciones", SqlDbType.VarChar, 2000, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdOrdenReparaciones", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@SaldoCtaCte", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoCtaCte", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@SaldoCtaCteDV", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoCtaCteDV", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@SaldoCtaCteConsolidado", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoCtaCteConsolidado", 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("@OldIdCuenta", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdCuenta", DataRowVersion.Original, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@OldIdComprobante", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdComprobante", DataRowVersion.Original, null));

            SqlCommand sqlCommandDelete = new SqlCommand("Pr_tsa_FacturasImpagas_Delete", trx.Connection);

            sqlCommandDelete.Transaction = trx;
            sqlCommandDelete.CommandType = CommandType.StoredProcedure;
            sqlCommandDelete.Parameters.Add(new SqlParameter("@IdCuenta", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdCuenta", DataRowVersion.Original, null));
            sqlCommandDelete.Parameters.Add(new SqlParameter("@IdComprobante", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdComprobante", 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_tsa_FacturasImpagas_Insert", trx.Connection);

            sqlCommandInsert.Transaction = trx;
            sqlCommandInsert.CommandType = CommandType.StoredProcedure;
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdCuenta", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdCuenta", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@Cuenta", SqlDbType.VarChar, 500, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Cuenta", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdComprobante", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdComprobante", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@Numero", SqlDbType.VarChar, 50, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Numero", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdTipoDeComprobante", SqlDbType.VarChar, 20, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTipoDeComprobante", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@TipoDeComprobante", SqlDbType.VarChar, 256, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "TipoDeComprobante", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@FechaEmision", SqlDbType.DateTime, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FechaEmision", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@FechaVencimiento", SqlDbType.DateTime, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "FechaVencimiento", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@Vendedores", SqlDbType.VarChar, 1000, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Vendedores", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@Total", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Total", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@SaldoFactura", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoFactura", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdTiposComprobantesPredecesores", SqlDbType.VarChar, 4000, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTiposComprobantesPredecesores", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdOrdenReparaciones", SqlDbType.VarChar, 2000, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdOrdenReparaciones", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@SaldoCtaCte", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoCtaCte", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@SaldoCtaCteDV", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoCtaCteDV", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@SaldoCtaCteConsolidado", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "SaldoCtaCteConsolidado", 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));

            adapter.UpdateCommand = sqlCommandUpdate;
            adapter.DeleteCommand = sqlCommandDelete;
            adapter.InsertCommand = sqlCommandInsert;
            adapter.Update(dataTable);
        }