public static Models.IInvoiceModel MapToModel(object Invoice) { Models.IInvoiceModel invoiceModel = null; MappingErrors.Clear(); switch (((IInvoiceBase)Invoice).Version) { case Models.EbIVersion.V4P0: invoiceModel = V4p0.MapInvoice.MapV4P0ToVm((Schema.ebInterface4p0.InvoiceType)Invoice); break; case Models.EbIVersion.V4P1: invoiceModel = V4p1.MapInvoice.MapV4P1ToVm((Schema.ebInterface4p1.InvoiceType)Invoice); break; case Models.EbIVersion.V4P2: invoiceModel = V4p2.MapInvoice.MapV4P2ToVm((Schema.ebInterface4p2.InvoiceType)Invoice); break; case Models.EbIVersion.V4P3: invoiceModel = V4p3.MapInvoice.MapV4P3ToVm((Schema.ebInterface4p3.InvoiceType)Invoice); break; case Models.EbIVersion.V5P0: invoiceModel = V5p0.MapInvoice.MapV5p0ToVm((Schema.ebInterface5p0.InvoiceType)Invoice); break; default: break; } invoiceModel.Version = ((IInvoiceBase)Invoice).Version; return(invoiceModel); }
/// <summary> /// Validiert den Xml String gemäß ebInterface Standard und lädt das ebInterface Object aus derm Xml String /// </summary> /// <param name="fileName">Name of the file.</param> /// <returns> /// Ein neue <see cref="Models.InvoiceModel" /> Instanz /// </returns> public static Models.IInvoiceModel LoadTemplate(string fileName) { string text = File.ReadAllText(fileName); // string xmlInvoice = Models.InvoiceModel.RemoveVorlageText(text); var xmlClean = RemoveEmptyNodes(text); Check4ebInterface(xmlClean); Models.IInvoiceModel inv = LoadXmlVm(xmlClean); inv.InvoiceSubtype = InvoiceSubtypes.GetVariantFromGeneratingSystem(inv.GeneratingSystem); inv.Details.RecalcItemList(); return(inv); }
public static object MapToEbInterface(Models.IInvoiceModel invoiceModel, EbIVersion ebIVersion) { switch (ebIVersion) { case EbIVersion.V4P1: return(V4p1.MapInvoice.MapModelToV4p1(invoiceModel)); case EbIVersion.V4P2: return(V4p2.MapInvoice.MapModelToV4p2(invoiceModel)); case EbIVersion.V4P3: return(V4p3.MapInvoice.MapModelToV4p3(invoiceModel)); case EbIVersion.V5P0: return(V5p0.MapInvoice.MapModelToV5p0(invoiceModel)); default: return(null); } }