?? ufrmmain.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 + -