|
@@ -588,20 +588,53 @@ BOOL CDatabase::QueryBrand(std::vector<STBranch>& vtBrand)
|
|
return TRUE;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
|
|
-BOOL CDatabase::ImportLogo(std::string brand, std::string file, BOOL bQuarter/*=FALSE*/)
|
|
|
|
|
|
+BOOL CDatabase::ImportBrandLogo(std::string brand, std::string file)
|
|
{
|
|
{
|
|
if (!PathFileExists(file.c_str()))
|
|
if (!PathFileExists(file.c_str()))
|
|
return FALSE;
|
|
return FALSE;
|
|
|
|
|
|
-
|
|
|
|
- return 0;
|
|
|
|
|
|
+ // ¶Á³öͼƬ;
|
|
|
|
+ CFile cfile;
|
|
|
|
+ if (!cfile.Open(file.c_str(), CFile::modeRead, NULL))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ ULONGLONG ulLength = cfile.GetLength();
|
|
|
|
+ char* pData = new char[ulLength];
|
|
|
|
+ cfile.Read(pData, ulLength);
|
|
|
|
+ cfile.Close();
|
|
|
|
+
|
|
|
|
+ TCHAR szSql[MAX_PATH] = {0};
|
|
|
|
+ _stprintf_s(szSql, _T("update brand set logo = ? where `name` = '%s'"), brand.c_str());
|
|
|
|
+
|
|
|
|
+ BOOL bResult = SetBinaryField(szSql, pData, ulLength);
|
|
|
|
+ if (pData)
|
|
|
|
+ delete[]pData;
|
|
|
|
+ pData = NULL;
|
|
|
|
+
|
|
|
|
+ return bResult;
|
|
}
|
|
}
|
|
|
|
|
|
-BOOL CDatabase::ExportLogo(std::string brand, std::string file, BOOL bQuarter/*=FALSE*/)
|
|
|
|
|
|
+BOOL CDatabase::ExportBrandLogo(std::string brand, std::string file)
|
|
{
|
|
{
|
|
|
|
+ char* pData = NULL;
|
|
|
|
+ unsigned long ulLength = 0;
|
|
|
|
+ TCHAR szSql[MAX_PATH] = {0};
|
|
|
|
+ _stprintf_s(szSql, _T("select logo from brand where `name`='%s';"), brand.c_str());
|
|
|
|
+ BOOL bResult = GetBinaryField(szSql, (void**)&pData, ulLength);
|
|
|
|
+ if (bResult && pData)
|
|
|
|
+ {
|
|
|
|
+ CFile cfile;
|
|
|
|
+ if (cfile.Open(file.c_str(), CFile::modeCreate | CFile::modeWrite))
|
|
|
|
+ {
|
|
|
|
+ cfile.Write(pData, ulLength);
|
|
|
|
+ cfile.Close();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ delete[]pData;
|
|
|
|
+ pData = NULL;
|
|
|
|
+ }
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
+ return bResult;
|
|
}
|
|
}
|
|
|
|
|
|
BOOL CDatabase::InsertQuarter(const STQuarter& quarter)
|
|
BOOL CDatabase::InsertQuarter(const STQuarter& quarter)
|
|
@@ -1199,6 +1232,55 @@ BOOL CDatabase::QueryQBrand(std::vector<STQbrand>& vtQBrand)
|
|
return TRUE;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+BOOL CDatabase::ImportQBrandLogo(std::string file, std::string brand, std::string soc, std::string quarter)
|
|
|
|
+{
|
|
|
|
+ if (!PathFileExists(file.c_str()))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ // ¶Á³öͼƬ;
|
|
|
|
+ CFile cfile;
|
|
|
|
+ if (!cfile.Open(file.c_str(), CFile::modeRead, NULL))
|
|
|
|
+ return FALSE;
|
|
|
|
+
|
|
|
|
+ ULONGLONG ulLength = cfile.GetLength();
|
|
|
|
+ char* pData = new char[ulLength];
|
|
|
|
+ cfile.Read(pData, ulLength);
|
|
|
|
+ cfile.Close();
|
|
|
|
+
|
|
|
|
+ TCHAR szSql[MAX_PATH] = { 0 };
|
|
|
|
+ _stprintf_s(szSql, _T("update qbrand set logo = ? where `soc` = '%s' and `quarter`='%s' and `brand`='%s';"), soc.c_str(), quarter.c_str(), brand.c_str());
|
|
|
|
+
|
|
|
|
+ BOOL bResult = SetBinaryField(szSql, pData, ulLength);
|
|
|
|
+ if (pData)
|
|
|
|
+ delete[]pData;
|
|
|
|
+ pData = NULL;
|
|
|
|
+
|
|
|
|
+ return bResult;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+BOOL CDatabase::ExportQBrandLogo(std::string file, std::string brand, std::string soc, std::string quarter)
|
|
|
|
+{
|
|
|
|
+ char* pData = NULL;
|
|
|
|
+ unsigned long ulLength = 0;
|
|
|
|
+ TCHAR szSql[MAX_PATH] = { 0 };
|
|
|
|
+ _stprintf_s(szSql, _T("select logo from qbrand where `soc` = '%s' and `quarter`='%s' and `brand`='%s';"), soc.c_str(), quarter.c_str(), brand.c_str());
|
|
|
|
+ BOOL bResult = GetBinaryField(szSql, (void**)&pData, ulLength);
|
|
|
|
+ if (bResult && pData)
|
|
|
|
+ {
|
|
|
|
+ CFile cfile;
|
|
|
|
+ if (cfile.Open(file.c_str(), CFile::modeCreate | CFile::modeWrite))
|
|
|
|
+ {
|
|
|
|
+ cfile.Write(pData, ulLength);
|
|
|
|
+ cfile.Close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ delete[]pData;
|
|
|
|
+ pData = NULL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return bResult;
|
|
|
|
+}
|
|
|
|
+
|
|
// ʾÀý;
|
|
// ʾÀý;
|
|
void test(MYSQL* mysql)
|
|
void test(MYSQL* mysql)
|
|
{
|
|
{
|