public void DataContextTest_EnsureSchemaValidation() { var nodeProvider = new NodeDataProvider(Path.Combine(Environment.CurrentDirectory, "umbraco.config"), true); MyUmbracoDataContext ctx = new MyUmbracoDataContext(nodeProvider); var hp = ctx.CWSHomes.First(); Assert.IsNotNull(hp); }
private XslPreprocessManager GetManager( NodeDataProvider dataProvider, GraphicsInfo graphicsInfo ) { XslPreprocessManager result = new XslPreprocessManager(this._model.DbFs); result.AvailablePreprocessors.Add(new GraphPreprocessor(dataProvider, graphicsInfo)); result.AvailablePreprocessors.Add(new GraphPreprocessorDialog(dataProvider, graphicsInfo)); result.AvailablePreprocessors.Add(new DataGridPreprocessorDialog(dataProvider, graphicsInfo)); result.AvailablePreprocessors.Add(new HtmlPreprocessorDialog(dataProvider, graphicsInfo, result)); // result.AvailablePreprocessors.Add(new RDLPreprocessorDialog(dataProvider, graphicsInfo)); return(result); }
public void DataContextTest_ConstructFromExistingProvider() { var nodeProvider = new NodeDataProvider(Path.Combine(Environment.CurrentDirectory, "umbraco.config")); MyUmbracoDataContext ctx = new MyUmbracoDataContext(nodeProvider); }
public void DataContextTest_FileMustExist() { var nodeProvider = new NodeDataProvider(@"C:\fakeFile.config"); }
public void DataContextTest_FileNameRequired() { var nodeProvider = new NodeDataProvider(string.Empty); }
public void onQueryResult(Task <NodeDataProvider> task) { if (this._EmailNotificationSettings == null) { log.ErrorFormat("job:'{0}'; EmailNotificationSettings node of UserSettings.xml is absent or empty", this._job); return; } NodeDataProvider dataProvider = task.Result; Size clientSize = this._EmailNotificationSettings.chartSettings.ClientSize; float floatOut = 0.0F; float dpiResolution = 92.0F; //default value if (!string.IsNullOrEmpty(this._EmailNotificationSettings.chartSettings.ImageResolution)) { if (float.TryParse(this._EmailNotificationSettings.chartSettings.ImageResolution, out floatOut)) { dpiResolution = floatOut; } } GraphicsInfo graphicsInfo = new GraphicsInfo(clientSize, dpiResolution); VisualizeData result = this._visualizeProcessor.GetVisualizeData( dataProvider, graphicsInfo ); this._message = new MailMessage(); if (result.PreprocessorAreas != null) { foreach (PreprocessorAreaData paData in result.PreprocessorAreas) { foreach (PreprocessorData pData in paData.Preprocessors) { IContentFactory factory = pData.ContentFactory; if (factory.CanCreateMailContent) { try { MailContent mailContent = factory.CreateMailContent(); this._messageHtml = mailContent.Message; if (mailContent.Resource != null) { this._linkedResources.Add(mailContent.Resource); } } catch (Exception ex) { log.ErrorFormat("job:'{0}';Exception:'{1}'", this._job, ex); return; } } } } } this.sendMessage(); }
public VisualizeData GetVisualizeData( NodeDataProvider dataProvider, GraphicsInfo graphicsInfo ) { XmlDocument xmlData = dataProvider.XmlDocument; MultyQueryResultInfo queriesResult = dataProvider.QueryResult; VisualizeData result = new VisualizeData { NodeLastUpdated = queriesResult.NodeLastUpdated, NodeLastUpdateDuration = queriesResult.NodeLastUpdateDuration }; if (xmlData != null && xmlData.DocumentElement != null) { result.SourceXml = xmlData.FormatXml(); } ConcreteTemplateNodeDefinition nodeDefinition = dataProvider.NodeDefinition; string xslFileName = GetXslFileName(nodeDefinition); if (xslFileName != null && File.Exists(xslFileName)) { XmlDocument xslDoc = new XmlDocument(); xslDoc.Load(xslFileName); ConnectionGroupInfo connectionGroup = nodeDefinition.Connection; if (AppVersionHelper.IsNotDebug() && !connectionGroup.IsExternal) { CryptoProcessor cryptoProcessor = new CryptoProcessor( this._model.Settings.SystemSettings.PublicKeyXmlSign, this._model.Settings.SystemSettings.PrivateKeyXmlDecrypt ); cryptoProcessor.DecryptXmlDocument(xslDoc); } try { XslPreprocessManager preprocessManager = GetManager( dataProvider, graphicsInfo ); List <PreprocessorAreaData> datas; using (preprocessManager.ExecuteXslPreprocessing(xslDoc, out datas)) { } foreach (PreprocessorAreaData preprocessorAreaData in datas) { preprocessorAreaData.CheckPreprocessors(); } result.PreprocessorAreas = datas.ToList(); } catch (Exception ex) { log.ErrorFormat( "nodeDefinition.TemplateNode.Queries(.Name)='{0}';xslFileName='{1}';Exception:'{2}'", nodeDefinition.TemplateNode.Queries.Select(q => q.QueryName).Join(", "), xslFileName, ex ); } } return(result); }