一点点重构
This commit is contained in:
		@@ -433,9 +433,9 @@ void QueryPolicyGifts(const string& strPolicyNo, string& strGifts, double dGiftP
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		policy.strOperatorCode = getUserCode();
 | 
							policy.strOperatorCode = getUserCode();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		queryAutoTraderInfo( policy.strAutoTraderCode, policy.strAutoTraderName );
 | 
							query_auto_trader_info( policy.strAutoTraderCode, policy.strAutoTraderName );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		queryStaffInfo( policy.strSalerCode, 
 | 
							query_staff_info( policy.strSalerCode, 
 | 
				
			||||||
			            policy.strSalerName, 
 | 
								            policy.strSalerName, 
 | 
				
			||||||
						policy.strSalerDeptCode,
 | 
											policy.strSalerDeptCode,
 | 
				
			||||||
						policy.strSalerDeptName,
 | 
											policy.strSalerDeptName,
 | 
				
			||||||
@@ -582,7 +582,7 @@ void readTelsaleXlsxFile(const wstring& filePath, vector<SPolicyRecord>& listPol
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		policy.strOperatorCode = getUserCode();
 | 
							policy.strOperatorCode = getUserCode();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		queryStaffInfo(
 | 
							query_staff_info(
 | 
				
			||||||
		               policy.strSalerCode,
 | 
							               policy.strSalerCode,
 | 
				
			||||||
		               policy.strSalerName,
 | 
							               policy.strSalerName,
 | 
				
			||||||
		               policy.strSalerDeptCode,
 | 
							               policy.strSalerDeptCode,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ void QConfigurationWidget::onAutoTraderCodeEdited()
 | 
				
			|||||||
	string strAutoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
 | 
						string strAutoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
 | 
				
			||||||
	string strAutoTraderName;
 | 
						string strAutoTraderName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	queryAutoTraderInfo( strAutoTraderCode, strAutoTraderName );
 | 
						query_auto_trader_info( strAutoTraderCode, strAutoTraderName );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pEditAutoTraderName->setText( QString::fromLocal8Bit( strAutoTraderName.c_str() ));
 | 
						pEditAutoTraderName->setText( QString::fromLocal8Bit( strAutoTraderName.c_str() ));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,3 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
//#include <occi.h>
 | 
					//#include <occi.h>
 | 
				
			||||||
//#include <QTextCodec>
 | 
					//#include <QTextCodec>
 | 
				
			||||||
#include <QtWidgets/QMessageBox>
 | 
					#include <QtWidgets/QMessageBox>
 | 
				
			||||||
@@ -6,17 +5,16 @@
 | 
				
			|||||||
#include "SystemData.h"
 | 
					#include "SystemData.h"
 | 
				
			||||||
#include "SystemDataQuery.h"
 | 
					#include "SystemDataQuery.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QLoginWidget::QLoginWidget(QWidget *parent)
 | 
					QLoginWidget::QLoginWidget( QWidget * parent )
 | 
				
			||||||
	: QDialog(parent)
 | 
						: QDialog( parent )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ui.setupUi(this);
 | 
						ui.setupUi( this );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	init();
 | 
						init();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QLoginWidget::~QLoginWidget()
 | 
					QLoginWidget::~QLoginWidget()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QLoginWidget::init()
 | 
					void QLoginWidget::init()
 | 
				
			||||||
@@ -24,10 +22,7 @@ void QLoginWidget::init()
 | 
				
			|||||||
	initWidget();
 | 
						initWidget();
 | 
				
			||||||
	initSignal();
 | 
						initSignal();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//pCodecLocal = QTextCodec::codecForLocale();
 | 
						doesLoginSuccess = false;
 | 
				
			||||||
	//pCodecUTF8 = QTextCodec::codecForName( "UTF-8" );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	m_isLoginSuccess = false;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QLoginWidget::initWidget()
 | 
					void QLoginWidget::initWidget()
 | 
				
			||||||
@@ -42,45 +37,50 @@ void QLoginWidget::initSignal()
 | 
				
			|||||||
	connect( ui.pEditUserCode, SIGNAL(editingFinished()), this, SLOT(getUserName()) );
 | 
						connect( ui.pEditUserCode, SIGNAL(editingFinished()), this, SLOT(getUserName()) );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QLoginWidget::login()
 | 
					void QLoginWidget::onLogin()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	string strPassword( (char *)ui.pEditPassword->text().toLocal8Bit().data() );
 | 
						string strPassword( static_cast<char *>(ui.pEditPassword->text().toLocal8Bit().data()) );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ( strPassword == m_userPassword )
 | 
						if ( strPassword == userPassword )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		m_isLoginSuccess = true;
 | 
							doesLoginSuccess = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//保存用户名和密码
 | 
							//保存用户名和密码
 | 
				
			||||||
		setUserCode( m_userCode );
 | 
							setUserCode( userCode );
 | 
				
			||||||
		setUserName( m_userName );
 | 
							setUserName( userName );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		close();
 | 
							close();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		QMessageBox::warning( this, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("密码错误!") );
 | 
							QMessageBox::warning( this, QString::fromLocal8Bit( "错误" ), QString::fromLocal8Bit( "密码错误!" ) );
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QLoginWidget::cancel()
 | 
					void QLoginWidget::onCancel()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	m_isLoginSuccess = false;
 | 
						doesLoginSuccess = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	close();
 | 
						close();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QLoginWidget::getUserName()
 | 
					void QLoginWidget::onQueryUserInfo()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	m_userCode = ui.pEditUserCode->text().toLocal8Bit().data();
 | 
						userCode = ui.pEditUserCode->text().toLocal8Bit().data();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	try
 | 
						try
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		QueryUserInfo( m_userCode, m_userName, m_userPassword );
 | 
							//根据用户填入的工号,查询名称和密码
 | 
				
			||||||
 | 
							query_user_info( userCode,
 | 
				
			||||||
 | 
							               userName,
 | 
				
			||||||
 | 
							               userPassword );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ui.pEditUserName->setText( QString::fromLocal8Bit(m_userName.c_str()));
 | 
							ui.pEditUserName->setText( QString::fromLocal8Bit( userName.c_str() ) );
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	catch ( runtime_error & exp )
 | 
						catch ( runtime_error & error )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		QMessageBox::critical( this, "错误", QString::fromUtf8( exp.what() ));
 | 
							QMessageBox::critical( this,
 | 
				
			||||||
 | 
							                       QString::fromLocal8Bit( "查询用户信息出错" ),
 | 
				
			||||||
 | 
							                       QString::fromLocal8Bit( error.what() ) );
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,10 +3,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
#include <QtWidgets/QtWidgets>
 | 
					#include <QtWidgets/QtWidgets>
 | 
				
			||||||
//#include <QDialog>
 | 
					 | 
				
			||||||
//#include <QTextCodec>
 | 
					 | 
				
			||||||
#include "ui_QLoginWidget.h"
 | 
					#include "ui_QLoginWidget.h"
 | 
				
			||||||
//#include "DataManipulate.h"
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,7 +16,7 @@ public:
 | 
				
			|||||||
	QLoginWidget(QWidget *parent = 0);
 | 
						QLoginWidget(QWidget *parent = 0);
 | 
				
			||||||
	~QLoginWidget();
 | 
						~QLoginWidget();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool isLogin() const { return m_isLoginSuccess; }
 | 
						bool isLogin() const { return doesLoginSuccess; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	void init();
 | 
						void init();
 | 
				
			||||||
@@ -26,10 +24,10 @@ private:
 | 
				
			|||||||
	void initSignal();
 | 
						void initSignal();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected Q_SLOTS:
 | 
					protected Q_SLOTS:
 | 
				
			||||||
	void login();
 | 
						void onLogin();
 | 
				
			||||||
	void cancel();
 | 
						void onCancel();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void getUserName();
 | 
						void onQueryUserInfo();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	Ui::QLoginWidget ui;
 | 
						Ui::QLoginWidget ui;
 | 
				
			||||||
@@ -37,11 +35,11 @@ private:
 | 
				
			|||||||
	QTextCodec * pCodecUTF8;
 | 
						QTextCodec * pCodecUTF8;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	string m_userCode;
 | 
						string userCode;
 | 
				
			||||||
	string m_userName;
 | 
						string userName;
 | 
				
			||||||
	string m_userPassword;
 | 
						string userPassword;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool m_isLoginSuccess;
 | 
						bool doesLoginSuccess;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // QLOGINWIDGET_H
 | 
					#endif // QLOGINWIDGET_H
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -201,7 +201,7 @@ void QTelSalePolicyInfoInputWidget::onQuerySalerName()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	salerCode = pEditSalerCode->text().trimmed().toUpper().toLocal8Bit().data();
 | 
						salerCode = pEditSalerCode->text().trimmed().toUpper().toLocal8Bit().data();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	queryStaffInfo( salerCode,
 | 
						query_staff_info( salerCode,
 | 
				
			||||||
	                salerName,
 | 
						                salerName,
 | 
				
			||||||
	                salerDeptCode,
 | 
						                salerDeptCode,
 | 
				
			||||||
	                salerDeptName,
 | 
						                salerDeptName,
 | 
				
			||||||
@@ -434,7 +434,7 @@ void QTelSalePolicyInfoInputWidget::onQueryAutoTraderName()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	autoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
 | 
						autoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	queryAutoTraderInfo( autoTraderCode, autoTraderName );
 | 
						query_auto_trader_info( autoTraderCode, autoTraderName );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pEditAutoTraderName->setText( QString::fromLocal8Bit( autoTraderName.c_str() ) );
 | 
						pEditAutoTraderName->setText( QString::fromLocal8Bit( autoTraderName.c_str() ) );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,7 +54,7 @@ void QTelSalePolicyInfoQuery::onOperatorCodeEdited()
 | 
				
			|||||||
	string strStaffCode = pEditOperatorCode->text().toLocal8Bit().data();
 | 
						string strStaffCode = pEditOperatorCode->text().toLocal8Bit().data();
 | 
				
			||||||
	string strStaffName;
 | 
						string strStaffName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	queryStaffInfo( strStaffCode, strStaffName );
 | 
						query_staff_info( strStaffCode, strStaffName );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pEditOperatorName->setText( QString::fromLocal8Bit( strStaffName.c_str() ));
 | 
						pEditOperatorName->setText( QString::fromLocal8Bit( strStaffName.c_str() ));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,7 +59,7 @@ const static char g_cszConnstringYwgl[] =
 | 
				
			|||||||
const static char g_cszUserNameYwgl[] = "ccx99";
 | 
					const static char g_cszUserNameYwgl[] = "ccx99";
 | 
				
			||||||
const static char g_cszPasswordYwgl[] = "c92IT09";
 | 
					const static char g_cszPasswordYwgl[] = "c92IT09";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void QueryUserInfo(const string & strCode, string & strName, string & strPassword)
 | 
					void query_user_info(const string & strCode, string & strName, string & strPassword)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	SAConnection conn;
 | 
						SAConnection conn;
 | 
				
			||||||
	SACommand command;
 | 
						SACommand command;
 | 
				
			||||||
@@ -107,7 +107,7 @@ void QueryUserInfo(const string & strCode, string & strName, string & strPasswor
 | 
				
			|||||||
	conn.Disconnect();
 | 
						conn.Disconnect();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void queryStaffInfo(const string & strOperatorCode, string & strOperatorName, string & strDeptCode, string & strDeptName, string & strOfficeCode, string & strOfficeName)
 | 
					void query_staff_info(const string & strOperatorCode, string & strOperatorName, string & strDeptCode, string & strDeptName, string & strOfficeCode, string & strOfficeName)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	SAConnection connection;
 | 
						SAConnection connection;
 | 
				
			||||||
	SACommand    command;
 | 
						SACommand    command;
 | 
				
			||||||
@@ -163,7 +163,7 @@ void queryStaffInfo(const string & strOperatorCode, string & strOperatorName, st
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void queryAutoTraderInfo(const string & strAutoTraderCode, string & strAutoTraderName)
 | 
					void query_auto_trader_info(const string & strAutoTraderCode, string & strAutoTraderName)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	SAConnection connection;
 | 
						SAConnection connection;
 | 
				
			||||||
	SACommand    command;
 | 
						SACommand    command;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,3 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
#ifndef DataQuery_h__
 | 
					#ifndef DataQuery_h__
 | 
				
			||||||
#define DataQuery_h__
 | 
					#define DataQuery_h__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -16,9 +15,9 @@ using std::string;
 | 
				
			|||||||
// Parameter: string & strName       名字
 | 
					// Parameter: string & strName       名字
 | 
				
			||||||
// Parameter: string & strPassword   密码
 | 
					// Parameter: string & strPassword   密码
 | 
				
			||||||
//************************************
 | 
					//************************************
 | 
				
			||||||
void QueryUserInfo( const string & strCode,
 | 
					void query_user_info( const string & strCode,
 | 
				
			||||||
	                      string & strName,
 | 
					                      string &       strName,
 | 
				
			||||||
			              string & strPassword );
 | 
					                      string &       strPassword );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//************************************
 | 
					//************************************
 | 
				
			||||||
@@ -34,23 +33,23 @@ void QueryUserInfo( const string & strCode,
 | 
				
			|||||||
// Parameter: string & strOfficeCode 科室代码
 | 
					// Parameter: string & strOfficeCode 科室代码
 | 
				
			||||||
// Parameter: string & strOfficeName 科室名称
 | 
					// Parameter: string & strOfficeName 科室名称
 | 
				
			||||||
//************************************
 | 
					//************************************
 | 
				
			||||||
void queryStaffInfo( const string & strOperatorCode,
 | 
					void query_staff_info( const string & strOperatorCode,
 | 
				
			||||||
	                       string & strOperatorName,
 | 
					                       string &       strOperatorName,
 | 
				
			||||||
						   string & strDeptCode = string(),
 | 
					                       string &       strDeptCode   = string(),
 | 
				
			||||||
						   string & strDeptName = string(),
 | 
					                       string &       strDeptName   = string(),
 | 
				
			||||||
						   string & strOfficeCode = string(),
 | 
					                       string &       strOfficeCode = string(),
 | 
				
			||||||
						   string & strOfficeName = string());
 | 
					                       string &       strOfficeName = string() );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//************************************
 | 
					//************************************
 | 
				
			||||||
// Method:    queryAutoTraderInfo
 | 
					// Method:    query_auto_trader_info
 | 
				
			||||||
// FullName:  queryAutoTraderInfo
 | 
					// FullName:  query_auto_trader_info
 | 
				
			||||||
// Access:    public 
 | 
					// Access:    public 
 | 
				
			||||||
// Returns:   void
 | 
					// Returns:   void
 | 
				
			||||||
// Qualifier: 查询车商信息
 | 
					// Qualifier: 查询车商信息
 | 
				
			||||||
// Parameter: const string & strAutoTraderCode
 | 
					// Parameter: const string & strAutoTraderCode
 | 
				
			||||||
// Parameter: string & strAutoTraderName
 | 
					// Parameter: string & strAutoTraderName
 | 
				
			||||||
//************************************
 | 
					//************************************
 | 
				
			||||||
void queryAutoTraderInfo( const string & strAutoTraderCode,
 | 
					void query_auto_trader_info( const string & strAutoTraderCode,
 | 
				
			||||||
	                            string & strAutoTraderName );
 | 
					                             string &       strAutoTraderName );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // DataQuery_h__
 | 
					#endif // DataQuery_h__
 | 
				
			||||||
		Reference in New Issue
	
	Block a user