public RelacionesComprobanteDeCompraOrigenDestino(ArrayList IdComprobantes) { string IdTipoDeComprobanteGral = String.Empty; ArrayList lista = new ArrayList(IdComprobantes); for (int i = 0; i < lista.Count; i++) { string IdComprobante = lista[i].ToString(); tpu_ComprobantesDataset.tpu_ComprobantesRow CompOrigen = tpu_Comprobantes.GetByPk(IdComprobante); //Datos comunes a todos los items de un mismo comprobante string IdTipoDeComprobante = CompOrigen.IdTipoDeComprobante; string Numero = CompOrigen.Numero; long OrdinalOrigen = -1; decimal CantidadOrigen = 0; string IdProducto = String.Empty; string Descripcion = String.Empty; long IdSucursal = Security.IdSucursal; long IdEmpresa = Security.IdEmpresa; DateTime Fecha = CompOrigen.Fecha; Decimal PrecioDeCosto = 0; this.IdProveedor = CompOrigen.IdProveedor; this.IdResponsable = CompOrigen.IdResponsable; if (IdTipoDeComprobanteGral == String.Empty) { IdTipoDeComprobanteGral = IdTipoDeComprobante; } //Si el tipo de Comprobante actual es distinto al tipo de comprobante del primer comprobante no hace nada (por ahora) if (IdTipoDeComprobante == IdTipoDeComprobanteGral) { //Para cada IdComprobante tengo que obtener los ítems //Datos del item del comprobante tpu_ComprobantesDetDataset Items = businessrules.tpu_ComprobantesDet.GetByPk(IdComprobante); foreach (tpu_ComprobantesDetDataset.tpu_ComprobantesDetRow row in Items.tpu_ComprobantesDet) { OrdinalOrigen = row.Ordinal; CantidadOrigen = row.Cantidad; //Por ahora estoy tomando en CantidadOrigen la cantidad original del item. Luego tengo que hacer aparecer lo que está en tsa_ComprobantesRelacionOrigenDestino IdProducto = row.IdProducto; Descripcion = tsh_Productos.GetByPk(row.IdProducto).Descripcion; PrecioDeCosto = row.PrecioDeCosto; IdSucursal = row.IdSucursal; IdEmpresa = row.IdEmpresa; RelacionComprobanteDeCompraOrigenDestino ItemOrigen = new RelacionComprobanteDeCompraOrigenDestino(IdComprobante, IdTipoDeComprobante, Numero, OrdinalOrigen, CantidadOrigen, IdProducto, Descripcion, PrecioDeCosto, IdSucursal, IdEmpresa); this.Add(ItemOrigen); } } } // // TODO: agregar aquí la lógica del constructor // }
public virtual void Add(RelacionComprobanteDeCompraOrigenDestino rcod) { List.Add(rcod); }