Example #1
0
        public override Persistent GetNewInstance()
        {
            EmpresasBL empBL = new EmpresasBL();

            empBL.SetParameters(DBConnection);

            Comprobantes newComp = (Comprobantes)Activator.CreateInstance(PersistentType);

            newComp.Empresa   = empBL.GetObject(GeneralSettings.Instance.IdEmpresaDefault) as Empresas;
            newComp.Supertipo = tipo;
            return(newComp);
        }
Example #2
0
 public virtual Object GetObjectById(Object obj, String objName)
 {
     if (objName == "Empresas")
     {
         EmpresasBL empBL = new EmpresasBL();
         empBL.SetParameters(db);
         return(empBL.GetObject((int)obj));
     }
     else
     {
         return(null);
     }
 }
Example #3
0
        public XmlDocument GenerateLoginTicketRequestXML(LoginTicketRequests loginTicketRequest)
        {
            XmlQualifiedName qualifiedName = new XmlQualifiedName(LoginTicketRequestNodeName);
            //TODO: SACAR EL hardcode del XSD
            XMLGenerator  generator = new XMLGenerator("LoginTicketRequest.xsd", qualifiedName);
            Stream        xmlStream = new MemoryStream();
            XmlTextWriter writer    = new XmlTextWriter(xmlStream, Encoding.UTF8);

            writer.Formatting = Formatting.Indented;
            generator.WriteXml(writer);
            XmlDocument document = new XmlDocument();

            xmlStream.Seek(0, SeekOrigin.Begin);
            XmlReader reader = new XmlTextReader(xmlStream);

            document.Load(reader);
            reader.Close();
            writer.Close();
            xmlStream.Close(); xmlStream.Dispose();

            EmpresasBL empresasBL = new EmpresasBL();

            empresasBL.SetParameters(DBConnection);


            XmlElement headerNode = document[LoginTicketRequestNodeName][HeaderNodeName];

            headerNode[SourceNodeName].InnerText         = loginTicketRequest.Empresa.DNOrigen;
            headerNode[DestinationNodeName].InnerText    = loginTicketRequest.Empresa.DNDestino;
            headerNode[UniqueIDNodeName].InnerText       = loginTicketRequest.Id.ToString();
            headerNode[GenerationTimeNodeName].InnerText = XmlConvert.ToString(loginTicketRequest.GenerationTime, XmlDateTimeSerializationMode.RoundtripKind);
            headerNode[ExpirationTimeNodeName].InnerText = XmlConvert.ToString(loginTicketRequest.ExpirationTime, XmlDateTimeSerializationMode.RoundtripKind);
            document[LoginTicketRequestNodeName][ServiceNodeName].InnerText = GeneralSettings.Instance.WSNegocio;

            //writer = new XmlTextWriter("c:\\pepe.xml",Encoding.UTF8);
            //writer.Formatting = Formatting.Indented;
            //document.WriteTo(writer);
            //writer.Flush();
            //writer.Close();
            return(document);
        }
Example #4
0
 public override IList GetPropertyValueList(string propertyName, Settings persistent)
 {
     if (propertyName == "EmpresaDefault")
     {
         EmpresasBL empBL = new EmpresasBL();
         empBL.SetParameters(db);
         return(empBL.GetDataSource());
     }
     else if (propertyName == "FormatoComprobante")
     {
         IList result = new ArrayList();
         foreach (FormatoComprobante formatoComprobante in Enum.GetValues(typeof(FormatoComprobante)))
         {
             result.Add(formatoComprobante);
         }
         return(result);
     }
     else
     {
         return(DefaultProperyValueList(persistent.GetType().GetProperty(propertyName).PropertyType));
     }
 }