Exemplo n.º 1
0
        //public static void Save(Models.InvoiceType invoice,string filname)
        //{
        //    ebInterface4p1.InvoiceType inv = MappingService.MapModelToV4p1(invoice);
        //    inv.Save(filname);
        //}

        public static IInvoiceModel LoadXmlVm(string xmlInvoice)
        {
            ebInterfaceVersion version = GetVersion(xmlInvoice);
            var inv = Deserialize(xmlInvoice, version.VersionType);

            return(inv);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the XML schemas.
        /// </summary>
        /// <returns></returns>
        internal static XmlSchemaSet GetXmlSchemas(XmlDocument xDoc)
        {
            var xSchema = new XmlSchemaSet();
            ebInterfaceVersion ebiVersion = InvoiceFactory.GetVersion(xDoc);
            Assembly           Asm        = Assembly.GetExecutingAssembly();
            List <EbISchema>   schemas    = null;

            switch (ebiVersion.Version)
            {
            case Models.EbIVersion.V4P1:
                schemas = ebInterface4p1.InvoiceType._schemaInfo;
                break;

            case Models.EbIVersion.V4P2:
                schemas = ebInterface4p2.InvoiceType._schemaInfo;
                break;

            case Models.EbIVersion.V4P3:
                schemas = ebInterface4p3.InvoiceType._schemaInfo;
                break;

            case Models.EbIVersion.V5P0:
                schemas = ebInterface5p0.InvoiceType._schemaInfo;
                break;

            default:
                throw new NotSupportedException("ebInterface Version nicht unterstützt.");
            }

            foreach (var schema in schemas)
            {
                string res = SchemaPath + schema.CacheName;
                using (var stream = Asm.GetManifestResourceStream(res))
                {
                    if (schema.UseInSchema)
                    {
                        XmlReader rdr = XmlReader.Create(stream);
                        xSchema.Add(schema.Url, rdr);
                    }
                }
            }

            return(xSchema);
        }