📄 srvlog.pas
字号:
unit SrvLog;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ConstDef;
type
TFrmSrvLog = class(TForm)
LabAccount: TLabel;
EdtAccount: TEdit;
EdtPsw1: TEdit;
LabPsw1: TLabel;
LabPsw2: TLabel;
EdtPsw2: TEdit;
BtnOK: TButton;
BtnCancel: TButton;
procedure FormShow(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
procedure BtnOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
EnterMode: EnterModeType;
end;
var
FrmSrvLog: TFrmSrvLog;
btRetValue: Byte; //Connect Return Value
implementation
uses SrvMain, SrvRmt, NetImsServer_tlb;
{$R *.DFM}
procedure TFrmSrvLog.FormShow(Sender: TObject);
begin
EdtAccount.Text:='';
EdtAccount.Enabled:=True; EdtAccount.Visible:=True;
EdtPsw1.Text:=''; EdtPsw2.Text:='';
if EnterMode = OpLogInMode then
begin //登录模式
EdtPsw1.Enabled:=True; EdtPsw1.Visible:=True;
EdtPsw2.Enabled:=False; EdtPsw2.Visible:=False;
LabPsw2.Enabled:=False; LabPsw2.Visible:=False;
end
else if EnterMode = OpChgPswMode then
begin //更改登录口令模式
EdtAccount.Text:= RecOpInfo.sAccount;
EdtAccount.Enabled:=False;
EdtPsw2.Enabled:=True; EdtPsw2.Visible:=True;
LabPsw2.Enabled:=True; LabPsw2.Visible:=True;
end;
end;
procedure TFrmSrvLog.BtnCancelClick(Sender: TObject);
begin
ModalResult:=mrCancel;
end;
procedure TFrmSrvLog.BtnOKClick(Sender: TObject);
var
wsT1,wsT2: WideString;
btClass: Byte;
ItfNImsSrv: INImsSrv;
begin
RecOpInfo.sAccount:=EdtAccount.Text;
RecOpInfo.sOpPsw:=EdtPsw1.Text;
if EnterMode = OpLogInMode then begin
RecOpInfo.cOpClass:=DefSysNullChar;
try //登录服务器
with RecOpInfo do begin
btClass:=Byte(cOpClass);
ItfNImsSrv:=TNImsSrv.Create(Self);
btRetValue:=ItfNImsSrv.btFunRmtLogIn(sAccount,sOpPsw,
btClass,wsT1,wsT2); //返回登录帐号的操作级别
ItfNImsSrv:=nil;
cOpClass:=Char(btClass); sOpName:=wsT1; sOpMark:=wsT2;
end;
except
btRetValue:=Byte(CntLogFail);
end;
end
else if EnterMode = OpChgPswMode then begin
try //更改口令
with RecOpInfo do begin
wsT1:=sOpPsw; wsT2:=EdtPsw2.Text;
ItfNImsSrv:=TNImsSrv.Create(Self);
btRetValue:=ItfNImsSrv.btFunRmtChgPsw(sAccount,wsT1,wsT2);
ItfNImsSrv:=nil;
if btRetValue=Byte(CntChgPswOK) then sOpPsw:=wsT2;
end;
except
btRetValue:=Byte(CntLogFail);
end;
end;
if btRetValue = Byte(CntLogOK) then ModalResult:=mrOK
else if btRetValue = Byte(CntChgPswOK) then begin
wFunShowOK('登录口令更改成功!',[mbOK]);
ModalResult:=mrOK; Exit;
end
else begin
if btRetValue=Byte(CntLogFail) then wFunShowError('登录NIms失败!',[mbOK])
else if btRetValue=Byte(CntNotExist) then
wFunShowError('登录帐号不存在!',[mbOK])
else if btRetValue=Byte(CntLogged) then
wFunShowError('操作员已登录!',[mbOK])
else if btRetValue=Byte(CntPswError) then
wFunShowError('登录口令错误!',[mbOK]);
ModalResult:=mrCancel; Exit;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -