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

📄 logoutform.pas

📁 家庭理财系统.rar
💻 PAS
字号:
unit LogoutForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TLogout = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Logout: TLogout;

implementation

uses DMForm, LoginForm, MainForm;

{$R *.dfm}

procedure TLogout.FormCreate(Sender: TObject);
begin
  with dm.ADOQuery1 do
    begin
      dm.adoquery1.Close ;
      dm.adoquery1.Open ;
      while not dm.adoquery1.Eof do
      begin
        ComboBox1.Items.Add(dm.adoquery1.FieldByName('用户名').AsString);
        dm.adoquery1.Next
      end;
    end;
end;

procedure TLogout.Button2Click(Sender: TObject);
begin
  application.Terminate;
end;

procedure TLogout.Button1Click(Sender: TObject);
begin
   if (ComboBox1.Text = '') then
     messagebox(getactivewindow(),'请输入用户名!!','用户名不能为空!' ,MB_OK + MB_ICONINFORMATION) ;
   if (not(ComboBox1.Text = '')) then
     if (Edit1.Text = '')  then
       messagebox(getactivewindow(),'请您输入密码!!','密码不能为空!' ,MB_OK + MB_ICONINFORMATION);
   if (not(ComboBox1.Text='') and not(Edit1.Text='')) then
   begin
     with dm.ADOTable1 do
     begin
       if locate('用户名',ComboBox1.Text,[]) then
         if edit1.text<>fields[1].Value then
            messagebox(getactivewindow(),'密码或用户名错误!','错误!' ,MB_OK + MB_ICONINFORMATION)
         else
           if edit1.text=fields[1].Value then
             begin
               main.Free;
               login.user := fields[0].Value;
               login.admin := fields[2].value ;
               messagebox(getactivewindow(),'登录成功!','提示!' ,MB_OK + MB_ICONINFORMATION);
               with TMain.Create(self) do
                 showmodal;
               application.Terminate;
             end;
     end;
   end;
end;

procedure TLogout.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if key=#13 then
    begin
      if (ComboBox1.Text = '') then
        messagebox(getactivewindow(),'请输入用户名!!','用户名不能为空!' ,MB_OK + MB_ICONINFORMATION) ;
      if (not(ComboBox1.Text = '')) then
        if (Edit1.Text = '')  then
       messagebox(getactivewindow(),'请您输入密码!!','密码不能为空!' ,MB_OK + MB_ICONINFORMATION);
      if (not(ComboBox1.Text='') and not(Edit1.Text='')) then
      begin
        with dm.ADOTable1 do
          begin
            if locate('用户名',ComboBox1.Text,[]) then
            if edit1.text<>fields[1].Value then
              messagebox(getactivewindow(),'密码或用户名错误!','错误!' ,MB_OK + MB_ICONINFORMATION)
            else
              if edit1.text=fields[1].Value then
                begin
                  main.Free;
                  login.user := fields[0].Value;
                  login.admin := fields[2].value ;
                  messagebox(getactivewindow(),'登录成功!','提示!' ,MB_OK + MB_ICONINFORMATION);
                  with TMain.Create(self) do
                    showmodal;
                  application.Terminate;
                end;
            end;
        end;
    end;
end;

end.

⌨️ 快捷键说明

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