Compare commits
No commits in common. "847e8aa8babb32b9d47eff2549ed98f7fcdd5dea" and "acc8408b0aec794e47ac9eea45885455b834e6d8" have entirely different histories.
847e8aa8ba
...
acc8408b0a
4 changed files with 5 additions and 21 deletions
|
@ -25,7 +25,7 @@ void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace*
|
||||||
file << root.dump(4) << std::endl;
|
file << root.dump(4) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market)
|
void JsonUtil::importSellers(const std::filesystem::path& filePath, Marketplace* market)
|
||||||
{
|
{
|
||||||
for (auto& seller : market->getSellers()) {
|
for (auto& seller : market->getSellers()) {
|
||||||
seller->setState(Seller::State::DELETE);
|
seller->setState(Seller::State::DELETE);
|
||||||
|
@ -56,9 +56,8 @@ std::size_t JsonUtil::importSellers(const std::filesystem::path& filePath, Marke
|
||||||
}
|
}
|
||||||
|
|
||||||
market->sortSellers();
|
market->sortSellers();
|
||||||
market->storeToDb();
|
|
||||||
|
|
||||||
return market->getSellers().size() - 1; // minus 1 because we don't count the "special" seller
|
market->storeToDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo)
|
void JsonUtil::exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo)
|
||||||
|
|
|
@ -10,7 +10,7 @@ class JsonUtil
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void exportSellers(const std::filesystem::path& filePath, Marketplace* market);
|
static void exportSellers(const std::filesystem::path& filePath, Marketplace* market);
|
||||||
static std::size_t importSellers(const std::filesystem::path& filePath, Marketplace* market);
|
static void importSellers(const std::filesystem::path& filePath, Marketplace* market);
|
||||||
static void exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
|
static void exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
|
||||||
static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
|
static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo);
|
||||||
};
|
};
|
||||||
|
|
|
@ -508,18 +508,8 @@ void MainWindow::onImportSellerJsonActionTriggered()
|
||||||
fs::path filePath(filename.toStdString());
|
fs::path filePath(filename.toStdString());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::size_t numImported{};
|
JsonUtil::importSellers(filePath, marketplace_.get());
|
||||||
numImported = JsonUtil::importSellers(filePath, marketplace_.get());
|
|
||||||
|
|
||||||
updateStatLabel();
|
updateStatLabel();
|
||||||
|
|
||||||
using namespace std::string_literals;
|
|
||||||
std::ostringstream msg;
|
|
||||||
msg << "Aus der JSON-Datei wurden <b>"s << std::to_string(numImported)
|
|
||||||
<< "</b> Verkäufer importiert.";
|
|
||||||
QMessageBox(QMessageBox::Icon::Information, "Verkäufer erfolgreich importiert",
|
|
||||||
msg.str().c_str(), QMessageBox::StandardButton::Ok, this)
|
|
||||||
.exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onExportSellerJsonActionTriggered()
|
void MainWindow::onExportSellerJsonActionTriggered()
|
||||||
|
@ -530,11 +520,7 @@ void MainWindow::onExportSellerJsonActionTriggered()
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(_WIN64) || defined(_WIN32)
|
|
||||||
fs::path filePath(filename.toStdWString());
|
fs::path filePath(filename.toStdWString());
|
||||||
#else
|
|
||||||
fs::path filePath(filename.toStdString());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonUtil::exportSellers(filePath, marketplace_.get());
|
JsonUtil::exportSellers(filePath, marketplace_.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,7 @@ void SellerDialog::on_deleteButton_clicked()
|
||||||
|
|
||||||
auto dlgResult =
|
auto dlgResult =
|
||||||
QMessageBox(QMessageBox::Icon::Warning, "Sind Sie sicher?",
|
QMessageBox(QMessageBox::Icon::Warning, "Sind Sie sicher?",
|
||||||
"Löschen wirkt sich <b>sofort</b> auf die Datenbank aus. Sie können den "
|
"Löschen wirkt sich direkt auf die Datenbank aus. Möchten Sie fortfahren?",
|
||||||
"Vorgang nicht rückgängig machen. Möchten Sie fortfahren?",
|
|
||||||
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, this)
|
QMessageBox::StandardButton::Yes | QMessageBox::StandardButton::No, this)
|
||||||
.exec();
|
.exec();
|
||||||
if (dlgResult == QMessageBox::No)
|
if (dlgResult == QMessageBox::No)
|
||||||
|
|
Loading…
Reference in a new issue