...
This commit is contained in:
parent
a9dce57cf3
commit
dedb1e0b34
@ -17,6 +17,7 @@
|
||||
<ResourceCompile Include="..\..\..\source\car_dealer_util.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\source\data\AppParameters\AppParameters.cpp" />
|
||||
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.cpp" />
|
||||
<ClCompile Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.cpp" />
|
||||
<ClCompile Include="..\..\..\source\Data\DataManipulation\oracle\ImportToOracle.cpp" />
|
||||
@ -44,6 +45,7 @@
|
||||
<QtMoc Include="..\..\..\source\Widgets\MainFrame\QMainFrame.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\source\data\AppParameters\AppParameters.h" />
|
||||
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\ExportToExcel.h" />
|
||||
<ClInclude Include="..\..\..\source\Data\DataManipulation\Excel\LoadFromExcel.h" />
|
||||
<ClInclude Include="..\..\..\source\Data\DataManipulation\oracle\ImportToOracle.h" />
|
||||
|
@ -80,6 +80,9 @@
|
||||
<Filter Include="数据\数据结构\用户信息">
|
||||
<UniqueIdentifier>{f51a3f4d-ff6f-4590-b123-b61afde72f0a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="数据\全局对象">
|
||||
<UniqueIdentifier>{7f951e1f-a198-4833-bbec-853de77c8cfe}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\source\main.cpp">
|
||||
@ -127,6 +130,9 @@
|
||||
<ClCompile Include="..\..\..\source\data\Datastructure\UserInfo\UserInfo.cpp">
|
||||
<Filter>数据\数据结构\用户信息</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\source\data\AppParameters\AppParameters.cpp">
|
||||
<Filter>数据\全局对象</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="..\..\..\source\resource.qrc">
|
||||
@ -196,5 +202,8 @@
|
||||
<ClInclude Include="..\..\..\source\data\Datastructure\UserInfo\UserInfo.h">
|
||||
<Filter>数据\数据结构\用户信息</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\source\data\AppParameters\AppParameters.h">
|
||||
<Filter>数据\全局对象</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</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,7 +21,7 @@ UserInfo queryUserInfo( const string & userName,
|
||||
int returnCode = 0;
|
||||
|
||||
|
||||
otext szSqlQueryStaff[] =
|
||||
string sqlQueryStaff =
|
||||
"SELECT a.staff_p13, a.staff_name, b.staff_post \n"
|
||||
"FROM staff_info a, \n"
|
||||
"staff_post_code b \n"
|
||||
@ -56,16 +56,16 @@ UserInfo queryUserInfo( const string & userName,
|
||||
{
|
||||
pStmt = OCI_StatementCreate( pConn );
|
||||
|
||||
OCI_Prepare(pStmt, sqlQueryStaff.c_str());
|
||||
OCI_AllowRebinding( pStmt, true );
|
||||
OCI_Prepare( pStmt, szSqlQueryStaff );
|
||||
|
||||
OCI_BindString( pStmt, ":p13", const_cast<otext*>(staffP13.c_str()), staffP13.size() );
|
||||
|
||||
OCI_Execute( pStmt );
|
||||
|
||||
pResult = OCI_GetResultset( pStmt );
|
||||
|
||||
//检查结果集,如果没有返回,则说明没有此用户
|
||||
if ( OCI_FetchFirst( pResult ) == false )
|
||||
if ( OCI_FetchNext( pResult ) == false )
|
||||
{
|
||||
throw runtime_error( "用户不存在!" );
|
||||
}
|
||||
|
@ -2,4 +2,9 @@
|
||||
#pragma once
|
||||
|
||||
#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 "../../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 )
|
||||
: QDialog( parent )
|
||||
@ -38,6 +45,20 @@ void QLoginDialog::initWidgets()
|
||||
setLayout( ui.pLayoutMain );
|
||||
|
||||
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()
|
||||
@ -53,3 +74,19 @@ void QLoginDialog::onExit()
|
||||
|
||||
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 onExit();
|
||||
|
||||
private:
|
||||
void queryStaffInfo( const QString & systemUserName );
|
||||
|
||||
private:
|
||||
Ui::QLoginDialog ui;
|
||||
ReturnCode returnCode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user