filtro num max eventi x evitare lock se > 10k

This commit is contained in:
Samuele E. Locatelli
2021-01-05 17:38:45 +01:00
parent 8fb844e83d
commit 4ddd67e722
2 changed files with 35 additions and 6 deletions
+23
View File
@@ -62,6 +62,8 @@
this.currentConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.txtMaxRow = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.ErrorsDGV)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsErrors)).BeginInit();
this.statusStrip1.SuspendLayout();
@@ -215,6 +217,8 @@
//
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.label1);
this.gboxFiltri.Controls.Add(this.txtMaxRow);
this.gboxFiltri.Controls.Add(this.btnDeleteSel);
this.gboxFiltri.Controls.Add(this.chkUsers);
this.gboxFiltri.Controls.Add(this.chkStatus);
@@ -407,6 +411,23 @@
this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// txtMaxRow
//
this.txtMaxRow.Location = new System.Drawing.Point(816, 31);
this.txtMaxRow.Name = "txtMaxRow";
this.txtMaxRow.Size = new System.Drawing.Size(80, 20);
this.txtMaxRow.TabIndex = 18;
this.txtMaxRow.Text = "1000";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(813, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 13);
this.label1.TabIndex = 19;
this.label1.Text = "Max Record";
//
// LogAnalyzer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -470,6 +491,8 @@
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem currentConfigToolStripMenuItem;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtMaxRow;
}
}
+12 -6
View File
@@ -41,10 +41,10 @@ namespace ELMA
activeSetup = new eSetup()
{
name = "standard",
userName="sa",
passwd="keyhammer16",
SSIP=false,
sqlServer= "SQL2016DEV",
userName = "sa",
passwd = "keyhammer16",
SSIP = false,
sqlServer = "SQL2016DEV",
appBasePath = "/LM/W3SVC/1/ROOT",
baseUrl = "https://localhost:44388"
};
@@ -107,7 +107,7 @@ namespace ELMA
{
// salvo la conf corrente...
SaveFileDialog sFileDialog = new SaveFileDialog();
sFileDialog.DefaultExt= "jset";
sFileDialog.DefaultExt = "jset";
sFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*";
sFileDialog.InitialDirectory = Utils.confDir;
sFileDialog.RestoreDirectory = true;
@@ -286,7 +286,13 @@ namespace ELMA
{
subset = subset.Where(x => x.User == selUser);
}
int maxRec = 100;
int.TryParse(txtMaxRow.Text, out maxRec);
// se + di maxRec --> filtro
if (subset.Count() > maxRec)
{
subset = subset.Take(maxRec);
}
return subset.OrderByDescending(x => x.TimeUtc).ToList();
}
/// <summary>