Add DB presence check button to import phase
Lets the user spot missing components right after import instead of discovering it later in the raw-folder step, by coloring each grid row green/red based on a lookup against cad_index.db. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f28cb818bd
commit
b77ec39c5b
1 file changed
+22
@@ -10,6 +10,7 @@ public partial class Form1 : Form
|
|||||||
private readonly Button _btnCreaRaw = new();
|
private readonly Button _btnCreaRaw = new();
|
||||||
private readonly Button _btnTrovaPrt = new();
|
private readonly Button _btnTrovaPrt = new();
|
||||||
private readonly Button _btnReport = new();
|
private readonly Button _btnReport = new();
|
||||||
|
private readonly Button _btnVerifica = new();
|
||||||
private readonly Button _btnCompletezza = new();
|
private readonly Button _btnCompletezza = new();
|
||||||
private readonly Button _btnPulisci = new();
|
private readonly Button _btnPulisci = new();
|
||||||
private readonly Label _lblStatus = new();
|
private readonly Label _lblStatus = new();
|
||||||
@@ -261,6 +262,12 @@ public partial class Form1 : Form
|
|||||||
btnSfoglia.Click += (_, _) => ScegliFileDistinta();
|
btnSfoglia.Click += (_, _) => ScegliFileDistinta();
|
||||||
contenuto.Controls.Add(btnSfoglia);
|
contenuto.Controls.Add(btnSfoglia);
|
||||||
|
|
||||||
|
_btnVerifica.Text = "Verifica presenza nel DB";
|
||||||
|
_btnVerifica.Size = new Size(220, 32);
|
||||||
|
_btnVerifica.Margin = new Padding(0, 0, 0, 8);
|
||||||
|
_btnVerifica.Click += (_, _) => VerificaCodiciNelDb();
|
||||||
|
contenuto.Controls.Add(_btnVerifica);
|
||||||
|
|
||||||
_lblImportStatus.AutoSize = false;
|
_lblImportStatus.AutoSize = false;
|
||||||
_lblImportStatus.AutoEllipsis = true;
|
_lblImportStatus.AutoEllipsis = true;
|
||||||
_lblImportStatus.Height = 24;
|
_lblImportStatus.Height = 24;
|
||||||
@@ -488,6 +495,21 @@ public partial class Form1 : Form
|
|||||||
_tipImportStatus.SetToolTip(_lblImportStatus, testo);
|
_tipImportStatus.SetToolTip(_lblImportStatus, testo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void VerificaCodiciNelDb()
|
||||||
|
{
|
||||||
|
if (_righeCorrenti is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var trovati = TrovaPercorsiCad(_righeCorrenti.Select(r => r.Componente));
|
||||||
|
foreach (DataGridViewRow riga in _gridImport.Rows)
|
||||||
|
{
|
||||||
|
string componente = (string)riga.Cells["componente"].Value!;
|
||||||
|
riga.DefaultCellStyle.BackColor = trovati.ContainsKey(componente)
|
||||||
|
? Color.FromArgb(198, 239, 206)
|
||||||
|
: Color.FromArgb(255, 199, 206);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CreaCartellaRaw()
|
private void CreaCartellaRaw()
|
||||||
{
|
{
|
||||||
if (_percorsoInputCorrente is null || _righeCorrenti is null)
|
if (_percorsoInputCorrente is null || _righeCorrenti is null)
|
||||||
|
|||||||
Reference in new issue
Block a user