public static void UpdateWithValidation(tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); if (RowIsValid(row)) { Update(row); } }
public static void Update(tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow row) { if (row.RowState == DataRowState.Detached) { ((tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxDataTable)row.Table).Addtsa_ComprobanteValoresVarAuxRow(row); } Update(row.Table); }
/// <summary> /// Obtiene un registro de la tabla tsa_ComprobanteValoresVarAux que luego puede ser persistido en la base de datos. /// </summary> public static tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow GetByPk(string IdComprobante, string IdVarAuxComprobante) { tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow row = mz.erp.dataaccess.tsa_ComprobanteValoresVarAux.GetByPk(IdComprobante, IdVarAuxComprobante); if (row != null) { foreach (DataColumn dc in row.Table.Columns) { if (row[dc] == System.DBNull.Value) { row[dc] = Util.DefaultValue(dc.DataType); } } } return(row); }
//Esta sobrecarga recibe como parametro el IdComprobante del comprobante //que esta imputado o no con un comprobante de pago //Esta sobrecarga debe recuperar primero el comprobante de pago public static ComprobanteDePago GetComprobanteDePago(string IdComprobanteDeVenta, string IdCondicionDeVenta) { ComprobanteDePago cdp; CuentaCorriente ctacte = Factory.GetCuentaCorriente(); string IdComprobanteDePago = ""; tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow rowVarAux = mz.erp.businessrules.tsa_ComprobanteValoresVarAux.GetByPk(IdComprobanteDeVenta, "11"); if (rowVarAux != null) { IdComprobanteDePago = rowVarAux.Valor; } //mz.erp.businessrules.tsa_ComprobanteValoresVarAux.GetByPk(IdComprobanteDeVenta,"11").Valor; } //se chequea que exista un comprobante de pago asociado, puesto que puede que no se haya generado comprobante de pago //No se generan comprobantes de pagos si no se han ingresado valores if (IdComprobanteDePago != null && !IdComprobanteDePago.Equals(string.Empty)) { System.Data.DataRow rowComprobanteDePago = mz.erp.businessrules.tsa_Comprobantes.GetByPk(IdComprobanteDePago); System.Data.DataRow rowDetalleDeudaComprobanteDePago = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobanteDePago, 1); System.Data.DataSet dataDetalleDeudaComprobanteDeVenta = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetList(IdComprobanteDeVenta, null, null); if (ComprobantesRules.Comprobantes_CondicionDeVenta_Permite_Imputar(IdCondicionDeVenta)) { //DetalleCuentaCorriente dccComprobanteDePago = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDePago); //DetalleCuentaCorriente dccComprobanteDeVenta = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDeVenta); //ctacte.Detalle.Add(dccComprobanteDePago); //ctacte.Detalle.Add(dccComprobanteDeVenta); foreach (System.Data.DataRow rowDetalleDeudaComprobanteDeVenta in dataDetalleDeudaComprobanteDeVenta.Tables[0].Rows) { DetalleCuentaCorriente dccComprobanteDeVenta = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDeVenta); ctacte.Detalle.Add(dccComprobanteDeVenta); } decimal total = (decimal)rowComprobanteDePago["Total"]; decimal pago = total - (decimal)rowDetalleDeudaComprobanteDePago["Saldo"]; cdp = Factory.GetComprobanteDePago(IdComprobanteDePago, total, pago, ctacte, IdCondicionDeVenta); } else { //decimal total = (decimal) rowComprobanteDePago["Total"]; //decimal pago = total - (decimal) rowDetalleDeudaComprobanteDePago["Saldo"]; cdp = Factory.GetComprobanteDePago(IdComprobanteDePago, 0, 0, ctacte, IdCondicionDeVenta); cdp.Total = (decimal)rowComprobanteDePago["Total"]; cdp.Saldo = (decimal)rowDetalleDeudaComprobanteDePago["Saldo"]; cdp.TotalPago = cdp.Total - cdp.Saldo; } cdp.Anular = true; cdp.TipoComprobanteDestino = (string)rowComprobanteDePago["IdTipoDeComprobante"]; } else { cdp = Factory.GetComprobanteDePago(); } return(cdp); }
/// <summary> /// Establece los valores por defecto de tsa_ComprobanteValoresVarAuxRow. /// </summary> public static tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow SetRowDefaultValues(tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow row) { row.IdComprobante = Util.NewStringId(); row.IdVarAuxComprobante = Util.NewStringId(); row.Valor = 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.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdEmpresa; row.SetRowIdGeneradoNull(); return(row); }
/// <summary> /// Valida un tsa_ComprobanteValoresVarAuxRow. /// </summary> public static bool RowIsValid(tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow 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 (!IdVarAuxComprobanteIsValid(row.IdVarAuxComprobante, out mensaje)) { row.SetColumnError("IdVarAuxComprobante", mensaje); isValid = false; } if (!ValorIsValid(row.Valor, out mensaje)) { row.SetColumnError("Valor", 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; } if (!IdEmpresaIsValid(row.IdEmpresa, out mensaje)) { row.SetColumnError("IdEmpresa", mensaje); isValid = false; } if (!IdSucursalIsValid(row.IdSucursal, out mensaje)) { row.SetColumnError("IdSucursal", mensaje); isValid = false; } ; return(isValid); }
/// <summary> /// Envia los cambios del tsa_ComprobanteValoresVarAuxRow a la base de datos. /// </summary> public static void Update(tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); mz.erp.dataaccess.tsa_ComprobanteValoresVarAux.Update(row); }