summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Aktywator/Bws.cs21
-rw-r--r--Aktywator/MainForm.cs13
2 files changed, 32 insertions, 2 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 3331ae0..dee1112 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -496,12 +496,29 @@ namespace Aktywator
else return 0;
}
+ private void clearRecords(string section)
+ {
+ sql.query("DELETE FROM HandRecord WHERE `Section` = " + section);
+ sql.query("DELETE FROM HandEvaluation WHERE `Section` = " + section);
+ }
+
+ public void clearHandRecords()
+ {
+ string sections = this.sectionsForHandRecords();
+ if (sections != null)
+ {
+ foreach (string section in this.sectionsForHandRecords().Split(','))
+ {
+ this.clearRecords(section.Trim());
+ }
+ }
+ }
+
public void loadHandRecords(PBN pbn)
{
- sql.query("DELETE FROM HandRecord");
- sql.query("DELETE FROM HandEvaluation");
foreach (string section in this.getSections().Split(','))
{
+ this.clearRecords(section);
for (int i = this.lowBoard(section.Trim()); i <= this.highBoard(section.Trim()); i++)
if (pbn.handRecords[i] != null)
{
diff --git a/Aktywator/MainForm.cs b/Aktywator/MainForm.cs
index f684e34..aa3a447 100644
--- a/Aktywator/MainForm.cs
+++ b/Aktywator/MainForm.cs
@@ -287,5 +287,18 @@ namespace Aktywator
}
}
+ private void bClearHands_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ bws.clearHandRecords();
+ MessageBox.Show("Wyczyszczono rozkłady", "Rozkłady wyczyszczone!", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Błąd czyszczenia rozkładów", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
}
}