此处为登陆界面:
type
Tformlogin = class(TIWAppForm)
IWButtonok: TIWButton;
IWButtonback: TIWButton;
TIWAdvEditpassword: TTIWAdvEdit;
TIWAdvLUEditusername: TTIWAdvLUEdit;
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
procedure IWButtonokClick(Sender: TObject);
public
end;
implementation
{$R *.dfm}
uses
ServerController, DatamoduleUnit, IWUnitinputinfo;
procedure Tformlogin.IWButtonokClick(Sender: TObject);
begin
if (trim(TIWAdvLUEditusername.Text)='') or (trim(TIWAdvEditpassword.Text)='') then
begin
WebApplication.ShowMessage('必须输入用户名和密码');
Exit;
end;
//数据模块中联结db的Ado联结
with DataModule1.adodatasetlogin do
begin
Active:=True;
if not Locate('userName;Password', VarArrayOf([trim(TIWAdvLUEditusername.Text),trim(TIWAdvEditpassword.Text)]), []) then
begin
WebApplication.ShowMessage('无效的用户名或口令,请重新输入');
Exit;
end;
//如果合法,显示主界面
TIWAppForm(WebApplication.ActiveForm).Release;
Tforminputinfo.Create(WebApplication).Show;
end;
end;
end.
此处为输入信息界面:
unit IWUnitinputinfo;
{PUBDIST}
interface
uses
IWAppForm, IWApplication, IWTypes, IWWebGrid, IWDBAdvWebGrid,
IWCompListbox, Classes, Controls, IWControl, IWCompEdit, IWTMSEdit,
IWGrids, IWDBGrids, IWCompButton,SysUtils, IWTMSCal, IWLayoutMgr,
IWTemplateProcessorHTML;
type
Tforminputinfo = class(TIWAppForm)
YEAR: TTIWAdvSpinEdit;
MON2: TTIWAdvSpinEdit;
MON1: TTIWAdvSpinEdit;
IWComboBoxKEMU: TIWComboBox;
TIWDBAdvWebGridDANWEI: TTIWDBAdvWebGrid;
IWButtonok: TIWButton;
IWButtonback: TIWButton;
IWTemplateProcessorHTML1: TIWTemplateProcessorHTML;
procedure IWButtonokClick(Sender: TObject);
procedure IWAppFormCreate(Sender: TObject);
procedure IWButtonbackClick(Sender: TObject);
public
end;
implementation
{$R *.dfm}
uses
ServerController, DatamoduleUnit, DateUtils, Unitdetail, IWUnitlogin;
procedure Tforminputinfo.IWButtonokClick(Sender: TObject);
var
strfill:string;
begin
//生成、保存参数。
UserSession.kjnd:=trim(YEAR.Text);
UserSession.monbegin:=trim(MON1.text);
UserSession.monend:=trim(MON2.text);
if length(MON1.text)=1 then strfill:='0' else strfill:='';
UserSession.yearmonbegin:=trim(YEAR.Text)+strfill+trim(MON1.text);
UserSession.yearmonend:=trim(YEAR.Text)+strfill+trim(MON2.Text);
UserSession.kemu:=trim(IWComboBoxKEMU.Text);
UserSession.danwei:=trim(datamodule1.ADODataSetLIST.fieldbyname('dbname').value);
//切换界面。
TIWAppForm(WebApplication.ActiveForm).Release;
Tformdetail.Create(WebApplication).Show;
end;
procedure Tforminputinfo.IWAppFormCreate(Sender: TObject);
begin
//TIWDBAdvWebGridDANWEI.RowTot:=TIWDBAdvWebGridDANWEI.RowCount*(round(datamodule1.ADODataSetLIST.RecordCount/TIWDBAdvWebGridDANWEI.RowCount+0.4))
end;
procedure Tforminputinfo.IWButtonbackClick(Sender: TObject);
begin
TIWAppForm(WebApplication.ActiveForm).Release;
Tformlogin.Create(WebApplication).Show;
end;
end.