public CodeGuardResultReader( MsSqlAuditorModel msSqlAuditor, StorageManager storageManager, ConcreteTemplateNodeDefinition concreteTemplateNode) : base(msSqlAuditor, storageManager, concreteTemplateNode) { }
public int?GetDataRowCount( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { return(this.CurrentStorage.GetRowCount(concreteTemplateNode.TemplateNode)); }
public string GetXslFileName(ConcreteTemplateNodeDefinition nodeDefinition) { string dbName = string.Empty; TemplateNodeInfo templateToDisplay = GetTemplateToDisplay(nodeDefinition, out dbName); if (string.IsNullOrEmpty(templateToDisplay.XslTemplateFileName)) { return(null); } if (!string.IsNullOrWhiteSpace(templateToDisplay.XslTemplateFileName)) { return(this._model.FilesProvider.GetXslLocalizedTemplateFileName( templateToDisplay.XslTemplateFileName, nodeDefinition.Connection.TemplateDir )); } TemplateNodeLocaleInfo localized = templateToDisplay.GetLocale( true, this._model.Settings.ReportLanguage ); return(this._model.FilesProvider.GetXslTemplateFileName( localized.TemplateFile, nodeDefinition.Connection.TemplateDir )); }
private TreeNode FindChildNode(TreeNodeCollection parentNodes, string templateId) { foreach (TreeNode currentNode in parentNodes) { ConcreteTemplateNodeDefinition nodeDefinition = currentNode.Tag as ConcreteTemplateNodeDefinition; if (nodeDefinition != null) { if (nodeDefinition.TemplateNode != null && nodeDefinition.TemplateNode.Id == templateId ) { return(currentNode); } if (currentNode.Nodes.Count > 0) { var node = FindChildNode(currentNode.Nodes, templateId); if (node != null) { return(node); } } } } return(null); }
public CodeGuardResultReader( MsSqlAuditorModel msSqlAuditor, StorageManager storageManager, ConcreteTemplateNodeDefinition concreteTemplateNode) : base(msSqlAuditor, storageManager, concreteTemplateNode) { }
private void DrawOverlayIcon(DrawTreeNodeEventArgs e) { if (ActiveScheduleOverlayImage == null) { return; } ConcreteTemplateNodeDefinition definition = e.Node.Tag as ConcreteTemplateNodeDefinition; if (definition != null && definition.NodeActivated) { TemplateNodeInfo nodeDef = definition.TemplateNode; // Draw overlay icon if the node has active jobs if (nodeDef != null && nodeDef.HasActiveJobs) { Image overlayImage = ActiveScheduleOverlayImage; int nodeHeight = e.Node.Bounds.Height; // Overlay image size and coordinates int imgSize = nodeHeight / 2; int imgLeft = e.Node.Bounds.Left - SPACE_IL - imgSize; int imgTop = e.Node.Bounds.Bottom - imgSize; // draw overlay icon e.Graphics.DrawImage( overlayImage, imgLeft, imgTop, imgSize, imgSize ); } } }
public int?GetDataRowCount(ConcreteTemplateNodeDefinition nodeDefinition, ConnectionGroupInfo connectionGroup) { return(this._model.GetVaultProcessor(connectionGroup) .GetDataRowCount( connectionGroup, nodeDefinition )); }
public MultyQueryResultInfo ReadCurrentResult( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { MultiQueryResultReader multiQueryResultReader = new MultiQueryResultReader(Model, this); return(multiQueryResultReader.Read(connectionGroup, concreteTemplateNode)); }
private TemplateNodeInfo GetTemplateToDisplay( ConcreteTemplateNodeDefinition nodeDefinition, out string dbName ) { dbName = nodeDefinition.Group.Id; return(nodeDefinition.TemplateNode); }
public QueryResultDataSource( MsSqlAuditorModel model, ConcreteTemplateNodeDefinition nodeDefinition ) { this._model = model; this._nodeDefinition = nodeDefinition; this._queriesResult = ReadQueriesResult(); }
public QueryResultDataSource( MsSqlAuditorModel model, ConcreteTemplateNodeDefinition nodeDefinition ) { this._model = model; this._nodeDefinition = nodeDefinition; this._queriesResult = ReadQueriesResult(); }
private frmUserSettingsNode() { this._model = null; this._node = null; this._nodeDefinition = null; this._template = null; this._userSettingsManager = null; InitializeComponent(); }
public MultyQueryResultInfo ReadCurrentResult( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { return this._storageManager.ReadCurrentResult( connectionGroup, concreteTemplateNode ); }
public MultyQueryResultInfo ReadCurrentResult( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { return(this._storageManager.ReadCurrentResult( connectionGroup, concreteTemplateNode )); }
private frmUserSettingsNode() { this._model = null; this._node = null; this._nodeDefinition = null; this._template = null; this._userSettingsManager = null; InitializeComponent(); }
public int? GetDataRowCount( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { int? result = this._storageManager.GetDataRowCount(connectionGroup, concreteTemplateNode) ?? this._storageManager.CurrentStorage.GetRowCount(concreteTemplateNode.TemplateNode); return result; }
public QueryParameters(ConcreteTemplateNodeDefinition nodeDefinition, ConcreteTemplateNodeDefinition savedNodeDefinition, Action updateAction) : this() { if (nodeDefinition == null) { throw new ArgumentNullException("nodeDefinition"); } this._ctNodeDefinition = nodeDefinition; this._savedNode = savedNodeDefinition; this._updateAction = updateAction; }
public QueryParameters(ConcreteTemplateNodeDefinition nodeDefinition, ConcreteTemplateNodeDefinition savedNodeDefinition, Action updateAction) : this() { if (nodeDefinition == null) { throw new ArgumentNullException("nodeDefinition"); } this._ctNodeDefinition = nodeDefinition; this._savedNode = savedNodeDefinition; this._updateAction = updateAction; }
public int?GetDataRowCount( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { int?result = this._storageManager.GetDataRowCount(connectionGroup, concreteTemplateNode) ?? this._storageManager.CurrentStorage.GetRowCount(concreteTemplateNode.TemplateNode); return(result); }
public NodeDataProvider( MsSqlAuditorModel model, ConcreteTemplateNodeDefinition nodeDefinition ) { this._nodeDefinition = nodeDefinition; this._dataSource = new QueryResultDataSource(model, nodeDefinition); IQueryResultXmlTransformer transformer = new QueryResultXmlTransformer(); XmlDocument = transformer.Transform(this._dataSource); }
private void SaveQueryParameters(ConcreteTemplateNodeDefinition savedNode, ConnectionGroupInfo connection) { if (savedNode == null) { return; } var templateNodeInfo = savedNode.TemplateNode; Program.Model.GetVaultProcessor(connection) .CurrentStorage.Save(templateNodeInfo); }
public TreeJob(ConcreteTemplateNodeDefinition node) { if (node.TemplateNode != null) { Title = node.TemplateNode.Parent == null ? node.TemplateNode.Title : node.TemplateNode.Parent.Title + "\\" + node.TemplateNode.Title; } this._syncObj = new object(); this._childJobs = new List<TreeJob>(); }
public TreeJob(ConcreteTemplateNodeDefinition node) { if (node.TemplateNode != null) { Title = node.TemplateNode.Parent == null ? node.TemplateNode.Title : node.TemplateNode.Parent.Title + "\\" + node.TemplateNode.Title; } this._syncObj = new object(); this._childJobs = new List <TreeJob>(); }
public MultyQueryResultInfo Read( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { var result = new MultyQueryResultInfo(); this.ReadFromMeta(connectionGroup, concreteTemplateNode, result); this.ReadFromCodeGuard(concreteTemplateNode, result); return result; }
public MultyQueryResultInfo Read( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { var result = new MultyQueryResultInfo(); this.ReadFromMeta(connectionGroup, concreteTemplateNode, result); this.ReadFromCodeGuard(concreteTemplateNode, result); return(result); }
public NodeDataProvider( MsSqlAuditorModel model, ConcreteTemplateNodeDefinition nodeDefinition ) { this._nodeDefinition = nodeDefinition; this._dataSource = new QueryResultDataSource(model, nodeDefinition); IQueryResultXmlTransformer transformer = new QueryResultXmlTransformer(); XmlDocument = transformer.Transform(this._dataSource); }
private void ReadFromCodeGuard( ConcreteTemplateNodeDefinition concreteTemplateNode, MultyQueryResultInfo result ) { NodeResultReader nodeResultReader = new CodeGuardResultReader( this._msSqlAuditor, this._storageManager, concreteTemplateNode ); nodeResultReader.ReadTo(result); }
private void ReadFromCodeGuard( ConcreteTemplateNodeDefinition concreteTemplateNode, MultyQueryResultInfo result ) { NodeResultReader nodeResultReader = new CodeGuardResultReader( this._msSqlAuditor, this._storageManager, concreteTemplateNode ); nodeResultReader.ReadTo(result); }
public QueryParameters() { this._availableEdit = false; this._availableRemove = false; this._selectedParametes = new List<ParameterInfoLocalizable>(); this._prameters = new BindingList<ParameterInfoLocalizable>(); this._selectedQuery = null; this._queries = new BindingList<QueryKey>(); this._ctNodeDefinition = null; this._savedNode = null; this._dicParameters = new Dictionary<QueryKey, IList<ParameterInfoLocalizable>>(); this._updateAction = null; }
public QueryParameters() { this._availableEdit = false; this._availableRemove = false; this._selectedParametes = new List <ParameterInfoLocalizable>(); this._prameters = new BindingList <ParameterInfoLocalizable>(); this._selectedQuery = null; this._queries = new BindingList <QueryKey>(); this._ctNodeDefinition = null; this._savedNode = null; this._dicParameters = new Dictionary <QueryKey, IList <ParameterInfoLocalizable> >(); this._updateAction = null; }
private string GetDbfsFolderName() { ConcreteTemplateNodeDefinition nodeDefinition = this._dataProvider.NodeDefinition; string dbfsFolderName = Path.GetDirectoryName( GetFileName( nodeDefinition.TemplateNode, nodeDefinition.Connection ) ); return(dbfsFolderName); }
private List <Tuple <TemplateNodeQueryInfo, Int64, DataTable> > GetResultTables( ConcreteTemplateNodeDefinition nodeDefinition, MultyQueryResultInfo queriesResult ) { List <Tuple <TemplateNodeQueryInfo, Int64, DataTable> > resultTables = new List <Tuple <TemplateNodeQueryInfo, Int64, DataTable> >(); try { GroupDefinition database = nodeDefinition.Group; if (database != null) { foreach (QueryDatabaseResult queryDatabaseResult in queriesResult.GetDatabaseResults()) { QueryDatabaseResultInfo dbResult = queryDatabaseResult.Result; if (dbResult == null || dbResult.DataTables == null) { continue; } if (database.Name == dbResult.Database) { Int64 recordSet = 1L; foreach (DataTable curTable in dbResult.DataTables) { resultTables.Add( new Tuple <TemplateNodeQueryInfo, Int64, DataTable>( queryDatabaseResult.TemplateNodeQuery, recordSet, curTable ) ); recordSet++; } } } } } catch (Exception ex) { log.Error("Error in 'Extracts data from queries and saves it to table for RDLC.'", ex); throw; } return(resultTables); }
public void AddEmailTask(ConcreteTemplateNodeDefinition definition, Job job) { Func <NodeDataProvider> getNodeDataProviderFunc = () => new NodeDataProvider(this._model, definition); Task <NodeDataProvider> queryReportTask = Task.Factory.StartNew(getNodeDataProviderFunc); EmailNotificationTask emlTask = new EmailNotificationTask( this._allEmailTask, job, this._model.VisualizeProcessor ); queryReportTask.ContinueWith(emlTask.onQueryResult); }
private void ReadFromMeta( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode, MultyQueryResultInfo result ) { NodeResultReader nodeResultReader = new MetaResultReader( this._msSqlAuditor, this._storageManager, connectionGroup, concreteTemplateNode ); nodeResultReader.ReadTo(result); }
private void ReadFromMeta( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode, MultyQueryResultInfo result ) { NodeResultReader nodeResultReader = new MetaResultReader( this._msSqlAuditor, this._storageManager, connectionGroup, concreteTemplateNode ); nodeResultReader.ReadTo(result); }
private void tmSchedulerTimer_Tick(object sender, EventArgs e) { foreach (ConnectionData connection in Connections) { List <Tuple <TemplateNodeInfo, Job> > nodeJobs = new List <Tuple <TemplateNodeInfo, Job> >(); connection.RootOfStaticTree.GetScheduledNodes(nodeJobs, true); foreach (Tuple <TemplateNodeInfo, Job> nodeJob in nodeJobs) { Job job = nodeJob.Item2; TemplateNodeInfo node = nodeJob.Item1; ConnectionData localConnection = connection; Action action = () => { TreeNode uiTreeNode = FindJobbedUiTreeNode(job) ?? CreateTreeViewNode(node); Action sendEmailAction = null; if (job.Settings.IsSendMessage) { sendEmailAction = () => { ConcreteTemplateNodeDefinition definition = new ConcreteTemplateNodeDefinition( node, localConnection.ConnectionGroup ); AddEmailTask(definition, job); }; } TaskManager.BeginRefreshTask( uiTreeNode, true, NodeUpdatingSource.ForcedFromServer, sendEmailAction ); }; this._jobProcessor.RunIfTime( job, action, connection.CreationDateTime ); } } }
private Dictionary <TemplateNodeQueryInfo, DataTable> ReadHistTable( ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) { Dictionary <TemplateNodeQueryInfo, DataTable> histTable = new Dictionary <TemplateNodeQueryInfo, DataTable>(); TemplateNodeInfo templateNodeInfo = concreteTemplateNode.TemplateNode; ProgressItem progress = new ProgressItem(); using (SqlProcessor sqlProcessor = MsSqlAuditor.GetNewSqlProcessor(new CancellationToken())) { progress.SetPromisedChildCount(1); MultyQueryResultInfo resultQuery = sqlProcessor.ExecuteMultyQuery( connectionGroup, templateNodeInfo.Queries, progress.GetChild(), Program.Model.Settings.SystemSettings.MaximumDBRequestsThreadCount, true ); if (resultQuery != null) { if (resultQuery.List != null) { if (resultQuery.List.Count != 0) { long requestId = this.Storage.MetaResultTable.GetMaxRequestId() + 1L; DateTime timestamp = DateTime.Now; histTable = PrepareHistoryData(resultQuery); this.Storage.SaveMeta( templateNodeInfo, resultQuery, requestId, timestamp ); } } } } return(histTable); }
public frmUserSettingSchedule(ConcreteTemplateNodeDefinition nodeDefinition) { if (nodeDefinition == null) { throw new ArgumentNullException("nodeDefinition"); } InitializeComponent(); string fmtStr = GetLocalizedText("captionText"); if (!string.IsNullOrEmpty(fmtStr)) { this.Text = String.Format(fmtStr, CurrentAssembly.Title); } this.NodeDefinition = nodeDefinition; }
public frmUserSettingSchedule(ConcreteTemplateNodeDefinition nodeDefinition) { if (nodeDefinition == null) { throw new ArgumentNullException("nodeDefinition"); } InitializeComponent(); string fmtStr = GetLocalizedText("captionText"); if (!string.IsNullOrEmpty(fmtStr)) { this.Text = String.Format(fmtStr, CurrentAssembly.Title); } this.NodeDefinition = nodeDefinition; }
private int?LoadNodeCounterValue(TreeNode treeNode) { if (treeNode == null) { return(null); } ConcreteTemplateNodeDefinition nodeDefinition = treeNode.Tag as ConcreteTemplateNodeDefinition; if (nodeDefinition == null) { return(null); } long handle = nodeDefinition.ComputeHandle(); lock (this._lockObj) { if (this._nodeCountMap.ContainsKey(handle)) { return(this._nodeCountMap[handle]); } } TemplateNodeInfo templateNode = nodeDefinition.TemplateNode; CurrentStorage storage = GetStorage(templateNode.ConnectionGroup); int? count = storage.GetTreeNodeCounterValue(templateNode); lock (this._lockObj) { if (this._nodeCountMap.ContainsKey(handle)) { this._nodeCountMap[handle] = count; } else { this._nodeCountMap.Add(handle, count); } } return(count); }
private void UpdateChildNodes(TreeNode parentNode, bool disable) { foreach (TreeNode childNode in parentNode.Nodes) { ConcreteTemplateNodeDefinition childNodeDef = childNode.Tag as ConcreteTemplateNodeDefinition; if (childNodeDef != null) { TemplateNodeInfo templateInfo = childNodeDef.TemplateNode; childNodeDef.NodeActivated = !disable; templateInfo.IsDisabled = disable; childNode.ForeColor = GetColor(templateInfo); UpdateChildNodes(childNode, disable); } } }
public frmUserSettingsNode(MsSqlAuditorModel model, TreeNode node) : this() { if (node == null) { throw new ArgumentNullException("node"); } this._node = node; this._nodeDefinition = node.Tag as ConcreteTemplateNodeDefinition; if (this._nodeDefinition == null) { throw new ArgumentException("Template is not specified for the node."); } this._model = model; this._template = GetUserSettings(); this._userSettingsManager = new UserSettingsManager( this._model.Settings.InterfaceLanguage ); }
public frmUserSettingsNode(MsSqlAuditorModel model, TreeNode node) : this() { if (node == null) { throw new ArgumentNullException("node"); } this._node = node; this._nodeDefinition = node.Tag as ConcreteTemplateNodeDefinition; if (this._nodeDefinition == null) { throw new ArgumentException("Template is not specified for the node."); } this._model = model; this._template = GetUserSettings(); this._userSettingsManager = new UserSettingsManager( this._model.Settings.InterfaceLanguage ); }
private void UpdateNodeTitle( TreeNode treeNode, int?nodeCount ) { ConcreteTemplateNodeDefinition nodeDefinition = treeNode.Tag as ConcreteTemplateNodeDefinition; string text = string.Empty; if (nodeDefinition != null) { if (nodeDefinition.TemplateNode != null) { nodeDefinition.TemplateNode.CounterValue = nodeCount; } Action updateNodeTextAction = () => { if (nodeDefinition.IsRoot) { TemplateNodeLocaleInfo liTreeTitle = nodeDefinition.TemplateNode.GetTemplateTreeTitleLocalized(); string templateName = nodeDefinition.TemplateNode.Title; string connectionName = nodeDefinition.Connection.Name; text = GetTreeTitle(liTreeTitle, templateName, connectionName); } else { text = nodeDefinition.FormatNodeText(nodeCount); } if (!text.Equals(treeNode.Text)) { treeNode.Text = text; } }; this._treeControl.SafeInvoke(updateNodeTextAction); } }
protected NodeResultReader( MsSqlAuditorModel msSqlAuditor, StorageManager storageManager, ConcreteTemplateNodeDefinition concreteTemplateNode ) : this() { this._msSqlAuditor = msSqlAuditor; this._storageManager = storageManager; if (concreteTemplateNode != null) { this.GroupDefinition = concreteTemplateNode.Group; this.TemplateNode = concreteTemplateNode.TemplateNode; if (msSqlAuditor != null && msSqlAuditor.TemplateSettings != null && concreteTemplateNode.Connection != null) { this.Settings = msSqlAuditor.TemplateSettings.UserSettings.FirstOrDefault( i => i.TemplateName == concreteTemplateNode.Connection.TemplateFileName && i.Connection.ParentKey == TemplateNode.IdsHierarchy ); } } }
public MetaResultReader( MsSqlAuditorModel msSqlAuditor, StorageManager storageManager, ConnectionGroupInfo connectionGroup, ConcreteTemplateNodeDefinition concreteTemplateNode ) : base( msSqlAuditor, storageManager, concreteTemplateNode ) { this._instances = new List<InstanceInfo>(); if (base.GroupDefinition.Instance != null) { this._instances.Add(base.GroupDefinition.Instance); } else { this._instances.AddRange(connectionGroup.Connections.Where(info => info.IsEnabled)); } this._histTable = ReadHistTable(connectionGroup, concreteTemplateNode); }
private void RefreshQueries( TreeTask treeTask, ConcreteTemplateNodeDefinition nodeDefinition, ProgressItem progress ) { log.DebugFormat("taskInfo.Connection:'{0}';nodeDefinition:'{1}'", treeTask.Info.Connection.ConnectionGroup.ToString() ?? "?", nodeDefinition.TemplateNode.Name ?? "?" ); ErrorLog errorLog = new ErrorLog(); MsSqlAuditorModel model = this._treeControl._model; DateTime startTime = DateTime.Now; Stopwatch durationWatch = new Stopwatch(); durationWatch.Start(); using (SqlProcessor sqlProcessor = model.GetNewSqlProcessor(treeTask.CancellationSource.Token)) { if (!treeTask.Info.Connection.IsLiveConnection) { sqlProcessor.SetSkipMSSQLQueries(); } progress.SetPromisedChildCount(1); TemplateNodeInfo templateNode = nodeDefinition.TemplateNode; ConnectionGroupInfo group = nodeDefinition.Connection; MultyQueryResultInfo result; if (nodeDefinition.Group.Instance != null) { result = sqlProcessor.ExecuteMultyQuery( nodeDefinition.Group, templateNode.Queries, progress.GetChild() ); } else { result = sqlProcessor.ExecuteMultyQuery( group, templateNode.Queries, progress.GetChild(), model.Settings.SystemSettings.MaximumDBRequestsThreadCount ); } if (group != null && group.Connections != null) { group.Connections.ForEach( x => x.ConnectionGroup = x.ConnectionGroup ?? group ); } errorLog.AppendErrorLog(result); IStorageManager storage = model.GetVaultProcessor(group); storage.SaveRequestedData(templateNode, result); durationWatch.Stop(); DateTime duration = new DateTime(durationWatch.Elapsed.Ticks); storage.CurrentStorage.UpdateTreeNodeTimings( templateNode, startTime, duration ); foreach (GroupDefinition database in result.ExtractDatabases()) { ConcreteTemplateNodeDefinition nodeDef = new ConcreteTemplateNodeDefinition( templateNode, database, group ); this._treeControl.VisualizeData(nodeDef); } } }
private static string GetIcon(ConcreteTemplateNodeDefinition node) { if (!string.IsNullOrWhiteSpace(node.TemplateNode.UIcon)) { return node.TemplateNode.UIcon; } return node.TemplateNode.IconImageReferenceName; }
public TreeNode CreateTreeViewNode(TemplateNodeInfo node, out ConcreteTemplateNodeDefinition nodeDef) { Debug.Assert(node.IsInstance); ConnectionData connection = node.Connection; nodeDef = new ConcreteTemplateNodeDefinition(node, connection.ConnectionGroup); UserSettingsManager settingsManager = new UserSettingsManager( Program.Model.Settings.InterfaceLanguage ); UserSettingsRow nodeSettings = settingsManager.LoadUserSettings( node.TemplateNodeId.GetValueOrDefault() ); if (nodeSettings != null) { if (!string.IsNullOrEmpty(nodeSettings.NodeUIName)) { node.Title = nodeSettings.NodeUIName; } node.UIcon = nodeSettings.NodeUIIcon; node.FontColor = nodeSettings.NodeFontColor; node.IsDisabled = !nodeSettings.NodeEnabled; } string iconName = GetIcon(nodeDef); TreeNode treeNode = new TreeNode { Tag = nodeDef, Text = nodeDef.FormatNodeText(), ImageKey = iconName, SelectedImageKey = iconName, }; if (node.FontColor != null) { Color color = Colors.FromString(node.FontColor); treeNode.ForeColor = color; } if (node.FontStyle != null) { treeNode.NodeFont = new Font(treeTemplate.Font, ParseFontStyle(node.FontStyle)); } if (node.Template.Childs.Any()) { if (treeNode.Nodes.Count == 0) { // to make it expandable treeNode.Nodes.Add( new TreeNode { Tag = _MakeExpandableNodeTag } ); } } nodeDef.NodeActivated = !node.IsDisabled; SetNodeOnLoading(treeNode); return treeNode; }
private void InitializeTabs(ConcreteTemplateNodeDefinition definition) { int currentTabIndex = 0; tcBrowse.Visible = definition != null; txtXml.Clear(); bool showXmlTab = Program.Model.Settings.ShowXML; bool isXmlTabVisible = tcBrowse.TabPages.Contains(tpXml); if (showXmlTab) { if (!isXmlTabVisible) { tcBrowse.TabPages.Insert(0, tpXml); } currentTabIndex = 1; } else { if (isXmlTabVisible) { tcBrowse.TabPages.Remove(tpXml); } } lock (tcBrowse) { // Dispose all tabs (except XML tab) for (int i = tcBrowse.TabPages.Count - 1; i >= currentTabIndex; i--) { TabPage tabPage = tcBrowse.TabPages[i]; tcBrowse.TabPages.Remove(tabPage); } } }
private void SaveQueryParameters(ConcreteTemplateNodeDefinition savedNode, ConnectionGroupInfo connection) { if (savedNode == null) { return; } var templateNodeInfo = savedNode.TemplateNode; Program.Model.GetVaultProcessor(connection) .CurrentStorage.Save(templateNodeInfo); }
private void RenderVisualizeData(ConcreteTemplateNodeDefinition definition, VisualizeData visualizeData, int selectTabIndex) { string additionalXml = string.Empty; int tabIndex = tcBrowse.TabCount - 1; TemplateNodeInfo nodeInfo = definition.TemplateNode; tcBrowse.ShowSingleTab = !nodeInfo.IsHideTabs; if (visualizeData.PreprocessorAreas != null) { List<PreprocessorDataDescriptor> dialogObjects = visualizeData.PreprocessorAreas.SelectMany( a => a.NoSplitter || a.Preprocessors.Count == 0 || (a.Columns.Length == 1 && a.Rows.Length == 1) ? a.Preprocessors.SelectMany( data => new[] { new PreprocessorDataDescriptor(a, data) } ) : new[] { new PreprocessorDataDescriptor(a) } ).ToList(); // create tab pages with empty content first // to avoid flickering and extra reports loading List<TabPage> newPages = new List<TabPage>(); int bufferIndex = 0; foreach (PreprocessorDataDescriptor dialogObj in dialogObjects) { TabPage page = this._pageBuffer.GetPage(bufferIndex++); PreprocessorAreaData dialogArea = dialogObj.AreaData; page.Text = dialogArea != null ? dialogArea.Name : string.Empty; page.DisposeChildControls(); newPages.Add(page); tcBrowse.TabPages.Add(page); tabIndex++; if (selectTabIndex == tabIndex) { tcBrowse.SelectedIndex = selectTabIndex; } } // release extra pages in buffer this._pageBuffer.Resize(bufferIndex); // fill tab pages with report controls IEnumerator<TabPage> pageEnum = newPages.GetEnumerator(); foreach (PreprocessorDataDescriptor dialogObj in dialogObjects) { pageEnum.MoveNext(); TabPage page = pageEnum.Current; PreprocessorAreaData dialogArea = dialogObj.AreaData; if (dialogArea != null) { ConnectionTabArea ctrl = new ConnectionTabArea { Dock = DockStyle.Fill }; ctrl.Init(this, dialogArea, definition, this._model); page.Controls.Add(ctrl); } else { PreprocessorData dialogPreproc = dialogObj.Data; if (dialogPreproc != null) { Control control = dialogPreproc.ContentFactory.CreateControl(); if (control is WebBrowser || control is ReportViewrControl) { control.PreviewKeyDown += (s, e) => { if (e.KeyCode == Keys.F5) { F5RefreshView(); } }; if (control is ReportViewrControl && tcBrowse.Visible) { if ((control as ReportViewrControl).ReportXML != string.Empty) { using (MemoryStream xmlWriterStream = new MemoryStream()) { XmlWriterSettings xmlWriterSettings = new XmlWriterSettings { CheckCharacters = false, ConformanceLevel = ConformanceLevel.Auto, Encoding = Encoding.UTF8, Indent = true, IndentChars = " ", NewLineChars = Environment.NewLine, NewLineHandling = NewLineHandling.Replace, NewLineOnAttributes = false, OmitXmlDeclaration = false }; using (var xmlWriter = XmlWriter.Create(xmlWriterStream, xmlWriterSettings)) { XmlDocument doc = new XmlDocument(); doc.LoadXml((control as ReportViewrControl).ReportXML); doc.Save(xmlWriter); xmlWriter.Flush(); } additionalXml = Encoding.UTF8.GetString(xmlWriterStream.ToArray()); } } } } if (dialogPreproc.VerticalTextAlign != null) { TitleFrame titleFrame = new TitleFrame( dialogPreproc.VerticalTextAlign, dialogPreproc.TextAlign, control ); titleFrame.Title = dialogPreproc.Name; control = titleFrame; } control.Dock = DockStyle.Fill; page.Controls.Add(control); } } } } txtXml.Text = visualizeData.SourceXml + Environment.NewLine + additionalXml; txtXml.SelectionStart = 0; txtXml.SelectionLength = 0; txtXml.ReadOnly = true; txtXml.BackColor = Color.White; lblLastRefreshDate.Text = !visualizeData.NodeLastUpdated.HasValue ? ComposeBlankDateTimeString() : visualizeData.NodeLastUpdated.Value.ToString(); lblSpendTime.Text = visualizeData.NodeLastUpdateDuration.HasValue ? String.Format( " {0:00}:{1:00}:{2:00}", visualizeData.NodeLastUpdateDuration.Value.Hour, visualizeData.NodeLastUpdateDuration.Value.Minute, visualizeData.NodeLastUpdateDuration.Value.Second ) : String.Format( " {0:00}:{1:00}:{2:00}", 0, 0, 0 ); UpdateScheduledDate(nodeInfo); }
public void AddEmailTask(ConcreteTemplateNodeDefinition definition, Job job) { Func<NodeDataProvider> getNodeDataProviderFunc = () => new NodeDataProvider(this._model, definition); Task<NodeDataProvider> queryReportTask = Task.Factory.StartNew(getNodeDataProviderFunc); EmailNotificationTask emlTask = new EmailNotificationTask( this._allEmailTask, job, this._model.VisualizeProcessor ); queryReportTask.ContinueWith(emlTask.onQueryResult); }
private void tmSchedulerTimer_Tick(object sender, EventArgs e) { foreach (ConnectionData connection in Connections) { List<Tuple<TemplateNodeInfo, Job>> nodeJobs = new List<Tuple<TemplateNodeInfo, Job>>(); connection.RootOfStaticTree.GetScheduledNodes(nodeJobs,true); foreach (Tuple<TemplateNodeInfo, Job> nodeJob in nodeJobs) { Job job = nodeJob.Item2; TemplateNodeInfo node = nodeJob.Item1; ConnectionData localConnection = connection; Action action = () => { TreeNode uiTreeNode = FindJobbedUiTreeNode(job) ?? CreateTreeViewNode(node); Action sendEmailAction = null; if (job.Settings.IsSendMessage) { sendEmailAction = () => { ConcreteTemplateNodeDefinition definition = new ConcreteTemplateNodeDefinition( node, localConnection.ConnectionGroup ); AddEmailTask(definition, job); }; } TaskManager.BeginRefreshTask( uiTreeNode, true, NodeUpdatingSource.ForcedFromServer, sendEmailAction ); }; this._jobProcessor.RunIfTime( job, action, connection.CreationDateTime ); } } }
private List<Tuple<TemplateNodeQueryInfo, Int64, DataTable>> GetResultTables( ConcreteTemplateNodeDefinition nodeDefinition, MultyQueryResultInfo queriesResult ) { List<Tuple<TemplateNodeQueryInfo, Int64, DataTable>> resultTables = new List<Tuple<TemplateNodeQueryInfo, Int64, DataTable>>(); try { GroupDefinition database = nodeDefinition.Group; if (database != null) { foreach (QueryDatabaseResult queryDatabaseResult in queriesResult.GetDatabaseResults()) { QueryDatabaseResultInfo dbResult = queryDatabaseResult.Result; if (dbResult == null || dbResult.DataTables == null) { continue; } if (database.Name == dbResult.Database) { Int64 recordSet = 1L; foreach (DataTable curTable in dbResult.DataTables) { resultTables.Add( new Tuple<TemplateNodeQueryInfo, Int64, DataTable>( queryDatabaseResult.TemplateNodeQuery, recordSet, curTable ) ); recordSet++; } } } } } catch (Exception ex) { log.Error("Error in 'Extracts data from queries and saves it to table for RDLC.'", ex); throw; } return resultTables; }
public void VisualizeData(ConcreteTemplateNodeDefinition changedNode) { ConcreteTemplateNodeDefinition definition = null; int lastTabIndex = -1; Action action = () => { ConcreteTemplateNodeDefinition activeNode = CurrentConcreteTemplateNodeDefinition; if (activeNode == null) { return; } if (changedNode.Equals(activeNode)) { definition = GetConcreteTemplateNodeDefinitions(treeTemplate.SelectedNode, true, false).FirstOrDefault(); lastTabIndex = tcBrowse.SelectedIndex; InitializeTabs(definition); } }; this.SafeInvoke(action); if (definition == null) { return; } if (definition.NodeAvailable) { ShowReportAsync(definition, lastTabIndex); } else { this.SafeInvoke(ClearReportInfo); } }
public int? GetDataRowCount(ConcreteTemplateNodeDefinition nodeDefinition, ConnectionGroupInfo connectionGroup) { return this._model.GetVaultProcessor(connectionGroup) .GetDataRowCount( connectionGroup, nodeDefinition ); }
private TemplateNodeInfo GetTemplateToDisplay( ConcreteTemplateNodeDefinition nodeDefinition, out string dbName ) { dbName = nodeDefinition.Group.Id; return nodeDefinition.TemplateNode; }
public string GetXslFileName(ConcreteTemplateNodeDefinition nodeDefinition) { string dbName = string.Empty; TemplateNodeInfo templateToDisplay = GetTemplateToDisplay(nodeDefinition, out dbName); if (string.IsNullOrEmpty(templateToDisplay.XslTemplateFileName)) { return null; } if (!string.IsNullOrWhiteSpace(templateToDisplay.XslTemplateFileName)) { return this._model.FilesProvider.GetXslLocalizedTemplateFileName( templateToDisplay.XslTemplateFileName, nodeDefinition.Connection.TemplateDir ); } TemplateNodeLocaleInfo localized = templateToDisplay.GetLocale( true, this._model.Settings.ReportLanguage ); return this._model.FilesProvider.GetXslTemplateFileName( localized.TemplateFile, nodeDefinition.Connection.TemplateDir ); }
private void ShowReportAsync(ConcreteTemplateNodeDefinition definition, int tabSelectIndex) { if (this._reportViewCanceler != null) { this._reportViewCanceler.Cancel(); } this._reportViewCanceler = new CancellationTokenSource(); CancellationToken reportViewToken = this._reportViewCanceler.Token; GraphicsInfo graphicsInfo = GetGraphicsInfo(); Func<NodeDataProvider> getQueryResultFunc = () => new NodeDataProvider(this._model, definition); // log1.DebugFormat("getQueryResultFunc:{0}", // getQueryResultFunc // ); Task<NodeDataProvider> queryReportTask = Task.Factory.StartNew(getQueryResultFunc); // log1.DebugFormat("queryReportTask:{0}", // queryReportTask // ); // If task succeeded. queryReportTask .ContinueWith(t => { NodeDataProvider resultDataProvider = t.Result; // log1.DebugFormat("queriesResult:{0}", // queriesResult // ); // log1.DebugFormat("(1067):definition:{0};definition.Connection:{1};queriesResult:{2}", // definition, // definition.Connection, // queriesResult // ); reportViewToken.ThrowIfCancellationRequested(); VisualizeData visualizeData = this._model.VisualizeProcessor.GetVisualizeData( resultDataProvider, graphicsInfo ); reportViewToken.ThrowIfCancellationRequested(); Action showReportAction = () => { try { // log1.DebugFormat("(1082)visualizeData:{0}", // visualizeData // ); reportViewToken.ThrowIfCancellationRequested(); if (visualizeData != null) { RenderVisualizeData(definition, visualizeData, tabSelectIndex); } else { ClearReportInfo(); } } catch (OperationCanceledException exc) { // operation has been cancelled log1.ErrorFormat("Show report operation cancelled. Exception:{0}", exc ); } }; this.SafeInvoke(showReportAction); }, reportViewToken, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Current ) .ContinueOnException(HandleTaskFailure); // If task failed. queryReportTask.ContinueOnException(t => HandleTaskFailure(t)); }