Browse Source

Ajout de la modification du nombre de résultats après élimination

master
Maxime Wack 11 years ago
parent
commit
2db17c4b08
4 changed files with 39 additions and 30 deletions
  1. +8
    -4
      CosMoS/bdd.cpp
  2. +11
    -1
      CosMoS/resultats.cpp
  3. +3
    -2
      Sante_Pub.workspace
  4. +17
    -23
      Sante_Pub.workspace.session

+ 8
- 4
CosMoS/bdd.cpp View File

@@ -5,7 +5,7 @@ class_bdd::class_bdd(const wxString& path_in, wxGrid* grid)
this->path_in = path_in;
if (wxFileExists(path_in + slash + "db.lck"))
{
wxMessageBox(_T("La base est actuellement en cours d'utilisation\nSi vous êtes certains que ce n'est pas le cas,\nsupprimez le fichier db.lck situé dans le même répertoire"));
wxMessageBox(_T("La base est actuellement en cours d'utilisation.\nSi vous êtes certains que ce n'est pas le cas,\n(comme par exemple après un crash)\nsupprimez le fichier db.lck situé dans le même répertoire"));
exit(0);
}
this->grid = grid;
@@ -23,10 +23,8 @@ class_bdd::class_bdd(const wxString& path_in, wxGrid* grid)

class_bdd::~class_bdd()
{
rc = sqlite3_close(db); //check RC (busy ?)
sqlite3_close(db);
wxRemoveFile(path_in + slash + "db.lck");
if (rc == SQLITE_BUSY)
wxMessageBox("Busy");
}

void class_bdd::createEmpty(const wxString& path)
@@ -359,10 +357,16 @@ wxArrayString class_bdd::getidresult(const wxString& id, bool stripped)
void class_bdd::setidresult(const wxString& id, wxArrayString idresult)
{
wxString list = "";
int count = 0;
for (unsigned int i=0; i<idresult.GetCount(); i++)
{
list += idresult[i] + ",";
if (idresult[i].Left(1) != '!')
count++;
}
list = list.BeforeLast(',');
sqlite3_exec(db, "UPDATE Result SET id_result=\"" + list + "\" WHERE id=" + id + ";", NULL, NULL, NULL);
modnbresult(id, count);
}

void class_bdd::addidresult(const wxString& id, const wxString& idresult)


+ 11
- 1
CosMoS/resultats.cpp View File

@@ -37,7 +37,11 @@ void resultats::OnCheckPubli( wxCommandEvent& event )
void resultats::OnPrev( wxCommandEvent& event )
{
if (changed)
bdd->setidresult(grid->GetCellValue(currentrow, 13), list_publi);
{
wxString id = grid->GetCellValue(currentrow, 13);
bdd->setidresult(id, list_publi);
grid->SetCellValue(currentrow, 0, _itoW(bdd->nbresult(id)));
}
changed = false;
currentrow--;
update();
@@ -46,7 +50,10 @@ void resultats::OnPrev( wxCommandEvent& event )
void resultats::OnNext( wxCommandEvent& event )
{
if (changed)
{
bdd->setidresult(grid->GetCellValue(currentrow, 13), list_publi);
grid->SetCellValue(currentrow, 0, _itoW(bdd->nbresult(grid->GetCellValue(currentrow, 13))));
}
changed = false;
currentrow++;
update();
@@ -55,7 +62,10 @@ void resultats::OnNext( wxCommandEvent& event )
void resultats::OnOk( wxCommandEvent& event )
{
if (changed)
{
bdd->setidresult(grid->GetCellValue(currentrow, 13), list_publi);
grid->SetCellValue(currentrow, 0, _itoW(bdd->nbresult(grid->GetCellValue(currentrow, 13))));
}
changed = false;
Close();
}


+ 3
- 2
Sante_Pub.workspace View File

@@ -14,10 +14,11 @@
]]>
</Environment>
<BuildMatrix>
<WorkspaceConfiguration Name="Debug" Selected="no">
<WorkspaceConfiguration Name="Debug" Selected="yes">
<Project Name="COSMOS" ConfigName="Debug"/>
<Project Name="CosMoS" ConfigName="Debug"/>
<Project Name="grid" ConfigName="Debug"/>
@@ -31,7 +32,7 @@
<Project Name="testcurl" ConfigName="Release"/>
<Project Name="testsqlite" ConfigName="Release"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Debug_WIN" Selected="yes">
<WorkspaceConfiguration Name="Debug_WIN" Selected="no">
<Project Name="CosMoS" ConfigName="Debug_WIN"/>
<Project Name="grid" ConfigName="Debug_WIN"/>
<Project Name="testcurl" ConfigName="Debug_WIN"/>


+ 17
- 23
Sante_Pub.workspace.session View File

@@ -1,42 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<Session Name="C:\Projets\Sante_Pub.workspace">
<int Value="5" Name="m_selectedTab"/>
<wxString Value="C:\Projets\Sante_Pub.workspace" Name="m_workspaceName"/>
<?xml version="1.0" encoding="utf-8"?>
<Session Name="/home/satamaxx/Programmes/Sante_Pub/Sante_Pub.workspace">
<int Value="3" Name="m_selectedTab"/>
<wxString Value="/home/satamaxx/Programmes/Sante_Pub/Sante_Pub.workspace" Name="m_workspaceName"/>
<TabInfoArray Name="TabInfoArray">
<TabInfo>
<wxString Value="C:\Projets\CosMoS\misc.h" Name="FileName"/>
<int Value="0" Name="FirstVisibleLine"/>
<int Value="12" Name="CurrentLine"/>
<wxString Value="/home/satamaxx/Programmes/Sante_Pub/CosMoS/cosmos.cpp" Name="FileName"/>
<int Value="78" Name="FirstVisibleLine"/>
<int Value="98" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Projets\CosMoS\cosmos.h" Name="FileName"/>
<int Value="3" Name="FirstVisibleLine"/>
<int Value="32" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Projets\CosMoS\cosmos.cpp" Name="FileName"/>
<int Value="41" Name="FirstVisibleLine"/>
<int Value="61" Name="CurrentLine"/>
<wxString Value="/home/satamaxx/Programmes/Sante_Pub/CosMoS/resultats.h" Name="FileName"/>
<int Value="0" Name="FirstVisibleLine"/>
<int Value="0" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Projets\CosMoS\bdd.h" Name="FileName"/>
<int Value="2" Name="FirstVisibleLine"/>
<int Value="4" Name="CurrentLine"/>
<wxString Value="/home/satamaxx/Programmes/Sante_Pub/CosMoS/resultats.cpp" Name="FileName"/>
<int Value="24" Name="FirstVisibleLine"/>
<int Value="41" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Projets\CosMoS\bdd.cpp" Name="FileName"/>
<wxString Value="/home/satamaxx/Programmes/Sante_Pub/CosMoS/bdd.cpp" Name="FileName"/>
<int Value="0" Name="FirstVisibleLine"/>
<int Value="25" Name="CurrentLine"/>
<int Value="7" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Projets\CosMoS\resultats.cpp" Name="FileName"/>
<wxString Value="/home/satamaxx/Programmes/Sante_Pub/CosMoS/bdd.h" Name="FileName"/>
<int Value="0" Name="FirstVisibleLine"/>
<int Value="14" Name="CurrentLine"/>
<int Value="42" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
</TabInfoArray>


Loading…
Cancel
Save