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

📄 ufrmmain.pas

📁 本文件采用了c/s结构的分布式应用系统
💻 PAS
字号:
unit UfrmMain;

interface

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

type
  TfrmMain = class(TForm)
    Label1: TLabel;
    Animate1: TAnimate;
    Panel1: TPanel;
    btnHomeMaster: TButton;
    btnFix: TButton;
    Panel2: TPanel;
    btnInOut: TButton;
    btnFee: TButton;
    Panel3: TPanel;
    Button5: TButton;
    Button6: TButton;
    procedure btnHomeMasterClick(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure btnFixClick(Sender: TObject);
    procedure btnInOutClick(Sender: TObject);
    procedure btnFeeClick(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
  authorization:string; //纪录整个系统中用户的操作权限
    { Public declarations }
  end;

var
  frmMain: TfrmMain;


implementation

uses udmclient, ufrmfee, ufrmfix, ufrmHomeMaster, ufrminout, ufrmlogin,
  ufrmSystem;

{$R *.dfm}

//打开户籍管理操作窗体
procedure TfrmMain.btnHomeMasterClick(Sender: TObject);
begin
 frmlogin.showmodal;//显示用户登录窗体
 if dmclient.DCOMConnSvr.Connected then //可以连上应用程序服务器
 begin
 //具有该权限
 if (trim(authorization)='户籍管理') or (trim(authorization)='系统管理') then
  begin
    //纪录该用户最后登录系统的时间
    dmclient.cdsLogin.Edit;
    dmclient.cdsLogin.FieldByName('lastlogin').Value:=now;
    dmclient.cdsLogin.Post;
    //更新回数据源
    dmclient.cdsLogin.ApplyUpdates(0);
    //创建户籍管理窗体对象
    application.CreateForm(tfrmhomemaster,frmhomemaster);
    frmlogin.Hide;//隐藏登陆窗体
    frmhomemaster.ShowModal; //显示户籍管理窗体
  end
  else
  //用户权限验证无法通过
  begin
  messagedlg('你没有进入该系统的权限',mterror,[mbok],0);
  exit;
  end;
 end
 else
   //无法连上远程应用程序服务器
   messagedlg('无法连接到远程应用程序服务器',mterror,[mbok],0);
end;

 //退出系统
procedure TfrmMain.Button6Click(Sender: TObject);
begin
application.Terminate;
end;

//维修管理窗体
procedure TfrmMain.btnFixClick(Sender: TObject);
begin
 frmlogin.showmodal;
 if dmclient.DCOMConnSvr.Connected then
 begin
 if (trim(authorization)='维修管理') or (trim(authorization)='系统管理') then
  begin
    dmclient.cdsLogin.Edit;
    dmclient.cdsLogin.FieldByName('lastlogin').Value:=now;
    dmclient.cdsLogin.Post;
    dmclient.cdsLogin.ApplyUpdates(0);
    application.CreateForm(tfrmfix,frmfix);
    frmlogin.Hide;
    frmfix.ShowModal;
  end
  else
  begin
  messagedlg('你没有进入该系统的权限',mterror,[mbok],0);
  exit;
  end;
 end
 else
   messagedlg('无法连接到远程应用程序服务器',mterror,[mbok],0);
end;

//出入管理窗体
procedure TfrmMain.btnInOutClick(Sender: TObject);
begin
 frmlogin.showmodal;
 if dmclient.DCOMConnSvr.Connected then
 begin
  if (trim(authorization)='出入管理') or (trim(authorization)='系统管理') then
  begin
    dmclient.cdsLogin.Edit;
    dmclient.cdsLogin.FieldByName('lastlogin').Value:=now;
    dmclient.cdsLogin.Post;
    dmclient.cdsLogin.ApplyUpdates(0);
    application.CreateForm(tfrminout,frminout);
    frmlogin.Hide;
    frminout.ShowModal;
  end
  else
  begin
  messagedlg('你没有进入该系统的权限',mterror,[mbok],0);
  exit;
  end;
 end
 else
   messagedlg('无法连接到远程应用程序服务器',mterror,[mbok],0);
end;


//交费管理窗体
procedure TfrmMain.btnFeeClick(Sender: TObject);
begin
 frmlogin.showmodal;
 if dmclient.DCOMConnSvr.Connected then
 begin
  if (trim(authorization)='收费管理') or (trim(authorization)='系统管理') then
  begin
    dmclient.cdsLogin.Edit;
    dmclient.cdsLogin.FieldByName('lastlogin').Value:=now;
    dmclient.cdsLogin.Post;
    dmclient.cdsLogin.ApplyUpdates(0);
    application.CreateForm(tfrmfee,frmfee);
    frmlogin.Hide;
    frmfee.ShowModal;
  end
  else
  begin
  messagedlg('你没有进入该系统的权限',mterror,[mbok],0);
  exit;
  end;
 end
 else
   messagedlg('无法连接到远程应用程序服务器',mterror,[mbok],0);
end;

//系统管理窗体
procedure TfrmMain.Button5Click(Sender: TObject);
begin
 frmlogin.showmodal;
 if dmclient.DCOMConnSvr.Connected then
 begin
  if  (trim(authorization)='系统管理') then
  begin
    dmclient.cdsLogin.Edit;
    dmclient.cdsLogin.FieldByName('lastlogin').Value:=now;
    dmclient.cdsLogin.Post;
    dmclient.cdsLogin.ApplyUpdates(0);
    application.CreateForm(tfrmsystem,frmsystem);
    frmlogin.Hide;
    frmsystem.ShowModal;
  end
  else
  begin
  messagedlg('你没有进入该系统的权限',mterror,[mbok],0);
  exit;
  end;
 end
 else
   messagedlg('无法连接到远程应用程序服务器',mterror,[mbok],0);
end;

end.

⌨️ 快捷键说明

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