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

📄 login.pas

📁 客户档案管理-delphi开发
💻 PAS
字号:
unit login;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, BusinessSkinForm, StdCtrls, bsSkinCtrls, Mask, bsSkinBoxCtrls,
  DB, ADODB, DateUtils;

type
  TFormLogin = class(TForm)
    bsBusinessSkinForm1: TbsBusinessSkinForm;
    bsSkinPanel1: TbsSkinPanel;
    bsSkinPanel2: TbsSkinPanel;
    bsSkinButtonLogin: TbsSkinButton;
    bsSkinButtonClose: TbsSkinButton;
    bsSkinStdLabel1: TbsSkinStdLabel;
    bsSkinStdLabel2: TbsSkinStdLabel;
    LabelCaption: TLabel;
    bsSkinPasswordEdit1: TbsSkinPasswordEdit;
    cdsYG: TADODataSet;
    LabelMsg: TLabel;
    bsSkinComboBox1: TbsSkinComboBox;
    cdsUserList: TADODataSet;
    bsSkinStdLabelVer: TbsSkinStdLabel;
    bsSkinButton13: TbsSkinButton;
    procedure bsSkinButtonCloseClick(Sender: TObject);
    procedure bsSkinButtonLoginClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure bsSkinButton13Click(Sender: TObject);
  private
    { Private declarations }
    piCount : Integer;
  public
    { Public declarations }
  end;

var
  FormLogin: TFormLogin;

implementation

uses
  dm, main, about;

{$R *.dfm}

procedure TFormLogin.bsSkinButtonCloseClick(Sender: TObject);
begin
  Close;
end;

procedure TFormLogin.FormShow(Sender: TObject);
begin
  piCount := 1;
  bsSkinComboBox1.Items.Clear;
  
  with cdsUserList do
  begin
    if not Active then Open;
    First;
    while not eof do
    begin
      bsSkinComboBox1.Items.Add(FindField('用户名').Value);
      Next;
    end;
  end;

  // 缺省显示第一项
  if bsSkinComboBox1.Items.Count > 0 then
    bsSkinComboBox1.ItemIndex := 0;
end;

procedure TFormLogin.bsSkinButtonLoginClick(Sender: TObject);
var
  sPassword, sTmp : String;
begin
  if cdsYG.Active then cdsYG.Close;
  cdsYG.Parameters.ParamByName('username').Value := bsSkinComboBox1.Text;
  cdsYG.Open;

  sPassword := '';
  if cdsYG.RecordCount > 0 then
    if not cdsYG.FieldByName('密码').IsNull then
      sPassword := cdsYG.FieldByName('密码').Value;

  if (Length(sPassword) > 0) and (sPassword = bsSkinPasswordEdit1.Text) then
  begin
    dbs.psYWY := bsSkinComboBox1.Text;

    dbs.psPassword := sPassword;
    if not cdsYG.FieldByName('人员类别').IsNull then
      sTmp := cdsYG.FieldByName('人员类别').Value
    else
      sTmp := '';

    if sTmp = '经理' then
      dbs.piGB := 2
    else
      if sTmp = '录入员' then
        dbs.piGB := 1
      else
        dbs.piGB := 0;          // 缺省为业务员

    bsSkinPasswordEdit1.Text := '';
    piCount := 1;

    Self.Hide;
    FormMain.Show;
  end
  else
  begin
    piCount := piCount + 1;
    dbs.ShowMsgDlgInf('用户或者密码不正确!');

    if (piCount > 3) then
      Close;
  end;
end;

procedure TFormLogin.bsSkinButton13Click(Sender: TObject);
begin
  dbs.CreateForm(TFormAbout);
end;

end.

⌨️ 快捷键说明

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