public static void Update(tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row, SqlTransaction trx, SentenciasReplicacion replicacion)
        {
            if (row.RowState == DataRowState.Detached)
            {
                ((tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataTable)row.Table).Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row);
            }

            Update(row.Table);
        }
        public static void UpdateWithValidation(tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            if (RowIsValid(row))
            {
                Update(row);
            }
        }
        public static void Update(tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row)
        {
            if (row.RowState == DataRowState.Detached)
            {
                ((tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataTable)row.Table).Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row);
            }

            Update(row.Table);
        }
        public void Commit()
        {
            if (this._state.ToUpper().Equals("NEW"))
            {
                _dataTDCompTesoreriaCondVentas            = new tfi_TDCompTesoreria_CondicionesDeVentaDataset();
                _dataCuentasTDCompTesoreriaCondVentas     = new tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset();
                _dataTiposDeCompTDCompTesoreriaCondVentas = new Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset();
                foreach (CondicionDeVentaView cdv in this._listaCondicionesDeVentasSeleccionadas)
                {
                    tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow row_TDCT_CV = this._dataTDCompTesoreriaCondVentas.tfi_TDCompTesoreria_CondicionesDeVenta.Newtfi_TDCompTesoreria_CondicionesDeVentaRow();
                    mz.erp.businessrules.tfi_TDCompTesoreria_CondicionesDeVenta.SetRowDefaultValues(row_TDCT_CV);
                    row_TDCT_CV.idCondicionDeVenta = cdv.IdCondicionDeVenta;
                    if (_metodoComparacionXE)
                    {
                        row_TDCT_CV.MetodoDeComparacion = "E";
                    }
                    else
                    if (_metodoComparacionXI)
                    {
                        row_TDCT_CV.MetodoDeComparacion = "I";
                    }
                    this._dataTDCompTesoreriaCondVentas.tfi_TDCompTesoreria_CondicionesDeVenta.Addtfi_TDCompTesoreria_CondicionesDeVentaRow(row_TDCT_CV);

                    foreach (TipoDeComprobante tcv in this.ListaTiposDeComprobantesSeleccionados)
                    {
                        Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow row_TC_CV_TDCT = this._dataTiposDeCompTDCompTesoreriaCondVentas.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.NewTsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow();
                        mz.erp.businessrules.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_TC_CV_TDCT);
                        row_TC_CV_TDCT.IdCondicionDeVenta  = cdv.IdCondicionDeVenta;
                        row_TC_CV_TDCT.IdTipoDeComprobante = tcv.IdTipoComprobante;
                        if (_metodoAsigTipoCompXE)
                        {
                            row_TC_CV_TDCT.MetodoDeAsignacion = "E";
                        }
                        else
                        if (_metodoAsigTipoCompXI)
                        {
                            row_TC_CV_TDCT.MetodoDeAsignacion = "I";
                        }
                        this._dataTiposDeCompTDCompTesoreriaCondVentas.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.AddTsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow(row_TC_CV_TDCT);
                    }
                    foreach (Cuenta c in this._listaCuentas)
                    {
                        tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT = this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Newtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow();
                        mz.erp.businessrules.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_C_CV_TDCT);
                        row_C_CV_TDCT.IdCondicionDeVenta = cdv.IdCondicionDeVenta;
                        row_C_CV_TDCT.IdCuenta           = c.IdCuenta;
                        if (_metodoAsigCuentaXE)
                        {
                            row_C_CV_TDCT.MetodoDeAsignacion = "E";
                        }
                        else
                        if (_metodoAsigCuentaXI)
                        {
                            row_C_CV_TDCT.MetodoDeAsignacion = "I";
                        }
                        this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row_C_CV_TDCT);
                    }
                }
                tfi_TDCompTesoreriasMonedasRecargosDataset.tfi_TDCompTesoreriasMonedasRecargosRow row_TDCT_M_R = this._dataTDCompTesoreriaMonedaRecargos.tfi_TDCompTesoreriasMonedasRecargos.Newtfi_TDCompTesoreriasMonedasRecargosRow();
                mz.erp.businessrules.tfi_TDCompTesoreriasMonedasRecargos.SetRowDefaultValues(row_TDCT_M_R);
                row_TDCT_M_R.Recargo  = this._recargo;
                row_TDCT_M_R.IdMoneda = Variables.GetValueString("Contabilidad.MonedaReferencia");
                this._dataTDCompTesoreriaMonedaRecargos.tfi_TDCompTesoreriasMonedasRecargos.Addtfi_TDCompTesoreriasMonedasRecargosRow(row_TDCT_M_R);
            }
            if (this._state.ToUpper().Equals("EDIT"))
            {
                tfi_TDCompTesoreriasMonedasRecargosDataset.tfi_TDCompTesoreriasMonedasRecargosRow row_TDCT_M_R;
                if (_dataTDCompTesoreriaMonedaRecargos.tfi_TDCompTesoreriasMonedasRecargos.Rows.Count > 0)
                {
                    row_TDCT_M_R         = (tfi_TDCompTesoreriasMonedasRecargosDataset.tfi_TDCompTesoreriasMonedasRecargosRow)_dataTDCompTesoreriaMonedaRecargos.tfi_TDCompTesoreriasMonedasRecargos.Rows[0];
                    row_TDCT_M_R.Recargo = this._recargo;
                }
                else
                {
                    row_TDCT_M_R = this._dataTDCompTesoreriaMonedaRecargos.tfi_TDCompTesoreriasMonedasRecargos.Newtfi_TDCompTesoreriasMonedasRecargosRow();
                    mz.erp.businessrules.tfi_TDCompTesoreriasMonedasRecargos.SetRowDefaultValues(row_TDCT_M_R);
                    row_TDCT_M_R.Recargo  = this._recargo;
                    row_TDCT_M_R.IdMoneda = Variables.GetValueString("Contabilidad.MonedaReferencia");
                    this._dataTDCompTesoreriaMonedaRecargos.tfi_TDCompTesoreriasMonedasRecargos.Addtfi_TDCompTesoreriasMonedasRecargosRow(row_TDCT_M_R);
                }
            }
        }
        /// <summary>
        /// Valida un tsa_CuentasCondicionesDeVentaRow.
        /// </summary>
        public static bool RowIsValid(tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);
            bool   isValid = true;
            string mensaje;


            if (!IdCuentaIsValid(row.IdCuenta, out mensaje))
            {
                row.SetColumnError("IdCuenta", mensaje);
                isValid = false;
            }

            if (!IdTDCompTesoreriaIsValid(row.idTDCompTesoreria, out mensaje))
            {
                row.SetColumnError("idTDCompTesoreria", mensaje);
                isValid = false;
            }


            if (!IdCondicionDeVentaIsValid(row.IdCondicionDeVenta, out mensaje))
            {
                row.SetColumnError("IdCondicionDeVenta", 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 (!IdSucursalIsValid(row.IdSucursal, out mensaje))
            {
                row.SetColumnError("IdSucursal", mensaje);
                isValid = false;
            }

            if (!IdEmpresaIsValid(row.IdEmpresa, out mensaje))
            {
                row.SetColumnError("IdEmpresa", mensaje);
                isValid = false;
            }

            if (!MetodoDeAsignacionIsValid(row.MetodoDeAsignacion, out mensaje))
            {
                row.SetColumnError("MetodoDeAsignacion", mensaje);
                isValid = false;
            }

            ;

            return(isValid);
        }
        public static void Update(tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row)
        {
            ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Update(row);
        }
        /// <summary>
        /// Obtiene un registro de la tabla tsa_CuentasCondicionesDeVenta que luego puede ser persistido en la base de datos. Metodo Sobrecargado
        /// </summary>

/*		[ atMethodGetByPkRow ]
 *              public static tsa_CuentasCondicionesDeVentaDataset.tsa_CuentasCondicionesDeVentaRow GetByPk( object IdCuenta, IdCondicionDeVenta )
 *              {
 *                      return GetByPk( ( string )IdCuenta, ( string )IdCondicionDeVenta );
 *              }*/

        /// <summary>
        /// Establece los valores por defecto de tsa_CuentasCondicionesDeVentaRow.
        /// </summary>
        public static tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow SetRowDefaultValues(tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row)
        {
            row.IdCuenta           = Util.NewStringId();
            row.idTDCompTesoreria  = Util.NewStringId();
            row.IdCondicionDeVenta = Util.NewStringId();
            row.IdCuentaCondicionDeVentaTDCompTesoreria = Util.NewStringId();
            row.Valor              = 0;
            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.IdSucursal  = Security.IdSucursal;
            row.IdEmpresa   = Security.IdEmpresa;

            return(row);
        }
        /// <summary>
        /// Obtiene un registro de la tabla tsa_CuentasCondicionesDeVenta que luego puede ser persistido en la base de datos.
        /// </summary>
        public static tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow GetByPk(string IdCuenta, string IdCondicionDeVenta, string IdTDCompTesoreria)
        {
            tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row = mz.erp.dataaccess.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.GetByPk(IdCuenta, IdCondicionDeVenta, IdTDCompTesoreria);
            if (row == null)
            {
                return(null);
            }

            foreach (DataColumn dc in row.Table.Columns)
            {
                if (row[dc] == System.DBNull.Value)
                {
                    row[dc] = Util.DefaultValue(dc.DataType);
                }
            }
            return(row);
        }
Example #9
0
        private void ModificarCuenta(string IdCondicionDeVenta)
        {
            foreach (Cuenta c in this._listaCuentasABorrar)
            {
                //Borrar de tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow

                DataSet data = mz.erp.dataaccess.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.GetList(c.IdCuenta, IdCondicionDeVenta, null);

                foreach (DataRow rowCuenta in data.Tables["tsa_CuentasCondicionesDeVenta_TDCompTesoreria"].Rows)
                {
                    rowCuenta.Delete();
                }
                _dataCuentasTDCompTesoreriaCondVentas.Merge(data);
            }

            foreach (Cuenta c in this._listaCuentas)
            {
                if (c.Agregado && !c.SourceBD)
                {
                    //insertar en tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow

                    if (this.ListaFormasDePagoSeleccionadas.Count == 0)
                    {
                        tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT = this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Newtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow();
                        mz.erp.businessrules.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_C_CV_TDCT);
                        row_C_CV_TDCT.IdCuenta           = c.IdCuenta;
                        row_C_CV_TDCT.MetodoDeAsignacion = this.MetodoDeAsignacionCuenta;
                        row_C_CV_TDCT.idTDCompTesoreria  = null;
                        _dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row_C_CV_TDCT);
                    }
                    else
                    {
                        foreach (FormaDePago fp in this.ListaFormasDePagoSeleccionadas)
                        {
                            tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT = this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Newtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow();
                            mz.erp.businessrules.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_C_CV_TDCT);
                            row_C_CV_TDCT.IdCuenta           = c.IdCuenta;
                            row_C_CV_TDCT.MetodoDeAsignacion = this.MetodoDeAsignacionCuenta;
                            row_C_CV_TDCT.idTDCompTesoreria  = fp.IdFormaDePago;
                            _dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row_C_CV_TDCT);
                        }
                    }
                }
                /* Silvina 20100601 - Tarea 767 */
                else
                {
                    DataSet data = mz.erp.dataaccess.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.GetList(c.IdCuenta, IdCondicionDeVenta, null);
                    foreach (DataRow row in data.Tables[0].Rows)
                    {
                        foreach (Cuenta cta in ListaCuentasSeleccionadasABorrar)
                        {
                            if (row["IdCuenta"].ToString().Equals(cta.IdCuenta))
                            {
                                row["MetodoDeAsignacion"] = this.MetodoDeAsignacionCuenta;
                                _dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.ImportRow(row);
                            }
                        }
                    }
                }
                /* Fin Silvina */
            }
        }
Example #10
0
 private void AgregarCuenta()
 {
     foreach (Cuenta c in this._listaCuentas)
     {
         if (this._idTDComp.Count == 0)
         {
             tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT = this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Newtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow();
             mz.erp.businessrules.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_C_CV_TDCT);
             row_C_CV_TDCT.IdCuenta           = c.IdCuenta;
             row_C_CV_TDCT.MetodoDeAsignacion = this.MetodoDeAsignacionCuenta;
             row_C_CV_TDCT.idTDCompTesoreria  = null;
             _dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row_C_CV_TDCT);
         }
         else
         {
             foreach (string id in this._idTDComp)
             {
                 tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT = this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Newtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow();
                 mz.erp.businessrules.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_C_CV_TDCT);
                 row_C_CV_TDCT.IdCuenta           = c.IdCuenta;
                 row_C_CV_TDCT.MetodoDeAsignacion = this.MetodoDeAsignacionCuenta;
                 row_C_CV_TDCT.idTDCompTesoreria  = id;
                 _dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row_C_CV_TDCT);
             }
         }
     }
 }
Example #11
0
        private void ModificarFormaDePago(string IdCondicionDeVenta)
        {
            if (this.ListaFormasDePagoSeleccionadas.Count == 0 && _diasDeVencimiento != 0)
            {
                bool _insertarNull = true;

                tfi_TDCompTesoreria_CondicionesDeVentaDataset dataAux = tfi_TDCompTesoreria_CondicionesDeVenta.GetList(null, null, IdCondicionDeVenta);
                foreach (tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow row in dataAux.tfi_TDCompTesoreria_CondicionesDeVenta.Rows)
                {
                    if (row.IsidTDCompTesoreriaNull())
                    {
                        _insertarNull = false;
                    }
                }
                if (_insertarNull)
                {
                    tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow rowTDCompTes_ConVta = _dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.Newtfi_TDCompTesoreria_CondicionesDeVentaRow();
                    mz.erp.businessrules.tfi_TDCompTesoreria_CondicionesDeVenta.SetRowDefaultValues(rowTDCompTes_ConVta);
                    rowTDCompTes_ConVta.idTDCompTesoreria   = null;
                    rowTDCompTes_ConVta.MetodoDeComparacion = this._metodoComparacion;
                    _dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.Addtfi_TDCompTesoreria_CondicionesDeVentaRow(rowTDCompTes_ConVta);
                }
            }

            bool agregue = false;

            foreach (FormaDePago fp in this.FormasDePago)
            {
                if (fp.Agregada)
                {
                    #region No vino de la BD

                    if (!fp.SourceBD)
                    {// Agregar Forma de Pago
                        tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow rowTDCompTes_ConVta = _dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.Newtfi_TDCompTesoreria_CondicionesDeVentaRow();
                        mz.erp.businessrules.tfi_TDCompTesoreria_CondicionesDeVenta.SetRowDefaultValues(rowTDCompTes_ConVta);
                        rowTDCompTes_ConVta.idTDCompTesoreria = fp.IdFormaDePago;
                        this._idTDComp.Add(fp.IdFormaDePago);
                        rowTDCompTes_ConVta.MetodoDeComparacion = this._metodoComparacion;
                        _dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.Addtfi_TDCompTesoreria_CondicionesDeVentaRow(rowTDCompTes_ConVta);

                        foreach (TipoDeComprobante tc in this.ListaTiposDeComprobantesSeleccionados)
                        {
                            if (tc.SourceBD)
                            {
                                Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow row_TC_CV_TDCT = this._dataTiposDeCompTDCompTesoreriaCondVentas.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.NewTsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow();
                                mz.erp.businessrules.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_TC_CV_TDCT);
                                row_TC_CV_TDCT.IdTipoDeComprobante = tc.IdTipoComprobante;
                                row_TC_CV_TDCT.MetodoDeAsignacion  = this.MetodoDeAsignacionTipoDeComprobante;
                                row_TC_CV_TDCT.IdTDCompTesoreria   = fp.IdFormaDePago;
                                _dataTiposDeCompTDCompTesoreriaCondVentas.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.AddTsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow(row_TC_CV_TDCT);
                            }
                        }

                        agregue = true;

                        foreach (Cuenta cta in this.ListaCuentas)
                        {
                            if (cta.SourceBD)
                            {
                                tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT = this._dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Newtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow();
                                mz.erp.businessrules.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.SetRowDefaultValues(row_C_CV_TDCT);
                                row_C_CV_TDCT.IdCuenta           = cta.IdCuenta;
                                row_C_CV_TDCT.MetodoDeAsignacion = this.MetodoDeAsignacionCuenta;
                                row_C_CV_TDCT.idTDCompTesoreria  = fp.IdFormaDePago;
                                _dataCuentasTDCompTesoreriaCondVentas.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Addtsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow(row_C_CV_TDCT);
                            }
                        }
                    }
                    #endregion
                    /* Silvina 20100601 - Tarea 767 */
                    else
                    {
                        tfi_TDCompTesoreria_CondicionesDeVentaDataset data = tfi_TDCompTesoreria_CondicionesDeVenta.GetList(null, fp.IdFormaDePago, _idCondicionDeVenta);
                        foreach (tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow row in data.tfi_TDCompTesoreria_CondicionesDeVenta.Rows)
                        {
                            foreach (FormaDePago fps in this.ListaFormasDePagoSeleccionadas)
                            {
                                // if (!row.IsIdTDCompTesoreriaNull() && fp.IdFormaDePago.Equals(row.IdTDCompTesoreria))
                                if (fps.SourceBD && fps.Agregada && fps.IdFormaDePago.Equals(row.idTDCompTesoreria))
                                {
                                    row.MetodoDeComparacion = this.MetodoComparacion;
                                    _dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.ImportRow(row);
                                }
                            }
                        }
                    }
                    /* Fin Silvina */
                }
                else
                {
                    #region vino de la BD
                    if (fp.SourceBD)
                    {                    /* Borrar Forma de Pago
                                          *     Tambien hay que borrarlo de Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria
                                          *     y de tsa_CuentasCondicionesDeVenta_TDCompTesoreria */
                        //Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset dataComprobantes = mz.erp.dataaccess.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.GetList(null,fp.IdTDComprobante,fp.IdFormaDePago,IdCondicionDeVenta);
                        Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset dataComprobantes = mz.erp.dataaccess.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.GetList(null, null, fp.IdFormaDePago, IdCondicionDeVenta);
                        foreach (Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow rowTDComp in dataComprobantes.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.Rows)
                        {
                            rowTDComp.Delete();
                        }

                        _dataTiposDeCompTDCompTesoreriaCondVentas.Merge(dataComprobantes);

                        DataSet data = mz.erp.dataaccess.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.GetList(null, IdCondicionDeVenta, fp.IdFormaDePago);

                        foreach (DataRow rowCuenta in data.Tables["tsa_CuentasCondicionesDeVenta_TDCompTesoreria"].Rows)
                        {
                            rowCuenta.Delete();
                        }
                        _dataCuentasTDCompTesoreriaCondVentas.Merge(data);

                        // Borra de tfi_TDCompTesoreria_CondicionesDeVenta
                        //_dataTDCompTesoreria_CondVenta = mz.erp.dataaccess.tfi_TDCompTesoreria_CondicionesDeVenta.GetList(null,fp.IdFormaDePago,IdCondicionDeVenta);
                        //_dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.Rows[0].Delete();


                        tfi_TDCompTesoreria_CondicionesDeVentaDataset dataTDComp = mz.erp.dataaccess.tfi_TDCompTesoreria_CondicionesDeVenta.GetList(null, fp.IdFormaDePago, IdCondicionDeVenta);
                        foreach (tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow rowTDComp in dataTDComp.tfi_TDCompTesoreria_CondicionesDeVenta.Rows)
                        {
                            rowTDComp.Delete();
                        }
                        _dataTDCompTesoreria_CondVenta.Merge(dataTDComp);
                    }
                    #endregion
                }
            }

            if (agregue)
            {
                tfi_TDCompTesoreria_CondicionesDeVentaDataset dataAux = tfi_TDCompTesoreria_CondicionesDeVenta.GetList(null, null, IdCondicionDeVenta);
                foreach (tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow row in dataAux.tfi_TDCompTesoreria_CondicionesDeVenta.Rows)
                {
                    if (row.IsidTDCompTesoreriaNull())
                    {
                        row.Delete();
                        _dataTDCompTesoreria_CondVenta.tfi_TDCompTesoreria_CondicionesDeVenta.ImportRow(row);
                    }
                }

                Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset dataComprobantes = mz.erp.dataaccess.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.GetList(null, null, null, IdCondicionDeVenta);
                foreach (Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow rowTDComp in dataComprobantes.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.Rows)
                {
                    if (rowTDComp.IsIdTDCompTesoreriaNull())
                    {
                        rowTDComp.Delete();
                        _dataTiposDeCompTDCompTesoreriaCondVentas.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.ImportRow(rowTDComp);
                    }
                }
            }
        }