コード例 #1
0
ファイル: DataContracts.cs プロジェクト: Qdabra/QFS
 public FormInformation(FormLevelInfo formLevelInformation, List <Property> formProperties, List <DataConnection> dataConnections, List <ViewInfo> viewInfos, List <PromotedProperty> promotedProps, List <DllInfo> dllInfos, List <DetailingResult> detailingResults, List <QRulesInfo> qRulesInfos)
 {
     this.FormLevel          = formLevelInformation;
     this.FormProperties     = formProperties;
     this.DataConnections    = dataConnections;
     this.ViewInfos          = viewInfos;
     this.PromotedProperties = promotedProps;
     this.DllInfos           = dllInfos;
     this.DetailingResults   = detailingResults;
     this.QRulesInfos        = qRulesInfos;
 }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: Qdabra/QFS
        private static void AddFormLevelInformation(XsnWrapper xsnWrapper, FormInformation formInfo)
        {
            FormLevelInfo formLevel = new FormLevelInfo();

            //xml for the form info
            XmlSerializer serializer = new XmlSerializer(typeof(FormInformation));
            StringWriter  writer     = new StringWriter();

            serializer.Serialize(writer, formInfo);
            string xml = writer.ToString();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            XPathNavigator formInfoNavigator = doc.CreateNavigator();

            //xml for the form level requirements
            XmlDocument fldoc = new XmlDocument();

            using (var stream = GetEmbeddedResourceStream("FormLevels.xml"))
            {
                using (var sr = new StreamReader(stream))
                {
                    using (XmlReader transReader = XmlReader.Create(sr))
                    {
                        fldoc.Load(transReader);
                    }
                }
            }

            XPathNavigator flNavigator = fldoc.CreateNavigator();

            //get levels
            XPathNodeIterator levels = flNavigator.Select("FormLevels/FormLevel");

            //loop through levels - if any expression evaluates false for a level, move to the next level.
            foreach (XPathNavigator level in levels)
            {
                //loop through Requirements
                XPathNodeIterator requirements = level.Select("Requirements/Requirement[Expression != '']");
                foreach (XPathNavigator requirement in requirements)
                {
                    XPathExpression expression = formInfoNavigator.Compile(requirement.SelectSingleNode("Expression").Value);
                    bool            success    = (bool)formInfoNavigator.Evaluate(expression);
                    requirement.SelectSingleNode("Result").SetValue(success.ToString().ToLower());

                    if (success)
                    {
                        formLevel.Level = level.SelectSingleNode("@name").Value;
                    }
                }
            }

            //add qualifiers and recommendations for level
            XPathNodeIterator qualifiers = flNavigator.Select(string.Format("FormLevels/FormLevel[@name = '{0}']/Requirements/Requirement[Result = 'true' or @alwaysInclude = 'true']/Description", formLevel.Level));

            formLevel.Qualifiers = new List <Qualifier>();
            foreach (XPathNavigator qualifier in qualifiers)
            {
                formLevel.Qualifiers.Add(new Qualifier(qualifier.Value));
            }

            XPathNodeIterator recommendations = flNavigator.Select(string.Format("FormLevels/FormLevel[@name = '{0}']/Recommendations/Recommendation", formLevel.Level));

            formLevel.Recommendations = new List <Recommendation>();
            foreach (XPathNavigator recommendation in recommendations)
            {
                formLevel.Recommendations.Add(new Recommendation(recommendation.Value));
            }

            formInfo.FormLevel = formLevel;
        }