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

📄 winlogin.pas

📁 考勤管理 考勤管理 考勤管理
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit Winlogin;
//****************************************************************
//*公司名:华夏数码有限公司
//*系统名:考勤管理系统
//*程序名:WinLOGIN
//*
//*--------------------------------------------------------------
//*  [年月日]     [制造者]
//*--------------------------------------------------------------
//*  2005/11/21   徐二芳
//*
//****************************************************************
interface

uses
  System.Drawing, System.Collections, System.ComponentModel,
  System.Windows.Forms, System.Data, System.Resources,system.Data.OleDb,dialogs,clsmain,Borland.Vcl.SysUtils;

type
  TWinlogin = class(System.Windows.Forms.Form)
  {$REGION 'Designer Managed Code'}
  strict private
    /// <summary>
    /// Required designer variable.
    /// </summary>
    Components: System.ComponentModel.Container;
    Label1: System.Windows.Forms.Label;
    Label2: System.Windows.Forms.Label;
    Butok: System.Windows.Forms.Button;
    Butcannel: System.Windows.Forms.Button;
    Textuser: System.Windows.Forms.TextBox;
    Textpass: System.Windows.Forms.TextBox;
    GroupBox1: System.Windows.Forms.GroupBox;
    CheckBox1: System.Windows.Forms.CheckBox;
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    procedure InitializeComponent;
    procedure Butok_Click(sender: System.Object; e: System.EventArgs);
    procedure Butcannel_Click(sender: System.Object; e: System.EventArgs);
    procedure TWinlogin_Closed(sender: System.Object; e: System.EventArgs);
    procedure TWinlogin_Load(sender: System.Object; e: System.EventArgs);
    procedure TWinlogin_KeyDown(sender: System.Object; e: System.Windows.Forms.KeyEventArgs);
    procedure TWinlogin_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
    procedure Textuser_TextChanged(sender: System.Object; e: System.EventArgs);
    procedure Textuser_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
    procedure Textpass_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);

  {$ENDREGION}
  strict protected
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    procedure Dispose(Disposing: Boolean); override;
  private
    procedure item_clear();
    function item_check():boolean;
    function check_textuser():boolean;
    function check_textpass():boolean;
    function data_get():boolean;
    function data_Ent():boolean;
    function data_getYG():boolean;    //查询员工的姓名和密码(即员工编号)

  var
    myds:dataset;

    { Private Declarations }
  public
    constructor Create;


  end;

  [assembly: RuntimeRequiredAttribute(TypeOf(TWinlogin))]

implementation

uses WinYGjilu;
 var
  dgds:dataset;

{$REGION 'Windows Form Designer generated code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure TWinlogin.InitializeComponent;
var
  resources: System.Resources.ResourceManager;
begin
  resources := System.Resources.ResourceManager.Create(TypeOf(TWinlogin));
  Self.Label1 := System.Windows.Forms.Label.Create;
  Self.Label2 := System.Windows.Forms.Label.Create;
  Self.Butok := System.Windows.Forms.Button.Create;
  Self.Butcannel := System.Windows.Forms.Button.Create;
  Self.Textuser := System.Windows.Forms.TextBox.Create;
  Self.Textpass := System.Windows.Forms.TextBox.Create;
  Self.GroupBox1 := System.Windows.Forms.GroupBox.Create;
  Self.CheckBox1 := System.Windows.Forms.CheckBox.Create;
  Self.GroupBox1.SuspendLayout;
  Self.SuspendLayout;
  // 
  // Label1
  // 
  Self.Label1.Location := System.Drawing.Point.Create(24, 24);
  Self.Label1.Name := 'Label1';
  Self.Label1.Size := System.Drawing.Size.Create(56, 23);
  Self.Label1.TabIndex := 0;
  Self.Label1.Text := '用户名:';
  // 
  // Label2
  // 
  Self.Label2.Location := System.Drawing.Point.Create(24, 56);
  Self.Label2.Name := 'Label2';
  Self.Label2.Size := System.Drawing.Size.Create(48, 23);
  Self.Label2.TabIndex := 1;
  Self.Label2.Text := '密 码:';
  // 
  // Butok
  // 
  Self.Butok.Location := System.Drawing.Point.Create(88, 176);
  Self.Butok.Name := 'Butok';
  Self.Butok.Size := System.Drawing.Size.Create(75, 40);
  Self.Butok.TabIndex := 2;
  Self.Butok.Text := ' 确定';
  Include(Self.Butok.Click, Self.Butok_Click);
  // 
  // Butcannel
  // 
  Self.Butcannel.Location := System.Drawing.Point.Create(192, 176);
  Self.Butcannel.Name := 'Butcannel';
  Self.Butcannel.Size := System.Drawing.Size.Create(75, 40);
  Self.Butcannel.TabIndex := 4;
  Self.Butcannel.Text := ' 取消';
  Include(Self.Butcannel.Click, Self.Butcannel_Click);
  // 
  // Textuser
  // 
  Self.Textuser.Location := System.Drawing.Point.Create(96, 24);
  Self.Textuser.Name := 'Textuser';
  Self.Textuser.TabIndex := 0;
  Self.Textuser.Text := ' ';
  Include(Self.Textuser.KeyPress, Self.Textuser_KeyPress);
  Include(Self.Textuser.TextChanged, Self.Textuser_TextChanged);
  // 
  // Textpass
  // 
  Self.Textpass.Location := System.Drawing.Point.Create(96, 56);
  Self.Textpass.Name := 'Textpass';
  Self.Textpass.PasswordChar := '*';
  Self.Textpass.TabIndex := 1;
  Self.Textpass.Text := ' ';
  Include(Self.Textpass.KeyPress, Self.Textpass_KeyPress);
  // 
  // GroupBox1
  // 
  Self.GroupBox1.Controls.Add(Self.CheckBox1);
  Self.GroupBox1.Controls.Add(Self.Label1);
  Self.GroupBox1.Controls.Add(Self.Label2);
  Self.GroupBox1.Controls.Add(Self.Textuser);
  Self.GroupBox1.Controls.Add(Self.Textpass);
  Self.GroupBox1.Location := System.Drawing.Point.Create(64, 24);
  Self.GroupBox1.Name := 'GroupBox1';
  Self.GroupBox1.Size := System.Drawing.Size.Create(224, 136);
  Self.GroupBox1.TabIndex := 5;
  Self.GroupBox1.TabStop := False;
  // 
  // CheckBox1
  // 
  Self.CheckBox1.Location := System.Drawing.Point.Create(40, 96);
  Self.CheckBox1.Name := 'CheckBox1';
  Self.CheckBox1.Size := System.Drawing.Size.Create(160, 24);
  Self.CheckBox1.TabIndex := 2;
  Self.CheckBox1.Text := '以系统管理员的身份登录';
  // 
  // TWinlogin
  // 
  Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 14);
  Self.BackColor := System.Drawing.Color.LightGray;
  Self.BackgroundImage := (System.Drawing.Image(resources.GetObject('$this.BackgroundImage')));
  Self.ClientSize := System.Drawing.Size.Create(338, 231);
  Self.Controls.Add(Self.GroupBox1);
  Self.Controls.Add(Self.Butcannel);
  Self.Controls.Add(Self.Butok);
  Self.FormBorderStyle := System.Windows.Forms.FormBorderStyle.FixedSingle;
  Self.Icon := (System.Drawing.Icon(resources.GetObject('$this.Icon')));
  Self.MaximizeBox := False;
  Self.Name := 'TWinlogin';
  Self.StartPosition := System.Windows.Forms.FormStartPosition.CenterScreen;
  Self.Text := '请输入用户名和密码';
  Include(Self.KeyDown, Self.TWinlogin_KeyDown);
  Include(Self.KeyPress, Self.TWinlogin_KeyPress);
  Include(Self.Load, Self.TWinlogin_Load);
  Include(Self.Closed, Self.TWinlogin_Closed);
  Self.GroupBox1.ResumeLayout(False);
  Self.ResumeLayout(False);
end;
{$ENDREGION}

procedure TWinlogin.Dispose(Disposing: Boolean);
begin
  if Disposing then
  begin
    if Components <> nil then
      Components.Dispose();
  end;
  inherited Dispose(Disposing);
end;

constructor TWinlogin.Create;
begin
  inherited Create;
  //
  // Required for Windows Form Designer support
  //
  InitializeComponent;
  //
  // TODO: Add any constructor code after InitializeComponent call
  //
end;



procedure TWinlogin.Textpass_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
  try
     if e.KeyChar=#13 then
     butok.Focus;
  except
    on ex:exception do
    begin
      messagebox.Show('TWinlogin.Textpass_Keypress:('+ex.message+')','考勤管理系统');
    end;
  end;
end;

procedure TWinlogin.Textuser_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
  try
    if e.KeyChar=#13 then
    textpass.Focus;
  except
    on ex:exception do
    begin
      messagebox.Show('TWinlogin.Textuser_KeyPress:('+ex.message+')','考勤管理系统');
    end;
  end;
end;

procedure TWinlogin.Textuser_TextChanged(sender: System.Object; e: System.EventArgs);
begin

end;
//****************************************************************
//*  窗体加载 [Load]
//*
//*  [参数]
//*      1:系统参数
//*      2:系统参数
//*  [返回]
//*      无
//****************************************************************
procedure TWinlogin.TWinlogin_Load(sender: System.Object; e: System.EventArgs);
begin
  times:=times+1;
  try
    // 数据库连接 ,如果不成功则退出
    if clsmain.TClass1.Create.ado_connect=false then
    begin
      application.Exit;
    end;
    myds:=dataset.Create;
    //调用初始化函数,进行控件的初始化
    item_clear();
    WinReLoadshowFla:=true;


  except
    on ex:exception do
    begin
      messagebox.Show('TWinlogin.TWinlogin_Load:('+ex.message+')','考勤管理系统');
    end;
  end;
end;
//*******-********************************************************
//*  窗体加载 [Load]
//*
//*  [参数]
//*      1:系统参数
//*      2:系统参数
//*  [返回]
//*      无
//****************************************************************
procedure TWinlogin.TWinlogin_Closed(sender: System.Object; e: System.EventArgs);
begin
  try
    // 释放数据库资源

    myds.Clear();  //释放对象
    myds.Dispose(); //释放对象
   // application.Exit;
    //退出程序
    {if  WinReLoadshowFla=false then
    begin
       application.exit;
    end;
    {else
    begin
      self.dispose();
    end; }
   //WinReLoadshowFla:=false;  //给以恢复标记
   if times=1 then
    begin
      application.Exit;
    end
   else
    begin
     self.Free;
     self.Dispose();
    end;

    //记录员工登录次数
    if CheckBox1.Checked=false  then
    begin
      YGdenglucishu:=0;   //首次登陆记录,填写上班记录
    end;
 except
    on ex:exception do
    begin
      messagebox.Show('TWinlogin.TWinlogin_Closed:('+ex.message+')','考勤管理系统');
    end;
  end;
end;
 //****************************************************************
//*  TWinlogin_KeyPress
//*
//*  [参数]
//*      1:系统参数
//*      2:系统参数
//*  [返回]
//*      无
//****************************************************************
procedure TWinlogin.TWinlogin_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
  try
    case e.KeyChar of
    char(13):
      begin
        e.Handled:=false;
        sendkeys.Send('{tab}');
      end;
    end;
  except
    on ex:exception do
    begin
      messagebox.Show('TWinlogin.TWinlogin_Keypress:('+ex.message+')','考勤管理系统');
    end;
  end;
end;
 //****************************************************************
//*  TWinlogin_Keydown
//*
//*  [参数]
//*      1:系统参数
//*      2:系统参数
//*  [返回]
//*      无
//****************************************************************
procedure TWinlogin.TWinlogin_KeyDown(sender: System.Object; e: System.Windows.Forms.KeyEventArgs);
begin
    try
      case e.KeyCode of
       //f7:='确定'
      keys.F7:
        begin
          e.Handled:=false;
          self.Butok.Focus();
        end;
      // f9='取消'
      keys.F9:
        begin
          e.Handled:=false;
          self.butcannel.Focus();
        end;
      end;
  except
    on ex:exception do
    begin
      messagebox.Show('TWinlogin.TWinlogin_KeyDown:('+ex.message+')','考勤管理系统');
    end;
  end;

end;
 //****************************************************************
//*Butok_Click
//*
//*  [参数]
//*      1:系统参数
//*      2:系统参数
//*  [返回]

⌨️ 快捷键说明

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