...
This commit is contained in:
parent
a9dce57cf3
commit
dedb1e0b34
@ -17,6 +17,7 @@
|
|||||||
<ResourceCompile Include="..\..\..\source\car_dealer_util.rc" />
|
<ResourceCompile Include="..\..\..\source\car_dealer_util.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\source\data\AppParameters\AppParameters.cpp" />
|
||||||
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.cpp" />
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.cpp" />
|
||||||
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.cpp" />
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.cpp" />
|
||||||
<ClCompile Include="..\..\..\source\Data\DataManipulation\oracle\ImportToOracle.cpp" />
|
<ClCompile Include="..\..\..\source\Data\DataManipulation\oracle\ImportToOracle.cpp" />
|
||||||
@ -44,6 +45,7 @@
|
|||||||
<QtMoc Include="..\..\..\source\Widgets\MainFrame\QMainFrame.h" />
|
<QtMoc Include="..\..\..\source\Widgets\MainFrame\QMainFrame.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\source\data\AppParameters\AppParameters.h" />
|
||||||
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.h" />
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.h" />
|
||||||
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.h" />
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.h" />
|
||||||
<ClInclude Include="..\..\..\source\Data\DataManipulation\oracle\ImportToOracle.h" />
|
<ClInclude Include="..\..\..\source\Data\DataManipulation\oracle\ImportToOracle.h" />
|
||||||
|
@ -80,6 +80,9 @@
|
|||||||
<Filter Include="数据\数据结构\用户信息">
|
<Filter Include="数据\数据结构\用户信息">
|
||||||
<UniqueIdentifier>{f51a3f4d-ff6f-4590-b123-b61afde72f0a}</UniqueIdentifier>
|
<UniqueIdentifier>{f51a3f4d-ff6f-4590-b123-b61afde72f0a}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="数据\全局对象">
|
||||||
|
<UniqueIdentifier>{7f951e1f-a198-4833-bbec-853de77c8cfe}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\source\main.cpp">
|
<ClCompile Include="..\..\..\source\main.cpp">
|
||||||
@ -127,6 +130,9 @@
|
|||||||
<ClCompile Include="..\..\..\source\data\Datastructure\UserInfo\UserInfo.cpp">
|
<ClCompile Include="..\..\..\source\data\Datastructure\UserInfo\UserInfo.cpp">
|
||||||
<Filter>数据\数据结构\用户信息</Filter>
|
<Filter>数据\数据结构\用户信息</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\source\data\AppParameters\AppParameters.cpp">
|
||||||
|
<Filter>数据\全局对象</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="..\..\..\source\resource.qrc">
|
<QtRcc Include="..\..\..\source\resource.qrc">
|
||||||
@ -196,5 +202,8 @@
|
|||||||
<ClInclude Include="..\..\..\source\data\Datastructure\UserInfo\UserInfo.h">
|
<ClInclude Include="..\..\..\source\data\Datastructure\UserInfo\UserInfo.h">
|
||||||
<Filter>数据\数据结构\用户信息</Filter>
|
<Filter>数据\数据结构\用户信息</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\source\data\AppParameters\AppParameters.h">
|
||||||
|
<Filter>数据\全局对象</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
#include "AppParameters.h"
|
||||||
|
|
||||||
|
UserInfo * pStaffInfo = nullptr;
|
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "../Datastructure/UserInfo/UserInfo.h"
|
||||||
|
|
||||||
|
extern UserInfo * pStaffInfo;
|
@ -21,12 +21,12 @@ UserInfo queryUserInfo( const string & userName,
|
|||||||
int returnCode = 0;
|
int returnCode = 0;
|
||||||
|
|
||||||
|
|
||||||
otext szSqlQueryStaff[] =
|
string sqlQueryStaff =
|
||||||
"SELECT a.staff_p13, a.staff_name, b.staff_post \n"
|
"SELECT a.staff_p13, a.staff_name, b.staff_post \n"
|
||||||
"FROM staff_info a, \n"
|
"FROM staff_info a, \n"
|
||||||
"staff_post_code b \n"
|
"staff_post_code b \n"
|
||||||
"WHERE a.staff_post_code = b.staff_post_code \n"
|
"WHERE a.staff_post_code = b.staff_post_code \n"
|
||||||
"AND a.staff_p13 = :p13 ";
|
"AND a.staff_p13 = :p13";
|
||||||
|
|
||||||
returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT );
|
returnCode = OCI_Initialize( l_error_handler, nullptr, OCI_ENV_DEFAULT );
|
||||||
|
|
||||||
@ -56,16 +56,16 @@ UserInfo queryUserInfo( const string & userName,
|
|||||||
{
|
{
|
||||||
pStmt = OCI_StatementCreate( pConn );
|
pStmt = OCI_StatementCreate( pConn );
|
||||||
|
|
||||||
|
OCI_Prepare(pStmt, sqlQueryStaff.c_str());
|
||||||
OCI_AllowRebinding( pStmt, true );
|
OCI_AllowRebinding( pStmt, true );
|
||||||
OCI_Prepare( pStmt, szSqlQueryStaff );
|
|
||||||
|
|
||||||
OCI_BindString( pStmt, ":p13", const_cast<otext*>(staffP13.c_str()), staffP13.size() );
|
OCI_BindString( pStmt, ":p13", const_cast<otext*>(staffP13.c_str()), staffP13.size() );
|
||||||
|
|
||||||
OCI_Execute( pStmt );
|
OCI_Execute( pStmt );
|
||||||
|
|
||||||
pResult = OCI_GetResultset( pStmt );
|
pResult = OCI_GetResultset( pStmt );
|
||||||
|
|
||||||
//检查结果集,如果没有返回,则说明没有此用户
|
//检查结果集,如果没有返回,则说明没有此用户
|
||||||
if ( OCI_FetchFirst( pResult ) == false )
|
if ( OCI_FetchNext( pResult ) == false )
|
||||||
{
|
{
|
||||||
throw runtime_error( "用户不存在!" );
|
throw runtime_error( "用户不存在!" );
|
||||||
}
|
}
|
||||||
|
@ -2,4 +2,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "../Datastructure/UserInfo/UserInfo.h"
|
||||||
|
|
||||||
|
UserInfo queryUserInfo( const std::string & userName,
|
||||||
|
const std::string & password,
|
||||||
|
const std::string & tnsName,
|
||||||
|
const std::string & staffP13 );
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
#include "QLoginDialog.h"
|
#include <iostream>
|
||||||
|
#include "QLoginDialog.h"
|
||||||
#include "../../system/system_util.h"
|
#include "../../system/system_util.h"
|
||||||
|
#include "../../data/Datastructure/UserInfo/UserInfo.h"
|
||||||
|
#include "../../data/query/query_user.h"
|
||||||
|
#include "../../data/AppParameters/AppParameters.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
QLoginDialog::QLoginDialog( QWidget * parent )
|
QLoginDialog::QLoginDialog( QWidget * parent )
|
||||||
: QDialog( parent )
|
: QDialog( parent )
|
||||||
@ -24,26 +31,40 @@ void QLoginDialog::initData()
|
|||||||
{
|
{
|
||||||
returnCode = EXIT;
|
returnCode = EXIT;
|
||||||
|
|
||||||
systemUserName = QString::fromStdWString(getUserName());
|
systemUserName = QString::fromStdWString( getUserName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QLoginDialog::initSignal()
|
void QLoginDialog::initSignal()
|
||||||
{
|
{
|
||||||
connect(ui.pButtonOK, SIGNAL(clicked()), this, SLOT(onOK()));
|
connect( ui.pButtonOK, SIGNAL( clicked() ), this, SLOT( onOK() ) );
|
||||||
connect(ui.pButtonExit, SIGNAL(clicked()), this, SLOT(onExit()));
|
connect( ui.pButtonExit, SIGNAL( clicked() ), this, SLOT( onExit() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QLoginDialog::initWidgets()
|
void QLoginDialog::initWidgets()
|
||||||
{
|
{
|
||||||
setLayout( ui.pLayoutMain );
|
setLayout( ui.pLayoutMain );
|
||||||
|
|
||||||
ui.pEditSystemUserName->setText(systemUserName);
|
ui.pEditSystemUserName->setText( systemUserName );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
queryStaffInfo( systemUserName );
|
||||||
|
}
|
||||||
|
catch ( runtime_error & error )
|
||||||
|
{
|
||||||
|
//如果出现异常,就不让用户继续登录
|
||||||
|
QMessageBox::critical( nullptr,
|
||||||
|
"错误,请联系管理员!",
|
||||||
|
QString::fromLocal8Bit( error.what() ) );
|
||||||
|
|
||||||
|
ui.pButtonOK->setEnabled( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QLoginDialog::onOK()
|
void QLoginDialog::onOK()
|
||||||
{
|
{
|
||||||
returnCode = OK;
|
returnCode = OK;
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,3 +74,19 @@ void QLoginDialog::onExit()
|
|||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QLoginDialog::queryStaffInfo( const QString & systemUserName )
|
||||||
|
{
|
||||||
|
string userName = "car_dealer";
|
||||||
|
string password = "cpic123456";
|
||||||
|
string tnsName = "xmcx1";
|
||||||
|
|
||||||
|
string staffP13 = systemUserName.toLocal8Bit();
|
||||||
|
|
||||||
|
UserInfo && info = queryUserInfo( userName,
|
||||||
|
password,
|
||||||
|
tnsName,
|
||||||
|
staffP13 );
|
||||||
|
|
||||||
|
pStaffInfo = new UserInfo( info );
|
||||||
|
}
|
||||||
|
@ -27,6 +27,9 @@ protected Q_SLOTS:
|
|||||||
void onOK();
|
void onOK();
|
||||||
void onExit();
|
void onExit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void queryStaffInfo( const QString & systemUserName );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::QLoginDialog ui;
|
Ui::QLoginDialog ui;
|
||||||
ReturnCode returnCode;
|
ReturnCode returnCode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user