Exemple #1
0
        private void ValidateAnhaenge(ns3BinaerAnhangTyp[] anhaenge)
        {
            string timestampExp       = @"\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}\d{0,4}";
            Regex  jahresAbschlussPdf = new Regex(string.Format("{0}{1}",
                                                                Attachment.AttachmentIdTypeToElbaString(Attachment.AttachmentIdTypes.Japdf), timestampExp));

            // PDF fehlt
            if (anhaenge.All(anhang => anhang.AnhangID != null && !jahresAbschlussPdf.Match(anhang.AnhangID).Success))
            {
                AddHinweisFromErrorCode(Enums.Fehlercode.F150);
            }

            IEnumerable <Attachment.AttachmentIdTypes> attachmentIdTypes = Enum.GetValues(typeof(Attachment.AttachmentIdTypes)).Cast <Attachment.AttachmentIdTypes>();
            List <Regex> regex = new List <Regex>();

            foreach (Attachment.AttachmentIdTypes attachmentIdType in attachmentIdTypes)
            {
                if (attachmentIdType != Attachment.AttachmentIdTypes.Ohne)
                {
                    regex.Add(new Regex(string.Format("{0}{1}",
                                                      Attachment.AttachmentIdTypeToElbaString(attachmentIdType), timestampExp)));
                }
            }

            foreach (ns3BinaerAnhangTyp anhang in anhaenge)
            {
                if (anhang.AnhangID == null || !regex.Any(r => r.Match(anhang.AnhangID).Success))
                {
                    AddHinweisFromErrorCode(Enums.Fehlercode.F149);
                }
            }
        }