105 lines
2.6 KiB
C++
105 lines
2.6 KiB
C++
#include "Deals.hpp"
|
|
#include <string>
|
|
#include <cstdlib>
|
|
#include "PrintFile.hpp"
|
|
#include "common.hpp"
|
|
#include "ExecCommand.hpp"
|
|
#include "json.hpp"
|
|
#include "base64.h"
|
|
#include <fstream>
|
|
#include "cleanHtml.h"
|
|
#include <sstream>
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int Deals::HelpCreate() const {
|
|
if (isRussian)
|
|
PrintFile(DEALS_RU);
|
|
else
|
|
PrintFile(DEALS_EN);
|
|
return 0;
|
|
}
|
|
int Deals::HelpDealStatus() const
|
|
{
|
|
if (isRussian)
|
|
PrintFile(DEAL_STATUS_RU);
|
|
else
|
|
PrintFile(DEAL_STATUS_EN);
|
|
return 0;
|
|
}
|
|
int Deals::HelpDealComplete() const
|
|
{
|
|
if (isRussian)
|
|
PrintFile(DEAL_COMPLETE_RU);
|
|
else
|
|
PrintFile(DEAL_COMPLETE_EN);
|
|
return 0;
|
|
}
|
|
int Deals::HelpDealCancel() const
|
|
{
|
|
if (isRussian)
|
|
PrintFile(DEAL_CANCEL_RU);
|
|
else
|
|
PrintFile(DEAL_CANCEL_EN);
|
|
return 0;
|
|
|
|
}
|
|
int Deals::HelpDealNegative() const
|
|
{
|
|
if (isRussian)
|
|
PrintFile(DEAL_NEGATIVE_RU);
|
|
else
|
|
PrintFile(DEAL_NEGATIVE_EN);
|
|
return 0;
|
|
}
|
|
Deals::Deals(const InputParser& parser, const bool isRussian, const string address, bool isDebug)
|
|
{
|
|
this->parser = parser;
|
|
this->isRussian = isRussian;
|
|
this->address = address;
|
|
this->isDebug = isDebug;
|
|
}
|
|
|
|
int Deals::Process()
|
|
{
|
|
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("create") && this->parser.cmdOptionExists("--help"))
|
|
return this->HelpCreate();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("status") && this->parser.cmdOptionExists("--help"))
|
|
return this->HelpDealStatus();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("complete") && this->parser.cmdOptionExists("--help"))
|
|
return this->HelpDealComplete();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("cancel") && this->parser.cmdOptionExists("--help"))
|
|
return this->HelpDealCancel();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("negative") && this->parser.cmdOptionExists("--help"))
|
|
return this->HelpDealNegative();
|
|
|
|
|
|
return Update();
|
|
return 0;
|
|
}
|
|
|
|
int Deals::Update() {
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("create"))
|
|
return Create();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("status"))
|
|
return Status();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("complete"))
|
|
return Complite();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("cancel"))
|
|
return Cancel();
|
|
if (parser.cmdOptionExists("deal") && this->parser.cmdOptionExists("negative"))
|
|
return Negative();
|
|
return 1;
|
|
}
|
|
int Deals::Create() {
|
|
return 0;
|
|
}
|
|
|
|
|
|
int Deals::Status() { return 0; }
|
|
int Deals::Complite() { return 0; }
|
|
int Deals::Cancel() { return 0; }
|
|
int Deals::Negative() { return 0; }
|