⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.pas

📁 这是一个DELPHI7应用案例开发篇有配套程序种子光盘
💻 PAS
字号:
unit Login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, IWControl, IWCompEdit, IWCompLabel, IWCompButton, IWInit,
  IWAppForm;

type
  TfrmLogin = class(TFrame)
    edUserName: TIWEdit;
    IWLabel1: TIWLabel;
    IWLabel2: TIWLabel;
    edPassword: TIWEdit;
    btnLogin: TIWButton;
    btnRegister: TIWButton;
    procedure btnRegisterClick(Sender: TObject);
    procedure btnLoginClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

uses LoginForm, DatamoduleUnit, ServerController, IWUnit1;

{$R *.dfm}

procedure TfrmLogin.btnRegisterClick(Sender: TObject);
begin
    TIWAppForm(RWebApplication.ActiveForm).Release;
    //显示新页面
    TfrmUserLogin.Create(RWebApplication).Show;
end;

procedure TfrmLogin.btnLoginClick(Sender: TObject);
var
    res : Variant;
begin
    with DataModule1.cdsCustomer do
    begin
        res := Lookup('ID',edUserName.Text,'Passwd');
        if (res<>NULL) then
            if (not (VarType(res) in [varNULL])) then
                if res=edPassword.Text then
                begin
                    UserSession.UserName := edUserName.Text;
                    UserSession.Password := edPassword.Text;
                    UserSession.LoginTime := Now;

                    TIWAppForm(RWebApplication.ActiveForm).Release;
                    //显示新页面
                    TformMain.Create(RWebApplication).Show;

                    Exit;
                end;

        RWebApplication.ShowMessage('用户名或密码错误!');
    end;
end;

end.



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -