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

📄 userreg.pas

📁 一个餐饮行业的销售管理类的源码
💻 PAS
字号:
unit UserReg;

interface

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

type
  TUserRegForm = class(TForm)
    Label1: TLabel;
    UserName: TEdit;
    Label2: TLabel;
    Pwd: TEdit;
    Label3: TLabel;
    Power: TComboBox;
    Button1: TButton;
    Button2: TButton;
    DataSource1: TDataSource;
    UserTable: TTable;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  UserRegForm: TUserRegForm;

implementation

{$R *.dfm}

procedure TUserRegForm.Button1Click(Sender: TObject);
var
    //存放用户权限
    P : Integer;
begin
    //判断输入是否合法
    if UserName.Text = '' then
        Exit;
    if Pwd.text = '' then
        Exit;
    if Power.text = '' then
        Exit;
    //增加新记录
    UserTable.Append;
    UserTable.FieldValues['Name'] := UserName.Text;
    UserTable.FieldValues['Password'] := Pwd.Text;
    if Power.Text = '管理员' then
    begin
        P := 1;
    end;
    if Power.Text = '员工' then
    begin
        P := 2;
    end;
    if Power.Text = '访客' then
    begin
        P := 3;
    end;
    UserTable.FieldValues['Power'] := P;
    //提交操作
    UserTable.Post;
end;

procedure TUserRegForm.Button2Click(Sender: TObject);
begin
    Close;
end;

end.

⌨️ 快捷键说明

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