예제 #1
0
파일: DataContracts.cs 프로젝트: Qdabra/QFS
        public QdScanTemplate()
        {
            xmlns.Add("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2017-02-08T04:48:30");

            ResultInfo = new FormInformation();
            UserInfo   = new UserDetail();
        }
예제 #2
0
 public static FormInformation FormInformation(ClientContext context, Microsoft.SharePoint.Client.File file)
 {
     using (XsnWrapper xsnWrapper = new XsnWrapper(Utilities.DownloadXsn(context, file)))
     {
         FormInformation formInfo = Utilities.GenerateFormInformation(xsnWrapper);
         return(formInfo);
     }
 }
예제 #3
0
 public static FormInformation FormInformation(ClientContext context, string libraryUrl, string xsnUrl)
 {
     using (XsnWrapper xsnWrapper = new XsnWrapper(Utilities.DownloadXsn(context, libraryUrl, xsnUrl)))
     {
         FormInformation formInfo = Utilities.GenerateFormInformation(xsnWrapper);
         return(formInfo);
     }
 }
예제 #4
0
        public static FormInformation FormInformationFromFormFileRequest(FormFileRequest formFileRequest)
        {
            XsnWrapper      xsnWrapper = new XsnWrapper(Utilities.SaveFormFileRequest(formFileRequest));
            FormInformation formInfo   = Utilities.GenerateFormInformation(xsnWrapper);

            xsnWrapper.Dispose();

            return(formInfo);
        }
예제 #5
0
        public static FormInformation FormInformation(Stream fileStream)
        {
            string templateFilename = Utilities.CopyXsnLocal(fileStream);

            using (XsnWrapper xsnWrapper = new XsnWrapper(templateFilename))
            {
                FormInformation formInfo = Utilities.GenerateFormInformation(xsnWrapper);
                return(formInfo);
            }
        }
예제 #6
0
        public static FormInformation FormInformation(HttpPostedFileBase file)
        {
            double formSize;

            using (XsnWrapper xsnWrapper = new XsnWrapper(Utilities.DownloadXsn(file, out formSize)))
            {
                FormInformation formInfo = Utilities.GenerateFormInformation(xsnWrapper, formSize);
                return(formInfo);
            }
        }
예제 #7
0
        public ActionResult FormInformation(string libraryUrl, string xsnUrl)
        {
            using (var clientContext = GetSharePointContext())
            {
                InfoPathServices.FormInformation info = null;

                info = InfoPathAnalytics.FormInformation(clientContext, libraryUrl, xsnUrl);
                SortFormInformation(info);
                return(new ObjectResult <FormInformation>(info));
            }
        }
예제 #8
0
파일: Utilities.cs 프로젝트: Qdabra/QFS
        public static FormInformation GenerateFormInformation(XsnWrapper xsnWrapper, double?formSize = null)
        {
            FormInformation formInfo = new FormInformation();

            formInfo.ViewInfos              = GetViewInfos(xsnWrapper);
            formInfo.DataConnections        = xsnWrapper.Manifest.GetAllDataConnectionInfo();
            formInfo.FormProperties         = xsnWrapper.GetAllXsnProperties(formSize);
            formInfo.PromotedProperties     = xsnWrapper.Manifest.GetAllPromotedProperties();
            formInfo.DllInfos               = GetDllInfos(xsnWrapper);
            formInfo.DetailingResults       = GetDetailingResults(xsnWrapper);
            formInfo.MigrationAnalysisInfos = GetFormAnalysisInfos(xsnWrapper);
            formInfo.MigrationAnalysisInfos = xsnWrapper.AddRepeatingStructureWithSiblingsInfo(formInfo.MigrationAnalysisInfos);
            //formInfo.MigrationAnalysisInfos = xsnWrapper.Manifest.GetDataConnectionInfo(formInfo.MigrationAnalysisInfos);
            formInfo.QRulesInfos = xsnWrapper.Manifest.GetAllQRules();

            //TODO: Allow turning off getting form Level info
            AddFormLevelInformation(xsnWrapper, formInfo);

            return(formInfo);
        }
예제 #9
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;
        }