Exemple #1
0
        public static InvoiceSubtype GetVariantFromGeneratingSystem(string docType)
        {
            if (docType != null)
            {
                foreach (InvoiceSubtype invoiceVariant in Variants)
                {
                    if (docType.StartsWith(invoiceVariant.DocTypeAlt) ||
                        docType.StartsWith(invoiceVariant.DocTypeVorlageAlt) ||
                        docType.StartsWith(invoiceVariant.DocTypeNew))
                    {
                        InvoiceSubtype it = new InvoiceSubtype()
                        {
                            DocTypeAlt        = invoiceVariant.DocTypeAlt,
                            DocTypeNew        = invoiceVariant.DocTypeNew,
                            DocTypeVorlageAlt = invoiceVariant.DocTypeVorlageAlt,
                            FileName          = invoiceVariant.FileName,
                            FriendlyName      = invoiceVariant.FriendlyName,
                            VariantOption     = invoiceVariant.VariantOption
                        };

                        return(it);
                    }
                }
            }
            return(new InvoiceSubtype()
            {
                FriendlyName = "Invalid",
                VariantOption = InvoiceSubtypes.ValidationRuleSet.Invalid
            });
        }
Exemple #2
0
        public List <DocumentTypeModel> GetReferenceDocumentTypes(InvoiceSubtypes.ValidationRuleSet invcVariant)
        {
            var                      variants        = InvoiceSubtypes.GetSubtype(invcVariant);
            InvoiceSubtype           variant2Process = variants;
            IResourceService         xmlRes          = new ResourceService();
            var                      xDoc            = xmlRes.ReadXmlDocument(variant2Process.FileName);
            IEnumerable <XElement>   childs          = from xel in xDoc.Elements() select xel;
            List <DocumentTypeModel> documentType    = (from xElement in childs where !xElement.Element("english").Value.StartsWith("Cancel")
                                                        select new DocumentTypeModel()
            {
                CodeEnglish = xElement.Element("english").Value,
                TextGerman = xElement.Element("german").Value
            }).ToList <DocumentTypeModel>();

            _documentTypes = documentType;
            return(documentType);
        }
Exemple #3
0
        public static InvoiceSubtypes.ValidationRuleSet GetVariant(string friedlyName)
        {
            var res = from v in Variants where v.FriendlyName == friedlyName select v;

            if (!res.Any())
            {
                throw new ArgumentException("FriendlyName not found");
            }
            var            invoiceVariant = res.FirstOrDefault();
            InvoiceSubtype it             = new InvoiceSubtype()
            {
                DocTypeAlt        = invoiceVariant.DocTypeAlt,
                DocTypeNew        = invoiceVariant.DocTypeNew,
                DocTypeVorlageAlt = invoiceVariant.DocTypeVorlageAlt,
                FileName          = invoiceVariant.FileName,
                FriendlyName      = invoiceVariant.FriendlyName,
                VariantOption     = invoiceVariant.VariantOption
            };

            return(it.VariantOption);
        }
Exemple #4
0
        public static InvoiceSubtype GetSubtype(InvoiceSubtypes.ValidationRuleSet tgt)
        {
            InvoiceSubtype defaultSubtype = Variants[0];
            // if (tgt == ValidationRuleSet.Invalid) return defaultSubtype;
            var res = Variants.Find(v => v.VariantOption == tgt);

            if (res == null)
            {
                // throw new ArgumentException("Target not found");
                return(defaultSubtype);
            }
            var            invoiceVariant = res;
            InvoiceSubtype it             = new InvoiceSubtype()
            {
                DocTypeAlt        = invoiceVariant.DocTypeAlt,
                DocTypeNew        = invoiceVariant.DocTypeNew,
                DocTypeVorlageAlt = invoiceVariant.DocTypeVorlageAlt,
                FileName          = invoiceVariant.FileName,
                FriendlyName      = invoiceVariant.FriendlyName,
                VariantOption     = invoiceVariant.VariantOption
            };

            return(it);
        }