Aggiunta preliminare MDI, renaming LogAnalyzer

This commit is contained in:
Samuele E. Locatelli
2020-09-01 14:01:52 +02:00
parent e4f3885d5f
commit ea11dcea06
9 changed files with 5833 additions and 5637 deletions
+2 -2
View File
@@ -42,13 +42,13 @@ namespace ELMA
private void btnApply_Click(object sender, EventArgs e)
{
((MainForm)this.Owner).activeSetup = currSetup;
((LogAnalyzer)this.Owner).activeSetup = currSetup;
doUpdate();
}
private void btnCancel_Click(object sender, EventArgs e)
{
currSetup=((MainForm)this.Owner).activeSetup;
currSetup=((LogAnalyzer)this.Owner).activeSetup;
doUpdate();
}
}
+9
View File
@@ -62,6 +62,12 @@
<Compile Include="ConfigMan.Designer.cs">
<DependentUpon>ConfigMan.cs</DependentUpon>
</Compile>
<Compile Include="LogAnalyzer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LogAnalyzer.Designer.cs">
<DependentUpon>LogAnalyzer.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -79,6 +85,9 @@
<EmbeddedResource Include="ConfigMan.resx">
<DependentUpon>ConfigMan.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LogAnalyzer.resx">
<DependentUpon>LogAnalyzer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
+514
View File
@@ -0,0 +1,514 @@
namespace ELMA
{
partial class LogAnalyzer
{
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Pulire le risorse in uso.
/// </summary>
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Codice generato da Progettazione Windows Form
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LogAnalyzer));
this.ErrorsDGV = new System.Windows.Forms.DataGridView();
this.sequenceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.timeUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.hostDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.applicationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.errorIdDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.typeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.sourceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.userDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.statusCodeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.bsErrors = new System.Windows.Forms.BindingSource(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblApp = new System.Windows.Forms.ToolStripStatusLabel();
this.lblVers = new System.Windows.Forms.ToolStripStatusLabel();
this.progBar = new System.Windows.Forms.ToolStripProgressBar();
this.tsslNumRec = new System.Windows.Forms.ToolStripStatusLabel();
this.gboxFiltri = new System.Windows.Forms.GroupBox();
this.btnDeleteSel = new System.Windows.Forms.Button();
this.chkUsers = new System.Windows.Forms.CheckBox();
this.chkStatus = new System.Windows.Forms.CheckBox();
this.chkHost = new System.Windows.Forms.CheckBox();
this.chkType = new System.Windows.Forms.CheckBox();
this.chkApp = new System.Windows.Forms.CheckBox();
this.listUsers = new System.Windows.Forms.ListBox();
this.listType = new System.Windows.Forms.ListBox();
this.listStatus = new System.Windows.Forms.ListBox();
this.listHost = new System.Windows.Forms.ListBox();
this.listApp = new System.Windows.Forms.ListBox();
this.timerUI = new System.Windows.Forms.Timer(this.components);
this.timerMain = new System.Windows.Forms.Timer(this.components);
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.currentConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
((System.ComponentModel.ISupportInitialize)(this.ErrorsDGV)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsErrors)).BeginInit();
this.statusStrip1.SuspendLayout();
this.gboxFiltri.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// ErrorsDGV
//
this.ErrorsDGV.AllowUserToAddRows = false;
this.ErrorsDGV.AllowUserToDeleteRows = false;
this.ErrorsDGV.AllowUserToOrderColumns = true;
this.ErrorsDGV.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ErrorsDGV.AutoGenerateColumns = false;
this.ErrorsDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.ErrorsDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.sequenceDataGridViewTextBoxColumn,
this.timeUtcDataGridViewTextBoxColumn,
this.hostDataGridViewTextBoxColumn,
this.applicationDataGridViewTextBoxColumn,
this.errorIdDataGridViewTextBoxColumn,
this.typeDataGridViewTextBoxColumn,
this.sourceDataGridViewTextBoxColumn,
this.userDataGridViewTextBoxColumn,
this.statusCodeDataGridViewTextBoxColumn,
this.messageDataGridViewTextBoxColumn});
this.ErrorsDGV.DataSource = this.bsErrors;
this.ErrorsDGV.Location = new System.Drawing.Point(12, 135);
this.ErrorsDGV.Name = "ErrorsDGV";
this.ErrorsDGV.ReadOnly = true;
this.ErrorsDGV.RowHeadersWidth = 51;
this.ErrorsDGV.Size = new System.Drawing.Size(1048, 470);
this.ErrorsDGV.TabIndex = 0;
this.ErrorsDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.ErrorsDGV_CellDoubleClick);
this.ErrorsDGV.DoubleClick += new System.EventHandler(this.ErrorsDGV_DoubleClick);
//
// sequenceDataGridViewTextBoxColumn
//
this.sequenceDataGridViewTextBoxColumn.DataPropertyName = "Sequence";
this.sequenceDataGridViewTextBoxColumn.HeaderText = "Sequence";
this.sequenceDataGridViewTextBoxColumn.MinimumWidth = 6;
this.sequenceDataGridViewTextBoxColumn.Name = "sequenceDataGridViewTextBoxColumn";
this.sequenceDataGridViewTextBoxColumn.ReadOnly = true;
this.sequenceDataGridViewTextBoxColumn.Width = 125;
//
// timeUtcDataGridViewTextBoxColumn
//
this.timeUtcDataGridViewTextBoxColumn.DataPropertyName = "TimeUtc";
this.timeUtcDataGridViewTextBoxColumn.HeaderText = "TimeUtc";
this.timeUtcDataGridViewTextBoxColumn.MinimumWidth = 6;
this.timeUtcDataGridViewTextBoxColumn.Name = "timeUtcDataGridViewTextBoxColumn";
this.timeUtcDataGridViewTextBoxColumn.ReadOnly = true;
this.timeUtcDataGridViewTextBoxColumn.Width = 125;
//
// hostDataGridViewTextBoxColumn
//
this.hostDataGridViewTextBoxColumn.DataPropertyName = "Host";
this.hostDataGridViewTextBoxColumn.HeaderText = "Host";
this.hostDataGridViewTextBoxColumn.MinimumWidth = 6;
this.hostDataGridViewTextBoxColumn.Name = "hostDataGridViewTextBoxColumn";
this.hostDataGridViewTextBoxColumn.ReadOnly = true;
this.hostDataGridViewTextBoxColumn.Width = 125;
//
// applicationDataGridViewTextBoxColumn
//
this.applicationDataGridViewTextBoxColumn.DataPropertyName = "Application";
this.applicationDataGridViewTextBoxColumn.HeaderText = "Application";
this.applicationDataGridViewTextBoxColumn.MinimumWidth = 6;
this.applicationDataGridViewTextBoxColumn.Name = "applicationDataGridViewTextBoxColumn";
this.applicationDataGridViewTextBoxColumn.ReadOnly = true;
this.applicationDataGridViewTextBoxColumn.Width = 125;
//
// errorIdDataGridViewTextBoxColumn
//
this.errorIdDataGridViewTextBoxColumn.DataPropertyName = "ErrorId";
this.errorIdDataGridViewTextBoxColumn.HeaderText = "ErrorId";
this.errorIdDataGridViewTextBoxColumn.MinimumWidth = 6;
this.errorIdDataGridViewTextBoxColumn.Name = "errorIdDataGridViewTextBoxColumn";
this.errorIdDataGridViewTextBoxColumn.ReadOnly = true;
this.errorIdDataGridViewTextBoxColumn.Width = 125;
//
// typeDataGridViewTextBoxColumn
//
this.typeDataGridViewTextBoxColumn.DataPropertyName = "Type";
this.typeDataGridViewTextBoxColumn.HeaderText = "Type";
this.typeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.typeDataGridViewTextBoxColumn.Name = "typeDataGridViewTextBoxColumn";
this.typeDataGridViewTextBoxColumn.ReadOnly = true;
this.typeDataGridViewTextBoxColumn.Width = 125;
//
// sourceDataGridViewTextBoxColumn
//
this.sourceDataGridViewTextBoxColumn.DataPropertyName = "Source";
this.sourceDataGridViewTextBoxColumn.HeaderText = "Source";
this.sourceDataGridViewTextBoxColumn.MinimumWidth = 6;
this.sourceDataGridViewTextBoxColumn.Name = "sourceDataGridViewTextBoxColumn";
this.sourceDataGridViewTextBoxColumn.ReadOnly = true;
this.sourceDataGridViewTextBoxColumn.Width = 125;
//
// userDataGridViewTextBoxColumn
//
this.userDataGridViewTextBoxColumn.DataPropertyName = "User";
this.userDataGridViewTextBoxColumn.HeaderText = "User";
this.userDataGridViewTextBoxColumn.MinimumWidth = 6;
this.userDataGridViewTextBoxColumn.Name = "userDataGridViewTextBoxColumn";
this.userDataGridViewTextBoxColumn.ReadOnly = true;
this.userDataGridViewTextBoxColumn.Width = 125;
//
// statusCodeDataGridViewTextBoxColumn
//
this.statusCodeDataGridViewTextBoxColumn.DataPropertyName = "StatusCode";
this.statusCodeDataGridViewTextBoxColumn.HeaderText = "StatusCode";
this.statusCodeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.statusCodeDataGridViewTextBoxColumn.Name = "statusCodeDataGridViewTextBoxColumn";
this.statusCodeDataGridViewTextBoxColumn.ReadOnly = true;
this.statusCodeDataGridViewTextBoxColumn.Width = 125;
//
// messageDataGridViewTextBoxColumn
//
this.messageDataGridViewTextBoxColumn.DataPropertyName = "Message";
this.messageDataGridViewTextBoxColumn.HeaderText = "Message";
this.messageDataGridViewTextBoxColumn.MinimumWidth = 6;
this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn";
this.messageDataGridViewTextBoxColumn.ReadOnly = true;
this.messageDataGridViewTextBoxColumn.Width = 125;
//
// bsErrors
//
this.bsErrors.DataSource = typeof(AppData.ELMAH_Error);
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblApp,
this.lblVers,
this.progBar,
this.tsslNumRec});
this.statusStrip1.Location = new System.Drawing.Point(0, 608);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1072, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Text = "statusStrip1";
//
// lblApp
//
this.lblApp.Name = "lblApp";
this.lblApp.Size = new System.Drawing.Size(44, 17);
this.lblApp.Text = "SELMA";
//
// lblVers
//
this.lblVers.Name = "lblVers";
this.lblVers.Size = new System.Drawing.Size(40, 17);
this.lblVers.Text = "0.0.0.0";
//
// progBar
//
this.progBar.Name = "progBar";
this.progBar.Size = new System.Drawing.Size(100, 16);
//
// tsslNumRec
//
this.tsslNumRec.Name = "tsslNumRec";
this.tsslNumRec.Size = new System.Drawing.Size(13, 17);
this.tsslNumRec.Text = "0";
//
// gboxFiltri
//
this.gboxFiltri.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gboxFiltri.Controls.Add(this.btnDeleteSel);
this.gboxFiltri.Controls.Add(this.chkUsers);
this.gboxFiltri.Controls.Add(this.chkStatus);
this.gboxFiltri.Controls.Add(this.chkHost);
this.gboxFiltri.Controls.Add(this.chkType);
this.gboxFiltri.Controls.Add(this.chkApp);
this.gboxFiltri.Controls.Add(this.listUsers);
this.gboxFiltri.Controls.Add(this.listType);
this.gboxFiltri.Controls.Add(this.listStatus);
this.gboxFiltri.Controls.Add(this.listHost);
this.gboxFiltri.Controls.Add(this.listApp);
this.gboxFiltri.Location = new System.Drawing.Point(12, 26);
this.gboxFiltri.Margin = new System.Windows.Forms.Padding(2);
this.gboxFiltri.Name = "gboxFiltri";
this.gboxFiltri.Padding = new System.Windows.Forms.Padding(2);
this.gboxFiltri.Size = new System.Drawing.Size(1048, 104);
this.gboxFiltri.TabIndex = 2;
this.gboxFiltri.TabStop = false;
this.gboxFiltri.Text = "Filtri";
//
// btnDeleteSel
//
this.btnDeleteSel.Location = new System.Drawing.Point(690, 31);
this.btnDeleteSel.Margin = new System.Windows.Forms.Padding(2);
this.btnDeleteSel.Name = "btnDeleteSel";
this.btnDeleteSel.Size = new System.Drawing.Size(111, 64);
this.btnDeleteSel.TabIndex = 17;
this.btnDeleteSel.Text = "DELETE SELECTED";
this.btnDeleteSel.UseVisualStyleBackColor = true;
this.btnDeleteSel.Click += new System.EventHandler(this.btnDeleteSel_Click);
//
// chkUsers
//
this.chkUsers.AutoSize = true;
this.chkUsers.Location = new System.Drawing.Point(584, 14);
this.chkUsers.Name = "chkUsers";
this.chkUsers.Size = new System.Drawing.Size(53, 17);
this.chkUsers.TabIndex = 16;
this.chkUsers.Text = "Users";
this.chkUsers.UseVisualStyleBackColor = true;
this.chkUsers.CheckedChanged += new System.EventHandler(this.chkUsers_CheckedChanged);
//
// chkStatus
//
this.chkStatus.AutoSize = true;
this.chkStatus.Location = new System.Drawing.Point(215, 14);
this.chkStatus.Name = "chkStatus";
this.chkStatus.Size = new System.Drawing.Size(56, 17);
this.chkStatus.TabIndex = 15;
this.chkStatus.Text = "Status";
this.chkStatus.UseVisualStyleBackColor = true;
this.chkStatus.CheckedChanged += new System.EventHandler(this.chkStatus_CheckedChanged);
//
// chkHost
//
this.chkHost.AutoSize = true;
this.chkHost.Location = new System.Drawing.Point(142, 14);
this.chkHost.Name = "chkHost";
this.chkHost.Size = new System.Drawing.Size(48, 17);
this.chkHost.TabIndex = 14;
this.chkHost.Text = "Host";
this.chkHost.UseVisualStyleBackColor = true;
this.chkHost.CheckedChanged += new System.EventHandler(this.chkHost_CheckedChanged);
//
// chkType
//
this.chkType.AutoSize = true;
this.chkType.Location = new System.Drawing.Point(285, 14);
this.chkType.Name = "chkType";
this.chkType.Size = new System.Drawing.Size(50, 17);
this.chkType.TabIndex = 13;
this.chkType.Text = "Type";
this.chkType.UseVisualStyleBackColor = true;
this.chkType.CheckedChanged += new System.EventHandler(this.chkType_CheckedChanged);
//
// chkApp
//
this.chkApp.AutoSize = true;
this.chkApp.Location = new System.Drawing.Point(5, 14);
this.chkApp.Name = "chkApp";
this.chkApp.Size = new System.Drawing.Size(45, 17);
this.chkApp.TabIndex = 12;
this.chkApp.Text = "App";
this.chkApp.UseVisualStyleBackColor = true;
this.chkApp.CheckedChanged += new System.EventHandler(this.chkApp_CheckedChanged);
//
// listUsers
//
this.listUsers.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listUsers.FormattingEnabled = true;
this.listUsers.ItemHeight = 15;
this.listUsers.Location = new System.Drawing.Point(584, 31);
this.listUsers.Margin = new System.Windows.Forms.Padding(2);
this.listUsers.Name = "listUsers";
this.listUsers.Size = new System.Drawing.Size(102, 64);
this.listUsers.TabIndex = 4;
this.listUsers.SelectedIndexChanged += new System.EventHandler(this.listUsers_SelectedIndexChanged);
//
// listType
//
this.listType.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listType.FormattingEnabled = true;
this.listType.ItemHeight = 15;
this.listType.Location = new System.Drawing.Point(285, 31);
this.listType.Margin = new System.Windows.Forms.Padding(2);
this.listType.Name = "listType";
this.listType.Size = new System.Drawing.Size(296, 64);
this.listType.TabIndex = 3;
this.listType.SelectedIndexChanged += new System.EventHandler(this.listType_SelectedIndexChanged);
//
// listStatus
//
this.listStatus.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listStatus.FormattingEnabled = true;
this.listStatus.ItemHeight = 15;
this.listStatus.Location = new System.Drawing.Point(215, 31);
this.listStatus.Margin = new System.Windows.Forms.Padding(2);
this.listStatus.Name = "listStatus";
this.listStatus.Size = new System.Drawing.Size(66, 64);
this.listStatus.TabIndex = 2;
this.listStatus.SelectedIndexChanged += new System.EventHandler(this.listStatus_SelectedIndexChanged);
//
// listHost
//
this.listHost.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listHost.FormattingEnabled = true;
this.listHost.ItemHeight = 15;
this.listHost.Location = new System.Drawing.Point(142, 31);
this.listHost.Margin = new System.Windows.Forms.Padding(2);
this.listHost.Name = "listHost";
this.listHost.Size = new System.Drawing.Size(70, 64);
this.listHost.TabIndex = 1;
this.listHost.SelectedIndexChanged += new System.EventHandler(this.listHost_SelectedIndexChanged);
//
// listApp
//
this.listApp.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listApp.FormattingEnabled = true;
this.listApp.ItemHeight = 15;
this.listApp.Location = new System.Drawing.Point(5, 31);
this.listApp.Margin = new System.Windows.Forms.Padding(2);
this.listApp.Name = "listApp";
this.listApp.Size = new System.Drawing.Size(133, 64);
this.listApp.TabIndex = 0;
this.listApp.SelectedIndexChanged += new System.EventHandler(this.listApp_SelectedIndexChanged);
//
// timerUI
//
this.timerUI.Interval = 50;
this.timerUI.Tick += new System.EventHandler(this.timerUI_Tick);
//
// timerMain
//
this.timerMain.Interval = 10000;
this.timerMain.Tick += new System.EventHandler(this.timerMain_Tick);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1072, 24);
this.menuStrip1.TabIndex = 3;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.currentConfigToolStripMenuItem,
this.loadToolStripMenuItem,
this.saveToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.fileToolStripMenuItem.Text = "C&onfig";
//
// currentConfigToolStripMenuItem
//
this.currentConfigToolStripMenuItem.Name = "currentConfigToolStripMenuItem";
this.currentConfigToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.currentConfigToolStripMenuItem.Text = "&Current Config";
this.currentConfigToolStripMenuItem.Click += new System.EventHandler(this.currentConfigToolStripMenuItem_Click);
//
// loadToolStripMenuItem
//
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
this.loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.loadToolStripMenuItem.Text = "&Load";
this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1072, 630);
this.Controls.Add(this.gboxFiltri);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.ErrorsDGV);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.Text = "Steamware Elma Log Monitor and Analysis";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.ErrorsDGV)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsErrors)).EndInit();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.gboxFiltri.ResumeLayout(false);
this.gboxFiltri.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView ErrorsDGV;
private System.Windows.Forms.BindingSource bsErrors;
private System.Windows.Forms.DataGridViewTextBoxColumn allXmlDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn tagsDataGridViewTextBoxColumn;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel lblApp;
private System.Windows.Forms.ToolStripProgressBar progBar;
private System.Windows.Forms.ToolStripStatusLabel lblVers;
private System.Windows.Forms.GroupBox gboxFiltri;
private System.Windows.Forms.ListBox listApp;
private System.Windows.Forms.ListBox listStatus;
private System.Windows.Forms.ListBox listHost;
private System.Windows.Forms.ListBox listUsers;
private System.Windows.Forms.ListBox listType;
private System.Windows.Forms.CheckBox chkType;
private System.Windows.Forms.CheckBox chkApp;
private System.Windows.Forms.CheckBox chkStatus;
private System.Windows.Forms.CheckBox chkHost;
private System.Windows.Forms.CheckBox chkUsers;
private System.Windows.Forms.ToolStripStatusLabel tsslNumRec;
private System.Windows.Forms.Timer timerUI;
private System.Windows.Forms.Timer timerMain;
private System.Windows.Forms.Button btnDeleteSel;
private System.Windows.Forms.DataGridViewTextBoxColumn sequenceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn timeUtcDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn hostDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn applicationDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn errorIdDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn typeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn sourceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn userDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn statusCodeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem currentConfigToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
}
}
+490
View File
@@ -0,0 +1,490 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AppData;
using Newtonsoft;
using Newtonsoft.Json;
namespace ELMA
{
public partial class LogAnalyzer : Form
{
#region setup
ElmahModel model = new ElmahModel();
/// <summary>
/// Oggetto conf setup
/// </summary>
public eSetup activeSetup = new eSetup();
/// <summary>
/// Setup file std
/// </summary>
protected string setupFile = "active.set";
protected string confDir
{
get
{
//string basePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
return $"{Directory.GetCurrentDirectory()}\\CONF\\";
}
}
/// <summary>
/// Setup configurazione da std file
/// </summary>
private void setupConfig()
{
// cerco il file json di config
string filePath = $"{confDir}\\{setupFile}";
loadConf(filePath);
if (string.IsNullOrEmpty(activeSetup.name))
{
// se non lo trovo creo setu...
activeSetup = new eSetup()
{
name = "standard",
connString = "data source=SQL2016DEV;initial catalog=Elmah;persist security info=True;user id=sa;password=keyhammer16;MultipleActiveResultSets=True;App=EntityFramework",
appBasePath = "/LM/W3SVC/1/ROOT",
baseUrl = "https://localhost:44388"
};
saveConf(filePath);
}
}
/// <summary>
/// Carica la conf corrente
/// </summary>
/// <param name="filePath"></param>
private void loadConf(string filePath)
{
if (File.Exists(filePath))
{
try
{
activeSetup = JsonConvert.DeserializeObject<eSetup>(File.ReadAllText(filePath));
}
catch
{ }
}
}
/// <summary>
/// Salva conf corrente sul file indicato
/// </summary>
/// <param name="filePath"></param>
private void saveConf(string filePath)
{
// .. e lo salvo...
string rawData = JsonConvert.SerializeObject(activeSetup, Formatting.Indented);
File.WriteAllText(filePath, rawData);
}
private void currentConfigToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigMan currConfig = new ConfigMan();
currConfig.currSetup = activeSetup;
currConfig.Owner = this;
currConfig.doUpdate();
currConfig.Show();
}
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
// salvo la conf corrente...
OpenFileDialog oFileDialog = new OpenFileDialog();
oFileDialog.DefaultExt = "jset";
oFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*";
oFileDialog.InitialDirectory = confDir;
oFileDialog.RestoreDirectory = true;
if (oFileDialog.ShowDialog() == DialogResult.OK)
{
// carico
loadConf(oFileDialog.FileName);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
// salvo la conf corrente...
SaveFileDialog sFileDialog = new SaveFileDialog();
sFileDialog.DefaultExt= "jset";
sFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*";
sFileDialog.InitialDirectory = confDir;
sFileDialog.RestoreDirectory = true;
if (sFileDialog.ShowDialog() == DialogResult.OK)
{
// salvo!
string rawData = JsonConvert.SerializeObject(activeSetup, Formatting.Indented);
saveConf(sFileDialog.FileName);
}
}
#endregion
#region area init & close
public LogAnalyzer()
{
InitializeComponent();
myInit();
startTimers();
}
private void startTimers()
{
timerUI.Start();
timerMain.Start();
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
timerUI.Stop();
timerMain.Stop();
}
private void myInit()
{
setupConfig();
setupFilterData();
doUpdate();
}
private void timerUI_Tick(object sender, EventArgs e)
{
progBar.Increment(1);
if (progBar.Value >= 100)
{
progBar.Value = 0;
}
}
private void timerMain_Tick(object sender, EventArgs e)
{
#if false
setupFilterData();
doUpdate();
#endif
}
#endregion
#region Utils e metodi dati
private void setupFilterData()
{
// resetto dati
listApp.Items.Clear();
listHost.Items.Clear();
listStatus.Items.Clear();
listType.Items.Clear();
listUsers.Items.Clear();
// carico DB con filtri
var setApp = model.ELMAH_Error
.Select(e => new { e.Application })
.Distinct()
.ToList();
foreach (var item in setApp)
{
listApp.Items.Add(item.Application);
}
var setHost = model.ELMAH_Error
.Select(e => new { e.Host })
.Distinct()
.ToList();
foreach (var item in setHost)
{
listHost.Items.Add(item.Host);
}
var setStatus = model.ELMAH_Error
.Select(e => new { e.StatusCode })
.Distinct()
.ToList();
foreach (var item in setStatus)
{
listStatus.Items.Add(item.StatusCode);
}
var setType = model.ELMAH_Error
.Select(e => new { e.Type })
.Distinct()
.ToList();
foreach (var item in setType)
{
listType.Items.Add(item.Type);
}
var setUser = model.ELMAH_Error
.Select(e => new { e.User })
.Distinct()
.ToList();
//var setUser = dbFilt.Where(x => x.Cat == "User").ToList();
foreach (var item in setUser)
{
listUsers.Items.Add(item.User);
}
listApp.SelectedIndex = 0;
listHost.SelectedIndex = 0;
listStatus.SelectedIndex = 0;
listType.SelectedIndex = 0;
listUsers.SelectedIndex = 0;
}
private void checkFilterVisibility()
{
// Verifico TUTTI i filtri
listApp.Enabled = chkApp.Checked && listApp.Items.Count > 0;
listHost.Enabled = chkHost.Checked && listHost.Items.Count > 0;
listStatus.Enabled = chkStatus.Checked && listStatus.Items.Count > 0;
listType.Enabled = chkType.Checked && listType.Items.Count > 0;
listUsers.Enabled = chkUsers.Checked && listUsers.Items.Count > 0;
}
protected string selApp { get { return listApp.SelectedItem.ToString(); } }
protected string selStatus
{
get
{
string answ = "";
if (chkStatus.Checked)
{
if (listStatus.SelectedItem != null)
{
answ = listStatus.SelectedItem.ToString();
}
}
return answ;
}
}
protected string selHost { get { return listHost.SelectedItem.ToString(); } }
protected string selType { get { return listType.SelectedItem.ToString(); } }
protected string selUser { get { return listUsers.SelectedItem.ToString(); } }
private void updateSelection()
{
List<ELMAH_Error> subset = getFiltData();
this.bsErrors.DataSource = subset;
for (int i = 0; i < ErrorsDGV.Columns.Count - 1; i++)
{
ErrorsDGV.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
}
tsslNumRec.Text = $"{subset.Count} rec";
}
private List<ELMAH_Error> getFiltData()
{
var dbSet = model.ELMAH_Error;
int statusCode = 0;
int.TryParse(selStatus, out statusCode);
string selApp = listApp.SelectedItem.ToString();
// inizio azione filtraggio..
IQueryable<ELMAH_Error> subset = dbSet.Where(x => x.Sequence > 0);
if (chkApp.Checked)
{
subset = subset.Where(x => x.Application == selApp);
}
if (chkHost.Checked)
{
subset = subset.Where(x => x.Host == selHost);
}
if (chkStatus.Checked)
{
subset = subset.Where(x => x.StatusCode == statusCode);
}
if (chkType.Checked)
{
subset = subset.Where(x => x.Type == selType);
}
if (chkUsers.Checked)
{
subset = subset.Where(x => x.User == selUser);
}
return subset.OrderByDescending(x => x.TimeUtc).ToList();
}
/// <summary>
/// Aggiornamento visualizzazioni
/// </summary>
private void doUpdate()
{
checkFilterVisibility();
updateSelection();
}
private void deleteRecordFiltered()
{
// elimino 1:1 da selezione
foreach (var item in getFiltData())
{
model.ELMAH_Error.Remove(item);
}
// salvo
model.SaveChangesAsync();
// aggiorno!!
setupFilterData();
doUpdate();
}
private void deleteSelRows()
{
Guid ErrorId;
// SOLO SE selezionato in dgv...
if (ErrorsDGV.SelectedRows.Count > 0)
{
foreach (DataGridViewRow riga in ErrorsDGV.SelectedRows)
{
// chiudo!
ErrorId = ((ELMAH_Error)riga.DataBoundItem).ErrorId;
try
{
model.ELMAH_Error.Remove((ELMAH_Error)riga.DataBoundItem);
}
catch
{ }
}
}
// salvo
model.SaveChanges();
// aggiorno!!
doUpdate();
}
private void resetFilter()
{
chkApp.Checked = false;
chkHost.Checked = false;
chkStatus.Checked = false;
chkType.Checked = false;
chkUsers.Checked = false;
}
#endregion
#region area interazione
private void listApp_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkApp.Checked)
doUpdate();
}
private void listHost_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkHost.Checked)
doUpdate();
}
private void listStatus_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkStatus.Checked)
doUpdate();
}
private void listType_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkType.Checked)
doUpdate();
}
private void listUsers_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkUsers.Checked)
doUpdate();
}
private void chkApp_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkType_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkStatus_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkHost_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkUsers_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void ErrorsDGV_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
// seleziono riga
}
/// <summary>
/// Elimino record selezionati
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnDeleteSel_Click(object sender, EventArgs e)
{
deleteSelRows();
}
/// <summary>
/// Calcola path applicazione partendo da bassePath
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
protected string getAppPath(string application)
{
return application.Replace(activeSetup.appBasePath, "");
}
private void ErrorsDGV_DoubleClick(object sender, EventArgs e)
{
// recupero valore...
Guid ErrorId;
string appPath = "";
string pageUrl = "";
// SOLO SE selezionato in dgv...
if (ErrorsDGV.SelectedRows.Count > 0)
{
foreach (DataGridViewRow riga in ErrorsDGV.SelectedRows)
{
// recupero dati
ErrorId = ((ELMAH_Error)riga.DataBoundItem).ErrorId;
appPath = getAppPath(((ELMAH_Error)riga.DataBoundItem).Application);
// SE appPAth !="" accodo...
if (!string.IsNullOrEmpty(appPath))
{
pageUrl = $"{activeSetup.baseUrl}/{appPath}/elmah.axd/detail?id={ErrorId}";
}
else
{
pageUrl = $"{activeSetup.baseUrl}/elmah.axd/detail?id={ErrorId}";
}
// mostro form
var newBrowser = new WBrowser();
newBrowser.pageUrl = pageUrl;
newBrowser.Show();
}
}
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
+11 -478
View File
@@ -3,14 +3,14 @@
partial class MainForm
{
/// <summary>
/// Variabile di progettazione necessaria.
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Pulire le risorse in uso.
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@@ -20,495 +20,28 @@
base.Dispose(disposing);
}
#region Codice generato da Progettazione Windows Form
#region Windows Form Designer generated code
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.ErrorsDGV = new System.Windows.Forms.DataGridView();
this.sequenceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.timeUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.hostDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.applicationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.errorIdDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.typeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.sourceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.userDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.statusCodeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.bsErrors = new System.Windows.Forms.BindingSource(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblApp = new System.Windows.Forms.ToolStripStatusLabel();
this.lblVers = new System.Windows.Forms.ToolStripStatusLabel();
this.progBar = new System.Windows.Forms.ToolStripProgressBar();
this.tsslNumRec = new System.Windows.Forms.ToolStripStatusLabel();
this.gboxFiltri = new System.Windows.Forms.GroupBox();
this.btnDeleteSel = new System.Windows.Forms.Button();
this.chkUsers = new System.Windows.Forms.CheckBox();
this.chkStatus = new System.Windows.Forms.CheckBox();
this.chkHost = new System.Windows.Forms.CheckBox();
this.chkType = new System.Windows.Forms.CheckBox();
this.chkApp = new System.Windows.Forms.CheckBox();
this.listUsers = new System.Windows.Forms.ListBox();
this.listType = new System.Windows.Forms.ListBox();
this.listStatus = new System.Windows.Forms.ListBox();
this.listHost = new System.Windows.Forms.ListBox();
this.listApp = new System.Windows.Forms.ListBox();
this.timerUI = new System.Windows.Forms.Timer(this.components);
this.timerMain = new System.Windows.Forms.Timer(this.components);
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.currentConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
((System.ComponentModel.ISupportInitialize)(this.ErrorsDGV)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsErrors)).BeginInit();
this.statusStrip1.SuspendLayout();
this.gboxFiltri.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// ErrorsDGV
//
this.ErrorsDGV.AllowUserToAddRows = false;
this.ErrorsDGV.AllowUserToDeleteRows = false;
this.ErrorsDGV.AllowUserToOrderColumns = true;
this.ErrorsDGV.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ErrorsDGV.AutoGenerateColumns = false;
this.ErrorsDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.ErrorsDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.sequenceDataGridViewTextBoxColumn,
this.timeUtcDataGridViewTextBoxColumn,
this.hostDataGridViewTextBoxColumn,
this.applicationDataGridViewTextBoxColumn,
this.errorIdDataGridViewTextBoxColumn,
this.typeDataGridViewTextBoxColumn,
this.sourceDataGridViewTextBoxColumn,
this.userDataGridViewTextBoxColumn,
this.statusCodeDataGridViewTextBoxColumn,
this.messageDataGridViewTextBoxColumn});
this.ErrorsDGV.DataSource = this.bsErrors;
this.ErrorsDGV.Location = new System.Drawing.Point(12, 135);
this.ErrorsDGV.Name = "ErrorsDGV";
this.ErrorsDGV.ReadOnly = true;
this.ErrorsDGV.RowHeadersWidth = 51;
this.ErrorsDGV.Size = new System.Drawing.Size(1048, 470);
this.ErrorsDGV.TabIndex = 0;
this.ErrorsDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.ErrorsDGV_CellDoubleClick);
this.ErrorsDGV.DoubleClick += new System.EventHandler(this.ErrorsDGV_DoubleClick);
//
// sequenceDataGridViewTextBoxColumn
//
this.sequenceDataGridViewTextBoxColumn.DataPropertyName = "Sequence";
this.sequenceDataGridViewTextBoxColumn.HeaderText = "Sequence";
this.sequenceDataGridViewTextBoxColumn.MinimumWidth = 6;
this.sequenceDataGridViewTextBoxColumn.Name = "sequenceDataGridViewTextBoxColumn";
this.sequenceDataGridViewTextBoxColumn.ReadOnly = true;
this.sequenceDataGridViewTextBoxColumn.Width = 125;
//
// timeUtcDataGridViewTextBoxColumn
//
this.timeUtcDataGridViewTextBoxColumn.DataPropertyName = "TimeUtc";
this.timeUtcDataGridViewTextBoxColumn.HeaderText = "TimeUtc";
this.timeUtcDataGridViewTextBoxColumn.MinimumWidth = 6;
this.timeUtcDataGridViewTextBoxColumn.Name = "timeUtcDataGridViewTextBoxColumn";
this.timeUtcDataGridViewTextBoxColumn.ReadOnly = true;
this.timeUtcDataGridViewTextBoxColumn.Width = 125;
//
// hostDataGridViewTextBoxColumn
//
this.hostDataGridViewTextBoxColumn.DataPropertyName = "Host";
this.hostDataGridViewTextBoxColumn.HeaderText = "Host";
this.hostDataGridViewTextBoxColumn.MinimumWidth = 6;
this.hostDataGridViewTextBoxColumn.Name = "hostDataGridViewTextBoxColumn";
this.hostDataGridViewTextBoxColumn.ReadOnly = true;
this.hostDataGridViewTextBoxColumn.Width = 125;
//
// applicationDataGridViewTextBoxColumn
//
this.applicationDataGridViewTextBoxColumn.DataPropertyName = "Application";
this.applicationDataGridViewTextBoxColumn.HeaderText = "Application";
this.applicationDataGridViewTextBoxColumn.MinimumWidth = 6;
this.applicationDataGridViewTextBoxColumn.Name = "applicationDataGridViewTextBoxColumn";
this.applicationDataGridViewTextBoxColumn.ReadOnly = true;
this.applicationDataGridViewTextBoxColumn.Width = 125;
//
// errorIdDataGridViewTextBoxColumn
//
this.errorIdDataGridViewTextBoxColumn.DataPropertyName = "ErrorId";
this.errorIdDataGridViewTextBoxColumn.HeaderText = "ErrorId";
this.errorIdDataGridViewTextBoxColumn.MinimumWidth = 6;
this.errorIdDataGridViewTextBoxColumn.Name = "errorIdDataGridViewTextBoxColumn";
this.errorIdDataGridViewTextBoxColumn.ReadOnly = true;
this.errorIdDataGridViewTextBoxColumn.Width = 125;
//
// typeDataGridViewTextBoxColumn
//
this.typeDataGridViewTextBoxColumn.DataPropertyName = "Type";
this.typeDataGridViewTextBoxColumn.HeaderText = "Type";
this.typeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.typeDataGridViewTextBoxColumn.Name = "typeDataGridViewTextBoxColumn";
this.typeDataGridViewTextBoxColumn.ReadOnly = true;
this.typeDataGridViewTextBoxColumn.Width = 125;
//
// sourceDataGridViewTextBoxColumn
//
this.sourceDataGridViewTextBoxColumn.DataPropertyName = "Source";
this.sourceDataGridViewTextBoxColumn.HeaderText = "Source";
this.sourceDataGridViewTextBoxColumn.MinimumWidth = 6;
this.sourceDataGridViewTextBoxColumn.Name = "sourceDataGridViewTextBoxColumn";
this.sourceDataGridViewTextBoxColumn.ReadOnly = true;
this.sourceDataGridViewTextBoxColumn.Width = 125;
//
// userDataGridViewTextBoxColumn
//
this.userDataGridViewTextBoxColumn.DataPropertyName = "User";
this.userDataGridViewTextBoxColumn.HeaderText = "User";
this.userDataGridViewTextBoxColumn.MinimumWidth = 6;
this.userDataGridViewTextBoxColumn.Name = "userDataGridViewTextBoxColumn";
this.userDataGridViewTextBoxColumn.ReadOnly = true;
this.userDataGridViewTextBoxColumn.Width = 125;
//
// statusCodeDataGridViewTextBoxColumn
//
this.statusCodeDataGridViewTextBoxColumn.DataPropertyName = "StatusCode";
this.statusCodeDataGridViewTextBoxColumn.HeaderText = "StatusCode";
this.statusCodeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.statusCodeDataGridViewTextBoxColumn.Name = "statusCodeDataGridViewTextBoxColumn";
this.statusCodeDataGridViewTextBoxColumn.ReadOnly = true;
this.statusCodeDataGridViewTextBoxColumn.Width = 125;
//
// messageDataGridViewTextBoxColumn
//
this.messageDataGridViewTextBoxColumn.DataPropertyName = "Message";
this.messageDataGridViewTextBoxColumn.HeaderText = "Message";
this.messageDataGridViewTextBoxColumn.MinimumWidth = 6;
this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn";
this.messageDataGridViewTextBoxColumn.ReadOnly = true;
this.messageDataGridViewTextBoxColumn.Width = 125;
//
// bsErrors
//
this.bsErrors.DataSource = typeof(AppData.ELMAH_Error);
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblApp,
this.lblVers,
this.progBar,
this.tsslNumRec});
this.statusStrip1.Location = new System.Drawing.Point(0, 608);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1072, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Text = "statusStrip1";
//
// lblApp
//
this.lblApp.Name = "lblApp";
this.lblApp.Size = new System.Drawing.Size(44, 17);
this.lblApp.Text = "SELMA";
//
// lblVers
//
this.lblVers.Name = "lblVers";
this.lblVers.Size = new System.Drawing.Size(40, 17);
this.lblVers.Text = "0.0.0.0";
//
// progBar
//
this.progBar.Name = "progBar";
this.progBar.Size = new System.Drawing.Size(100, 16);
//
// tsslNumRec
//
this.tsslNumRec.Name = "tsslNumRec";
this.tsslNumRec.Size = new System.Drawing.Size(13, 17);
this.tsslNumRec.Text = "0";
//
// gboxFiltri
//
this.gboxFiltri.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gboxFiltri.Controls.Add(this.btnDeleteSel);
this.gboxFiltri.Controls.Add(this.chkUsers);
this.gboxFiltri.Controls.Add(this.chkStatus);
this.gboxFiltri.Controls.Add(this.chkHost);
this.gboxFiltri.Controls.Add(this.chkType);
this.gboxFiltri.Controls.Add(this.chkApp);
this.gboxFiltri.Controls.Add(this.listUsers);
this.gboxFiltri.Controls.Add(this.listType);
this.gboxFiltri.Controls.Add(this.listStatus);
this.gboxFiltri.Controls.Add(this.listHost);
this.gboxFiltri.Controls.Add(this.listApp);
this.gboxFiltri.Location = new System.Drawing.Point(12, 26);
this.gboxFiltri.Margin = new System.Windows.Forms.Padding(2);
this.gboxFiltri.Name = "gboxFiltri";
this.gboxFiltri.Padding = new System.Windows.Forms.Padding(2);
this.gboxFiltri.Size = new System.Drawing.Size(1048, 104);
this.gboxFiltri.TabIndex = 2;
this.gboxFiltri.TabStop = false;
this.gboxFiltri.Text = "Filtri";
//
// btnDeleteSel
//
this.btnDeleteSel.Location = new System.Drawing.Point(690, 31);
this.btnDeleteSel.Margin = new System.Windows.Forms.Padding(2);
this.btnDeleteSel.Name = "btnDeleteSel";
this.btnDeleteSel.Size = new System.Drawing.Size(111, 64);
this.btnDeleteSel.TabIndex = 17;
this.btnDeleteSel.Text = "DELETE SELECTED";
this.btnDeleteSel.UseVisualStyleBackColor = true;
this.btnDeleteSel.Click += new System.EventHandler(this.btnDeleteSel_Click);
//
// chkUsers
//
this.chkUsers.AutoSize = true;
this.chkUsers.Location = new System.Drawing.Point(584, 14);
this.chkUsers.Name = "chkUsers";
this.chkUsers.Size = new System.Drawing.Size(53, 17);
this.chkUsers.TabIndex = 16;
this.chkUsers.Text = "Users";
this.chkUsers.UseVisualStyleBackColor = true;
this.chkUsers.CheckedChanged += new System.EventHandler(this.chkUsers_CheckedChanged);
//
// chkStatus
//
this.chkStatus.AutoSize = true;
this.chkStatus.Location = new System.Drawing.Point(215, 14);
this.chkStatus.Name = "chkStatus";
this.chkStatus.Size = new System.Drawing.Size(56, 17);
this.chkStatus.TabIndex = 15;
this.chkStatus.Text = "Status";
this.chkStatus.UseVisualStyleBackColor = true;
this.chkStatus.CheckedChanged += new System.EventHandler(this.chkStatus_CheckedChanged);
//
// chkHost
//
this.chkHost.AutoSize = true;
this.chkHost.Location = new System.Drawing.Point(142, 14);
this.chkHost.Name = "chkHost";
this.chkHost.Size = new System.Drawing.Size(48, 17);
this.chkHost.TabIndex = 14;
this.chkHost.Text = "Host";
this.chkHost.UseVisualStyleBackColor = true;
this.chkHost.CheckedChanged += new System.EventHandler(this.chkHost_CheckedChanged);
//
// chkType
//
this.chkType.AutoSize = true;
this.chkType.Location = new System.Drawing.Point(285, 14);
this.chkType.Name = "chkType";
this.chkType.Size = new System.Drawing.Size(50, 17);
this.chkType.TabIndex = 13;
this.chkType.Text = "Type";
this.chkType.UseVisualStyleBackColor = true;
this.chkType.CheckedChanged += new System.EventHandler(this.chkType_CheckedChanged);
//
// chkApp
//
this.chkApp.AutoSize = true;
this.chkApp.Location = new System.Drawing.Point(5, 14);
this.chkApp.Name = "chkApp";
this.chkApp.Size = new System.Drawing.Size(45, 17);
this.chkApp.TabIndex = 12;
this.chkApp.Text = "App";
this.chkApp.UseVisualStyleBackColor = true;
this.chkApp.CheckedChanged += new System.EventHandler(this.chkApp_CheckedChanged);
//
// listUsers
//
this.listUsers.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listUsers.FormattingEnabled = true;
this.listUsers.ItemHeight = 15;
this.listUsers.Location = new System.Drawing.Point(584, 31);
this.listUsers.Margin = new System.Windows.Forms.Padding(2);
this.listUsers.Name = "listUsers";
this.listUsers.Size = new System.Drawing.Size(102, 64);
this.listUsers.TabIndex = 4;
this.listUsers.SelectedIndexChanged += new System.EventHandler(this.listUsers_SelectedIndexChanged);
//
// listType
//
this.listType.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listType.FormattingEnabled = true;
this.listType.ItemHeight = 15;
this.listType.Location = new System.Drawing.Point(285, 31);
this.listType.Margin = new System.Windows.Forms.Padding(2);
this.listType.Name = "listType";
this.listType.Size = new System.Drawing.Size(296, 64);
this.listType.TabIndex = 3;
this.listType.SelectedIndexChanged += new System.EventHandler(this.listType_SelectedIndexChanged);
//
// listStatus
//
this.listStatus.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listStatus.FormattingEnabled = true;
this.listStatus.ItemHeight = 15;
this.listStatus.Location = new System.Drawing.Point(215, 31);
this.listStatus.Margin = new System.Windows.Forms.Padding(2);
this.listStatus.Name = "listStatus";
this.listStatus.Size = new System.Drawing.Size(66, 64);
this.listStatus.TabIndex = 2;
this.listStatus.SelectedIndexChanged += new System.EventHandler(this.listStatus_SelectedIndexChanged);
//
// listHost
//
this.listHost.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listHost.FormattingEnabled = true;
this.listHost.ItemHeight = 15;
this.listHost.Location = new System.Drawing.Point(142, 31);
this.listHost.Margin = new System.Windows.Forms.Padding(2);
this.listHost.Name = "listHost";
this.listHost.Size = new System.Drawing.Size(70, 64);
this.listHost.TabIndex = 1;
this.listHost.SelectedIndexChanged += new System.EventHandler(this.listHost_SelectedIndexChanged);
//
// listApp
//
this.listApp.Font = new System.Drawing.Font("Arial Narrow", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listApp.FormattingEnabled = true;
this.listApp.ItemHeight = 15;
this.listApp.Location = new System.Drawing.Point(5, 31);
this.listApp.Margin = new System.Windows.Forms.Padding(2);
this.listApp.Name = "listApp";
this.listApp.Size = new System.Drawing.Size(133, 64);
this.listApp.TabIndex = 0;
this.listApp.SelectedIndexChanged += new System.EventHandler(this.listApp_SelectedIndexChanged);
//
// timerUI
//
this.timerUI.Interval = 50;
this.timerUI.Tick += new System.EventHandler(this.timerUI_Tick);
//
// timerMain
//
this.timerMain.Interval = 10000;
this.timerMain.Tick += new System.EventHandler(this.timerMain_Tick);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1072, 24);
this.menuStrip1.TabIndex = 3;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.currentConfigToolStripMenuItem,
this.loadToolStripMenuItem,
this.saveToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.fileToolStripMenuItem.Text = "C&onfig";
//
// currentConfigToolStripMenuItem
//
this.currentConfigToolStripMenuItem.Name = "currentConfigToolStripMenuItem";
this.currentConfigToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.currentConfigToolStripMenuItem.Text = "&Current Config";
this.currentConfigToolStripMenuItem.Click += new System.EventHandler(this.currentConfigToolStripMenuItem_Click);
//
// loadToolStripMenuItem
//
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
this.loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.loadToolStripMenuItem.Text = "&Load";
this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1072, 630);
this.Controls.Add(this.gboxFiltri);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.ErrorsDGV);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.ClientSize = new System.Drawing.Size(800, 450);
this.IsMdiContainer = true;
this.Name = "MainForm";
this.Text = "Steamware Elma Log Monitor and Analysis";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.ErrorsDGV)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsErrors)).EndInit();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.gboxFiltri.ResumeLayout(false);
this.gboxFiltri.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.Text = "MainForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView ErrorsDGV;
private System.Windows.Forms.BindingSource bsErrors;
private System.Windows.Forms.DataGridViewTextBoxColumn allXmlDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn tagsDataGridViewTextBoxColumn;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel lblApp;
private System.Windows.Forms.ToolStripProgressBar progBar;
private System.Windows.Forms.ToolStripStatusLabel lblVers;
private System.Windows.Forms.GroupBox gboxFiltri;
private System.Windows.Forms.ListBox listApp;
private System.Windows.Forms.ListBox listStatus;
private System.Windows.Forms.ListBox listHost;
private System.Windows.Forms.ListBox listUsers;
private System.Windows.Forms.ListBox listType;
private System.Windows.Forms.CheckBox chkType;
private System.Windows.Forms.CheckBox chkApp;
private System.Windows.Forms.CheckBox chkStatus;
private System.Windows.Forms.CheckBox chkHost;
private System.Windows.Forms.CheckBox chkUsers;
private System.Windows.Forms.ToolStripStatusLabel tsslNumRec;
private System.Windows.Forms.Timer timerUI;
private System.Windows.Forms.Timer timerMain;
private System.Windows.Forms.Button btnDeleteSel;
private System.Windows.Forms.DataGridViewTextBoxColumn sequenceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn timeUtcDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn hostDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn applicationDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn errorIdDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn typeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn sourceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn userDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn statusCodeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem currentConfigToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
#endregion
}
}
}
-470
View File
@@ -2,489 +2,19 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AppData;
using Newtonsoft;
using Newtonsoft.Json;
namespace ELMA
{
public partial class MainForm : Form
{
#region setup
ElmahModel model = new ElmahModel();
/// <summary>
/// Oggetto conf setup
/// </summary>
public eSetup activeSetup = new eSetup();
/// <summary>
/// Setup file std
/// </summary>
protected string setupFile = "active.set";
protected string confDir
{
get
{
//string basePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
return $"{Directory.GetCurrentDirectory()}\\CONF\\";
}
}
/// <summary>
/// Setup configurazione da std file
/// </summary>
private void setupConfig()
{
// cerco il file json di config
string filePath = $"{confDir}\\{setupFile}";
loadConf(filePath);
if (string.IsNullOrEmpty(activeSetup.name))
{
// se non lo trovo creo setu...
activeSetup = new eSetup()
{
name = "standard",
connString = "data source=SQL2016DEV;initial catalog=Elmah;persist security info=True;user id=sa;password=keyhammer16;MultipleActiveResultSets=True;App=EntityFramework",
appBasePath = "/LM/W3SVC/1/ROOT",
baseUrl = "https://localhost:44388"
};
saveConf(filePath);
}
}
/// <summary>
/// Carica la conf corrente
/// </summary>
/// <param name="filePath"></param>
private void loadConf(string filePath)
{
if (File.Exists(filePath))
{
try
{
activeSetup = JsonConvert.DeserializeObject<eSetup>(File.ReadAllText(filePath));
}
catch
{ }
}
}
/// <summary>
/// Salva conf corrente sul file indicato
/// </summary>
/// <param name="filePath"></param>
private void saveConf(string filePath)
{
// .. e lo salvo...
string rawData = JsonConvert.SerializeObject(activeSetup, Formatting.Indented);
File.WriteAllText(filePath, rawData);
}
private void currentConfigToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigMan currConfig = new ConfigMan();
currConfig.currSetup = activeSetup;
currConfig.Owner = this;
currConfig.doUpdate();
currConfig.Show();
}
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
{
// salvo la conf corrente...
OpenFileDialog oFileDialog = new OpenFileDialog();
oFileDialog.DefaultExt = "jset";
oFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*";
oFileDialog.InitialDirectory = confDir;
oFileDialog.RestoreDirectory = true;
if (oFileDialog.ShowDialog() == DialogResult.OK)
{
// carico
loadConf(oFileDialog.FileName);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
// salvo la conf corrente...
SaveFileDialog sFileDialog = new SaveFileDialog();
sFileDialog.DefaultExt= "jset";
sFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*";
sFileDialog.InitialDirectory = confDir;
sFileDialog.RestoreDirectory = true;
if (sFileDialog.ShowDialog() == DialogResult.OK)
{
// salvo!
string rawData = JsonConvert.SerializeObject(activeSetup, Formatting.Indented);
saveConf(sFileDialog.FileName);
}
}
#endregion
#region area init & close
public MainForm()
{
InitializeComponent();
myInit();
startTimers();
}
private void startTimers()
{
timerUI.Start();
timerMain.Start();
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
timerUI.Stop();
timerMain.Stop();
}
private void myInit()
{
setupConfig();
setupFilterData();
doUpdate();
}
private void timerUI_Tick(object sender, EventArgs e)
{
progBar.Increment(1);
if (progBar.Value >= 100)
{
progBar.Value = 0;
}
}
private void timerMain_Tick(object sender, EventArgs e)
{
#if false
setupFilterData();
doUpdate();
#endif
}
#endregion
#region Utils e metodi dati
private void setupFilterData()
{
// resetto dati
listApp.Items.Clear();
listHost.Items.Clear();
listStatus.Items.Clear();
listType.Items.Clear();
listUsers.Items.Clear();
// carico DB con filtri
var setApp = model.ELMAH_Error
.Select(e => new { e.Application })
.Distinct()
.ToList();
foreach (var item in setApp)
{
listApp.Items.Add(item.Application);
}
var setHost = model.ELMAH_Error
.Select(e => new { e.Host })
.Distinct()
.ToList();
foreach (var item in setHost)
{
listHost.Items.Add(item.Host);
}
var setStatus = model.ELMAH_Error
.Select(e => new { e.StatusCode })
.Distinct()
.ToList();
foreach (var item in setStatus)
{
listStatus.Items.Add(item.StatusCode);
}
var setType = model.ELMAH_Error
.Select(e => new { e.Type })
.Distinct()
.ToList();
foreach (var item in setType)
{
listType.Items.Add(item.Type);
}
var setUser = model.ELMAH_Error
.Select(e => new { e.User })
.Distinct()
.ToList();
//var setUser = dbFilt.Where(x => x.Cat == "User").ToList();
foreach (var item in setUser)
{
listUsers.Items.Add(item.User);
}
listApp.SelectedIndex = 0;
listHost.SelectedIndex = 0;
listStatus.SelectedIndex = 0;
listType.SelectedIndex = 0;
listUsers.SelectedIndex = 0;
}
private void checkFilterVisibility()
{
// Verifico TUTTI i filtri
listApp.Enabled = chkApp.Checked && listApp.Items.Count > 0;
listHost.Enabled = chkHost.Checked && listHost.Items.Count > 0;
listStatus.Enabled = chkStatus.Checked && listStatus.Items.Count > 0;
listType.Enabled = chkType.Checked && listType.Items.Count > 0;
listUsers.Enabled = chkUsers.Checked && listUsers.Items.Count > 0;
}
protected string selApp { get { return listApp.SelectedItem.ToString(); } }
protected string selStatus
{
get
{
string answ = "";
if (chkStatus.Checked)
{
if (listStatus.SelectedItem != null)
{
answ = listStatus.SelectedItem.ToString();
}
}
return answ;
}
}
protected string selHost { get { return listHost.SelectedItem.ToString(); } }
protected string selType { get { return listType.SelectedItem.ToString(); } }
protected string selUser { get { return listUsers.SelectedItem.ToString(); } }
private void updateSelection()
{
List<ELMAH_Error> subset = getFiltData();
this.bsErrors.DataSource = subset;
for (int i = 0; i < ErrorsDGV.Columns.Count - 1; i++)
{
ErrorsDGV.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
}
tsslNumRec.Text = $"{subset.Count} rec";
}
private List<ELMAH_Error> getFiltData()
{
var dbSet = model.ELMAH_Error;
int statusCode = 0;
int.TryParse(selStatus, out statusCode);
string selApp = listApp.SelectedItem.ToString();
// inizio azione filtraggio..
IQueryable<ELMAH_Error> subset = dbSet.Where(x => x.Sequence > 0);
if (chkApp.Checked)
{
subset = subset.Where(x => x.Application == selApp);
}
if (chkHost.Checked)
{
subset = subset.Where(x => x.Host == selHost);
}
if (chkStatus.Checked)
{
subset = subset.Where(x => x.StatusCode == statusCode);
}
if (chkType.Checked)
{
subset = subset.Where(x => x.Type == selType);
}
if (chkUsers.Checked)
{
subset = subset.Where(x => x.User == selUser);
}
return subset.OrderByDescending(x => x.TimeUtc).ToList();
}
/// <summary>
/// Aggiornamento visualizzazioni
/// </summary>
private void doUpdate()
{
checkFilterVisibility();
updateSelection();
}
private void deleteRecordFiltered()
{
// elimino 1:1 da selezione
foreach (var item in getFiltData())
{
model.ELMAH_Error.Remove(item);
}
// salvo
model.SaveChangesAsync();
// aggiorno!!
setupFilterData();
doUpdate();
}
private void deleteSelRows()
{
Guid ErrorId;
// SOLO SE selezionato in dgv...
if (ErrorsDGV.SelectedRows.Count > 0)
{
foreach (DataGridViewRow riga in ErrorsDGV.SelectedRows)
{
// chiudo!
ErrorId = ((ELMAH_Error)riga.DataBoundItem).ErrorId;
try
{
model.ELMAH_Error.Remove((ELMAH_Error)riga.DataBoundItem);
}
catch
{ }
}
}
// salvo
model.SaveChanges();
// aggiorno!!
doUpdate();
}
private void resetFilter()
{
chkApp.Checked = false;
chkHost.Checked = false;
chkStatus.Checked = false;
chkType.Checked = false;
chkUsers.Checked = false;
}
#endregion
#region area interazione
private void listApp_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkApp.Checked)
doUpdate();
}
private void listHost_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkHost.Checked)
doUpdate();
}
private void listStatus_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkStatus.Checked)
doUpdate();
}
private void listType_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkType.Checked)
doUpdate();
}
private void listUsers_SelectedIndexChanged(object sender, EventArgs e)
{
if (chkUsers.Checked)
doUpdate();
}
private void chkApp_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkType_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkStatus_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkHost_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void chkUsers_CheckedChanged(object sender, EventArgs e)
{
doUpdate();
}
private void ErrorsDGV_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
// seleziono riga
}
/// <summary>
/// Elimino record selezionati
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnDeleteSel_Click(object sender, EventArgs e)
{
deleteSelRows();
}
/// <summary>
/// Calcola path applicazione partendo da bassePath
/// </summary>
/// <param name="application"></param>
/// <returns></returns>
protected string getAppPath(string application)
{
return application.Replace(activeSetup.appBasePath, "");
}
private void ErrorsDGV_DoubleClick(object sender, EventArgs e)
{
// recupero valore...
Guid ErrorId;
string appPath = "";
string pageUrl = "";
// SOLO SE selezionato in dgv...
if (ErrorsDGV.SelectedRows.Count > 0)
{
foreach (DataGridViewRow riga in ErrorsDGV.SelectedRows)
{
// recupero dati
ErrorId = ((ELMAH_Error)riga.DataBoundItem).ErrorId;
appPath = getAppPath(((ELMAH_Error)riga.DataBoundItem).Application);
// SE appPAth !="" accodo...
if (!string.IsNullOrEmpty(appPath))
{
pageUrl = $"{activeSetup.baseUrl}/{appPath}/elmah.axd/detail?id={ErrorId}";
}
else
{
pageUrl = $"{activeSetup.baseUrl}/elmah.axd/detail?id={ErrorId}";
}
// mostro form
var newBrowser = new WBrowser();
newBrowser.pageUrl = pageUrl;
newBrowser.Show();
}
}
}
#endregion
}
}
-4686
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -16,7 +16,7 @@ namespace ELMA
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
Application.Run(new LogAnalyzer());
}
}
}