示例#1
0
        public void WriteXml(XmlWriter writer)
        {
            foreach (ICodedEntry item in codedEntries)
            {
                ITemplateConstraint textTemplate = (ITemplateConstraint)item;

                string templateId   = textTemplate.getTemplateID();
                string templateText = textTemplate.getTemplateText();

                writer.WriteStartElement("entry");
                writer.WriteAttributeString("typeCode", "COMP");
                writer.WriteAttributeString("contextConductionInd", "true");
                its.TemplateLookAhead(templateId + "#" + templateText, writer);

                textTemplate.WriteXml(writer);

                writer.WriteEndElement();
            }

            foreach (ITextSection item in textSection)
            {
                ITemplateConstraint textTemplate = (ITemplateConstraint)item;

                string templateId   = textTemplate.getTemplateID();
                string templateText = textTemplate.getTemplateText();

                writer.WriteStartElement("component");
                writer.WriteAttributeString("typeCode", "COMP");
                writer.WriteAttributeString("contextConductionInd", "true");
                its.TemplateLookAhead(templateId + "#" + templateText, writer);

                textTemplate.WriteXml(writer);
                writer.WriteEndElement();
            }
        }
示例#2
0
 public static TemplateConstraintResult CreateAllowed(ITemplateConstraint constraint)
 {
     return(new TemplateConstraintResult(constraint)
     {
         EvaluationStatus = Status.Allowed
     });
 }
示例#3
0
        public static TemplateConstraintResult CreateRestricted(ITemplateConstraint constraint, string localizedErrorMessage, string?cta = null)
        {
            if (string.IsNullOrWhiteSpace(localizedErrorMessage))
            {
                throw new ArgumentException($"'{nameof(localizedErrorMessage)}' cannot be null or whitespace.", nameof(localizedErrorMessage));
            }

            return(new TemplateConstraintResult(constraint)
            {
                EvaluationStatus = Status.Restricted,
                LocalizedErrorMessage = localizedErrorMessage,
                CallToAction = cta
            });
        }
示例#4
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttributeString("typeCode", "COMP");
            writer.WriteAttributeString("contextConductionInd", "true");

            #region nonXML
            if (bodyIsNonXml)
            {
                bool fileExists = false;

                if (!File.Exists(this.nonXMLBodyFileName))
                {
                    fileExists = false;
                }
                else
                {
                    writer.WriteStartElement("nonXMLBody");
                    writer.WriteAttributeString("classCode", "DOCBODY");
                    writer.WriteAttributeString("moodCode", "EVN");

                    writer.WriteStartElement("text");
                    writer.WriteAttributeString("mediaType", this.mimeType);
                    writer.WriteAttributeString("representation", "B64");

                    writer.WriteValue(its.B64(this.nonXMLBodyFileName));

                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
            }
            #endregion

            #region structured
            if (bodyIsStructured)
            {
                writer.WriteStartElement("structuredBody");
                writer.WriteAttributeString("classCode", "DOCBODY");
                writer.WriteAttributeString("moodCode", "EVN");

                writer.WriteStartElement("component");
                writer.WriteAttributeString("typeCode", "COMP");
                writer.WriteAttributeString("contextConductionInd", "true");

                #region START - Classification Section
                writer.WriteStartElement("section");
                writer.WriteAttributeString("classCode", "DOCSECT");
                writer.WriteAttributeString("moodCode", "EVN");

                writer.WriteStartElement("id");
                writer.WriteAttributeString("root", Id.ToString().ToUpper());
                writer.WriteEndElement();
                #endregion

                if (codedEntries != null)
                {
                    foreach (ICodedEntry item in codedEntries)
                    {
                        ITemplateConstraint textTemplate = (ITemplateConstraint)item;

                        string templateId   = textTemplate.getTemplateID();
                        string templateText = textTemplate.getTemplateText();

                        writer.WriteStartElement("entry");
                        writer.WriteAttributeString("typeCode", "COMP");
                        writer.WriteAttributeString("contextConductionInd", "true");
                        its.TemplateLookAhead(templateId + "#" + templateText, writer);

                        textTemplate.WriteXml(writer);

                        writer.WriteEndElement();
                    }
                }

                if (textSection != null)
                {
                    foreach (ITextSection item in textSection)
                    {
                        ITemplateConstraint textTemplate = (ITemplateConstraint)item;

                        string templateId   = textTemplate.getTemplateID();
                        string templateText = textTemplate.getTemplateText();

                        writer.WriteStartElement("component");
                        writer.WriteAttributeString("typeCode", "COMP");
                        writer.WriteAttributeString("contextConductionInd", "true");
                        its.TemplateLookAhead(templateId + "#" + templateText, writer);

                        textTemplate.WriteXml(writer);
                        writer.WriteEndElement();
                    }
                }

                writer.WriteEndElement();  // section :: Classification Section
                writer.WriteEndElement();  // component
                writer.WriteEndElement();  // structuredBody
            }
            #endregion
        }
示例#5
0
 private TemplateConstraintResult(ITemplateConstraint constraint)
 {
     Constraint      = constraint;
     _constraintType = constraint.Type;
 }