Libreria

Clase

Metodo

AhoraDoc

DocRutinas

CreaCopiaDoc


Implementación:


 Public Function CreaCopiaDoc(
 lDoc As Doc,
 TipoObjeto As String,
 IdDoc As Long,
 Optional ObjPadre As Object = Nothing)
 As Long 


Descripción:


Copia documentos desde  el espacio documental de un objeto hacia el de otro objeto.


Código VB6:

 Public Sub CopiaDocumentosCabecera (aOferta As Oferta)
   Dim lDoc As Object 'Doc
   Dim lRdo As IRecordset
   Dim lSQL As String
  
   lSQL = "Select * FROM VDocumentos  WHERE (IdDocObjeto =" &
          aOferta.Propiedades("IdDoc") & " AND Tabla='" &
          SqlString(TypeName(aOferta), False) & "')"
   Set lRdo = gCn.OpenResultset(lSQL)
   While Not lRdo.EOF
     Set lDoc = gObj.DameObjeto("Docs", "Where Id=" & lRdo!Id.Value)
     If Not lDoc Is Nothing Then
       gCn.AhoraProceso "CreaCopiaDoc", False,lDoc,CStr(TypeName(aOferta)),
            CLng(Propiedades("IdDoc")),aOferta
     End If
     Set lDoc = Nothing
     lRdo.MoveNext
   Wend
   lRdo.Cerrar
  
 End Sub 


Código C#:

private void CopiaDocumentosCabecera(IOferta aOferta)
{
    string lSQL = "Select * FROM VDocumentos WHERE(IdDocObjeto = " + aOferta["IdDoc"] + " AND Tabla='" + AhoraUtil.CUtil.SqlString(aOferta.Tabla, false) + "')";
    IRecordSet lRdo = gCn.OpenResultSet(lSQL);
    while (!lRdo.EOF) 
    {
        IDoc lDoc = (IDoc)gCn.Obj.DameObjeto("Docs", "WHERE Id = " + lRdo["Id"].Value);
        if (lDoc != null) 
        {
            gCn.AhoraProceso("CreaCopiaDoc", out _, lDoc, aOferta.GetType().ToString(), (int)lRdo.Campos["IdDoc"].Value, aOferta);
        }
        lDoc = null;
        lRdo.MoveNext();
    }
    lRdo.Cerrar();
}