📄 checkin.cpp
字号:
#if !defined( __STRING_H )
#include <String.h>
#endif // __STRING_H
#define Uses_DBase
#define Uses_Window
#define Uses_Field
#define Uses_Button
#include <ly.h>
#include "sj.h"
#include "sjdbf.h"
const
getWinLeft = 195,
getWinTop = 153,
getWinWidth = 250,
getWinDeapth = 164,
tytleWidth = 50,
fieldWidth = 175,
ttDutyNumLeft = getWinLeft + 12,
ttDutyNumTop = getWinTop + 46,
fdDutyNumLeft = ttDutyNumLeft + tytleWidth,
fdDutyNumTop = ttDutyNumTop - 4,
fdDutyNumWidth = fieldWidth,
ttPasswordLeft = ttDutyNumLeft,
ttPasswordTop = fdDutyNumTop + 40,
fdPasswordLeft = ttPasswordLeft + tytleWidth,
fdPasswordTop = ttPasswordTop - 4,
fdPasswordWidth = fieldWidth,
buttonSpace = 12,
buttonTop = fdPasswordTop + 38,
btnOkLeft = getWinLeft + buttonSpace,
btnOkTop = buttonTop,
btnCancelLeft = 320 - 35,
btnCancelTop = buttonTop,
btnHelpLeft = getWinLeft + getWinWidth - 70 - buttonSpace,
btnHelpTop = buttonTop;
static char *szHelp[] =
{
"■收款员操作前必须输入正确的工号和 ",
" 密码 ",
"■工号最多为4位数 ",
" 密码最多为6个字母,大小写均可 ",
"■工号和密码输完后Enter或选择〔对〕",
NULL
};
BOOL SJ::CheckIn()
{
Window *getWin = new Window( getWinTop, getWinWidth, getWinDeapth, "请输入工号和密码" );
getWin->DrawTytle( ttDutyNumLeft, ttDutyNumTop, "工号", 'G' );
char szDuty[ flDuty + 1 ];
memset( szDuty, ' ', flDuty );
szDuty[ flDuty ] = 0;
Field *fdDutyNum = new Field( fdDutyNumLeft, fdDutyNumTop, fdDutyNumWidth, szDuty, flDuty );
getWin->DrawTytle( ttPasswordLeft, ttPasswordTop, "密码", 'M' );
char szPassword[ flPassword + 1 ];
memset( szPassword, ' ', flPassword );
szPassword[ flPassword ] = 0;
Field *fdPass = new Field( fdPasswordLeft, fdPasswordTop, fdPasswordWidth,
szPassword, flPassword, tpPassword );
Button *btnOk = new Button( btnOkLeft, btnOkTop, tpOkButton );
Button *btnCancel = new Button( btnCancelLeft, btnCancelTop, tpCancelButton );
Button *btnHelp = new Button( btnHelpLeft, btnHelpTop, tpHelpButton );
getWin->Insert( fdDutyNum, fdPass, btnOk, btnCancel, btnHelp, NULL );
Event event;
BOOL bResult = FALSE;
for(;;)
{
while( !GetEvent( event ) );
getWin->HandleEvent( event );
if( event.what == evCommand )
{
if( event.command == cmOk )
{
if( *szDuty != ' ' && *szPassword == ' ' )
{
getWin->Reselect( fdPass );
continue;
}
else if( *szDuty == ' ' )
{
getWin->Reselect( fdDutyNum );
continue;
}
else if( CheckDuty( szDuty ) && CheckPassword( szPassword ) )
{
int nRecNum = dbfDuty->Seek( szDuty );
if( nRecNum >= 0 )
{
char str[ flPassword ];
dbfDuty->GetField( nRecNum, fdPassword, str );
TransferPassword( str );
if( memcmp( szPassword, str, flPassword ) == 0 )
{
bResult = TRUE;
break;
}
else ShowError( "密码输错了" );
fdPass->Clear();
getWin->Reselect( fdPass );
}
else
{
ShowError( "没有这个工号" );
getWin->Reselect( fdDutyNum );
}
}
}
else if( event.command == cmCancel ||
event.command == cmClose ) break;
else if( event.command == cmHelp )
{
ShowHelp( szHelp );
getWin->Reselect( fdDutyNum );
}
}
}
delete getWin;
if( bResult )
{
strcpy( szDutyNum, szDuty );
ShowDutyNum( szDutyNum );
}
return bResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -