public static void UpdateWithValidation(tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); if (RowIsValid(row)) { Update(row); } }
public static void Update(tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row) { if (row.RowState == DataRowState.Detached) { ((tpu_ComprobantesDetDataset.tpu_ComprobantesDetDataTable)row.Table).Addtpu_ComprobantesDetRow(row); } Update(row.Table); }
/// <summary> /// Obtiene un registro de la tabla tpu_ComprobantesDet que luego puede ser persistido en la base de datos. /// </summary> public static tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow GetByPk(string IdComprobante, long Ordinal) { tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row = mz.erp.dataaccess.tpu_ComprobantesDet.GetByPk(IdComprobante, Ordinal); foreach (DataColumn dc in row.Table.Columns) { if (row[dc] == System.DBNull.Value) { row[dc] = Util.DefaultValue(dc.DataType); } } return(row); }
private void FlushItems(string IdTransaction) { if (_existeFactura) { //Caso1: los items ya existen, NO hay q modificarlos //Caso2: Faltan los items _dataComprobantesDet.Clear(); foreach (DataRow rowD in _dataConfirmacionDet.tpu_ComprobantesDeCompraDetConfirmacionDePrecios.Rows) { DataRow row = _dataDetComprobantePrevio.tpu_ComprobantesDet.FindByIdComprobanteOrdinal(_idComprobanteFactura, Convert.ToInt64(rowD["Ordinal"])); if (row != null) { tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow rowDet = _dataComprobantesDet.tpu_ComprobantesDet.Newtpu_ComprobantesDetRow(); rowDet.ItemArray = row.ItemArray; rowDet["IdComprobante"] = _idComprobanteFactura; rowDet["PrecioDeCostoMonedaOrigen"] = rowD["PrecioDeCostoOriginal"]; rowDet["PrecioDeCosto"] = Convert.ToDecimal(rowD["PrecioDeCostoOriginal"]) * _valorCotizacionFactura; _dataComprobantesDet.tpu_ComprobantesDet.Addtpu_ComprobantesDetRow(rowDet); } } mz.erp.dataaccess.tpu_ComprobantesDet.Update(_dataComprobantesDet.tpu_ComprobantesDet, IdTransaction, _replication); /* * foreach( FacturaDeCompraItem item in this._items) * { * tpu_ComprobantesDeCompraDetDataset.tpu_ComprobantesDeCompraDetRow row = _dataComprobantesDeCompraDet.tpu_ComprobantesDeCompraDet.Newtpu_ComprobantesDeCompraDetRow(); * row.IdComprobante = this._idComprobanteFactura; * row.Ordinal = item.Ordinal; * row.Cantidad = item.CantidadFactura; * row.Precio = item.PrecioDeCostoFactura; * row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; * row.IdConexionCreacion = Security.IdConexion; * row.IdConexionUltimaModificacion = Security.IdConexion; * row.IdReservado = 0; * row.IdSucursal = Security.IdSucursal; * row.IdEmpresa = Security.IdEmpresa; * _dataComprobantesDeCompraDet.tpu_ComprobantesDeCompraDet.Addtpu_ComprobantesDeCompraDetRow(row); * * } */ } }
/// <summary> /// Establece los valores por defecto de tpu_ComprobantesDetRow. /// </summary> public static tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow SetRowDefaultValues(tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row) { row.IdComprobante = Util.NewStringId(); row.Ordinal = 0; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.IdProducto = string.Empty; row.Cantidad = 0; row.PrecioDeCosto = 0; row.ImpuestosDirectos = 0; row.ImpuestosIndirectos = 0; row.IdMonedaOrigen = string.Empty; row.IdMonedaCierre = string.Empty; row.IdCotizacionCierre = string.Empty; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; //row.UltimaModificacion = null; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; row.SetRowIdGeneradoNull(); row.Bonificacion1MonedaOrigen = 0; row.Bonificacion2MonedaOrigen = 0; row.Bonificacion3MonedaOrigen = 0; row.Bonificacion4MonedaOrigen = 0; row.Bonificacion5MonedaOrigen = 0; row.PrecioDeCostoNetoMonedaOrigen = 0; row.PorcentajeBonificacion1 = 0; row.PorcentajeBonificacion2 = 0; row.PorcentajeBonificacion3 = 0; row.PorcentajeBonificacion4 = 0; row.PorcentajeBonificacion5 = 0; row.PrecioDeCostoMonedaOrigen = 0; row.Estado = string.Empty; return(row); }
/// <summary> /// Valida un tpu_ComprobantesDetRow. /// </summary> public static bool RowIsValid(tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); bool isValid = true; string mensaje; if (!IdComprobanteIsValid(row.IdComprobante, out mensaje)) { row.SetColumnError("IdComprobante", mensaje); isValid = false; } if (!OrdinalIsValid(row.Ordinal, out mensaje)) { row.SetColumnError("Ordinal", mensaje); isValid = false; } if (!IdEmpresaIsValid(row.IdEmpresa, out mensaje)) { row.SetColumnError("IdEmpresa", mensaje); isValid = false; } if (!IdSucursalIsValid(row.IdSucursal, out mensaje)) { row.SetColumnError("IdSucursal", mensaje); isValid = false; } if (!IdProductoIsValid(row.IdProducto, out mensaje)) { row.SetColumnError("IdProducto", mensaje); isValid = false; } if (!CantidadIsValid(row.Cantidad, out mensaje)) { row.SetColumnError("Cantidad", mensaje); isValid = false; } if (!PrecioDeCostoIsValid(row.PrecioDeCosto, out mensaje)) { row.SetColumnError("PrecioDeCosto", mensaje); isValid = false; } if (!ImpuestosDirectosIsValid(row.ImpuestosDirectos, out mensaje)) { row.SetColumnError("ImpuestosDirectos", mensaje); isValid = false; } if (!ImpuestosIndirectosIsValid(row.ImpuestosIndirectos, out mensaje)) { row.SetColumnError("ImpuestosIndirectos", mensaje); isValid = false; } if (!IdMonedaOrigenIsValid(row.IdMonedaOrigen, out mensaje)) { row.SetColumnError("IdMonedaOrigen", mensaje); isValid = false; } if (!IdMonedaCierreIsValid(row.IdMonedaCierre, out mensaje)) { row.SetColumnError("IdMonedaCierre", mensaje); isValid = false; } if (!IdCotizacionCierreIsValid(row.IdCotizacionCierre, out mensaje)) { row.SetColumnError("IdCotizacionCierre", mensaje); isValid = false; } if (!FechaCreacionIsValid(row.FechaCreacion, out mensaje)) { row.SetColumnError("FechaCreacion", mensaje); isValid = false; } if (!IdConexionCreacionIsValid(row.IdConexionCreacion, out mensaje)) { row.SetColumnError("IdConexionCreacion", mensaje); isValid = false; } if (!UltimaModificacionIsValid(row.UltimaModificacion, out mensaje)) { row.SetColumnError("UltimaModificacion", mensaje); isValid = false; } if (!IdConexionUltimaModificacionIsValid(row.IdConexionUltimaModificacion, out mensaje)) { row.SetColumnError("IdConexionUltimaModificacion", mensaje); isValid = false; } if (!IdReservadoIsValid(row.IdReservado, out mensaje)) { row.SetColumnError("IdReservado", mensaje); isValid = false; } if (!RowIdIsValid(row.RowId, out mensaje)) { row.SetColumnError("RowId", mensaje); isValid = false; } ; return(isValid); }
/// <summary> /// Envia los cambios del tpu_ComprobantesDetRow a la base de datos. /// </summary> public static void Update(tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); mz.erp.dataaccess.tpu_ComprobantesDet.Update(row); }