X-Git-Url: https://git.llucax.com/z.facultad/75.10/miklolife.git/blobdiff_plain/5dcdc142187069476c648c3ee2dbb1a00aaf202e..e14129b280a195d697c51e68946a684c80afda40:/demo/src/Reportes/ConsumoAfiliadosReport.cs diff --git a/demo/src/Reportes/ConsumoAfiliadosReport.cs b/demo/src/Reportes/ConsumoAfiliadosReport.cs index 83e278b..ddf781c 100644 --- a/demo/src/Reportes/ConsumoAfiliadosReport.cs +++ b/demo/src/Reportes/ConsumoAfiliadosReport.cs @@ -1,4 +1,10 @@ using System; +using System.Collections; +using System.Xml; +using Dominio.Autorizaciones; +using Dominio.Afiliados; +using com.db4o; + namespace Reportes { @@ -7,8 +13,79 @@ namespace Reportes /// public class ConsumoAfiliadosReport { + #region Constructores + public ConsumoAfiliadosReport() { + XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null); + xmlDoc.AppendChild(xmlDeclaration); + + XmlElement root = this.xmlDoc.CreateElement( "reporteConsumo" ); + root.SetAttribute( "fechaGeneracion", DateTime.Now.ToString( "yyyy-MM-dd" ) ); + + root.AppendChild( xmlDoc.CreateElement( "lineas" ) ); + + xmlDoc.AppendChild( root ); + } + + #endregion Constructores + + private XmlDocument xmlDoc = new XmlDocument(); + + #region Metodos Publicos + + public void AgregarInfo( Prestador p, LineaInfoPrestacionesReport lineaIp ) + { + + } + + #endregion Metodos Publicos + + + #region Metodos privados + + private Autorizacion getAutorizacion( int codigo ) + { + this.db = com.db4o.Db4o.openFile("os.yap"); + + ArrayList al = new ArrayList(); + + al = this.ObjectSetToArrayList( db.get( new AutorizacionManual(codigo) ) ); + Autorizacion a = ( (al.Count == 0)? null : al[0] ) as AutorizacionManual; + + if ( a == null ) + { + al = this.ObjectSetToArrayList( db.get( new AutorizacionAutomatica(codigo) ) ); + a = ( (al.Count == 0)? null : al[0] ) as AutorizacionAutomatica; + } + + this.db.close(); + this.db = null; + + return a; } + + #endregion Metodos privados + + #region DB + private com.db4o.ObjectContainer db = null; + + private ArrayList ObjectSetToArrayList (ObjectSet result) + { + ArrayList lst = new ArrayList (); + Object s; + if (result == null) + return lst; + + while ((s = result.next ()) != null) + { + lst.Add (s); + } + return lst; + } + + #endregion DB + + } }