📄 cformhumanlist.pas
字号:
{-----------------------------------------------------------------------------
Unit Name: CFormHumanList
Author: hubdog(陈省)
Purpose:
BeginDate: 2002-7-1
History:
Note:注意要设置RequireSelection=true以避免出现什么NoSelection的文本
Note:IntraWeb的ComboBox有严重的bug
如果设定了ComboBox的OnChange事件就无法正确的定位ComboBox的内容
-----------------------------------------------------------------------------}
unit CFormHumanList;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, CFormBase, CFrameMenu, IWControl, IWCompLabel, IWExtCtrls, jpeg,
IWGrids, IWDBGrids, IWDBStdCtrls, IWCompButton, IWCompListbox, CFormEditHuman,
CFormEditCorp;
type
TformHumanList = class(TformBase)
iwdgHumanList: TIWDBGrid;
iwdnHumanList: TIWDBNavigator;
iwbLastPage: TIWButton;
iwbNextPage: TIWButton;
IWLabel1: TIWLabel;
iwcCorp: TIWComboBox;
IWButton1: TIWButton;
procedure IWAppFormCreate(Sender: TObject);
procedure iwbLastPageClick(Sender: TObject);
procedure iwbNextPageClick(Sender: TObject);
procedure iwdnHumanListEdit(Sender: TObject);
procedure iwdnHumanListInsert(Sender: TObject);
procedure iwcCorpChange(Sender: TObject);
procedure iwdgHumanListRenderCell(ACell: TIWGridCell; const ARow,
AColumn: Integer);
procedure IWButton1Click(Sender: TObject);
private
{ Private declarations }
FEditForm: TFormEditHuman;
public
{ Public declarations }
FCorpList: TStrings;
end;
var
formHumanList: TformHumanList;
implementation
uses DatamoduleUnit, IWAppForm, IWInit, IWTypes, CWebUtils;
{$R *.dfm}
procedure TformHumanList.IWAppFormCreate(Sender: TObject);
//var
// I:Integer;
begin
//inherited;
FEditForm := TformEditHuman.Create(RWebApplication);
try
//向Combobox中填充所有的公司名
FCorpList := GetDataDicList(dmhr.badoCorp, 'CorpID', 'ChnName');
FCorpList.Insert(0, '全部公司=-1');
FillValueToCombo(iwcCorp, FCorpList);
dmHR.badoHuman.Active := True;
except
//Todo:增加错误反馈信息
end;
end;
procedure TformHumanList.iwbLastPageClick(Sender: TObject);
begin
inherited;
dmHR.badoHuman.MoveBy(-iwdgHumanList.RowLimit);
end;
procedure TformHumanList.iwbNextPageClick(Sender: TObject);
begin
inherited;
dmHR.badoHuman.MoveBy(iwdgHumanList.RowLimit);
end;
//procedure TformHumanList.IWAppFormRender(Sender: TObject);
//begin
// //注意:不加这句话,intraweb总是在itemindex=-1时加上那句NoSelection,shit
// //感觉像是bug,通常当itemindex=0时会出现将itemindex自动设为-1了
// if iwcCorp.ItemIndex=-1 then
// iwcCorp.ItemIndex:=0;
// inherited;
//end;
procedure TformHumanList.iwdnHumanListEdit(Sender: TObject);
begin
//inherited;
//编辑人员信息记录
FEditForm.EditMode := emEdit;
FEditForm.HID := dmhr.badoHuman.FieldByName('HID').AsInteger;
FEditForm.Show;
end;
procedure TformHumanList.iwdnHumanListInsert(Sender: TObject);
begin
//inherited;
//插入人员信息记录
FEditForm.EditMode := emInsert;
FEditForm.Show;
end;
procedure TformHumanList.iwcCorpChange(Sender: TObject);
var
CorpId: Integer;
begin
inherited;
//过滤公司内容
if iwcCorp.ItemIndex = -1 then
CorpId := -1
else
CorpId := StrToInt(GetKeyFromCombo(iwcCorp, FCorpList));
case CorpId of
-1: //显示全部的人员信息
begin
dmHR.badoHuman.Filter := '';
end;
else
begin
dmHR.badoHuman.Filter := format('CorpID=%d', [CorpId]);
//CodeSite.sendstring('Filter',dmhr.badoHuman.Filter);
end;
end;
dmHR.badoHuman.Refresh;
end;
procedure TformHumanList.iwdgHumanListRenderCell(ACell: TIWGridCell;
const ARow, AColumn: Integer);
const
ColCorp = 1;
ColSex = 2;
ColCountry = 5;
ColEdu = 6;
ColEng = 7;
begin
inherited;
if Trim(ACell.Text) = '' then
Exit;
if ARow > 0 then
begin
case AColumn of
ColCorp:
begin
ACell.Text := GetValueByKey(FCorpList, ACell.Text);
end;
ColSex:
begin
ACell.Text := GetValueByKey(FEditForm.FSexList, ACell.Text);
end;
ColCountry:
begin
ACell.Text := GetValueByKey(FEditForm.FCountryList, ACell.Text);
end;
ColEdu:
begin
ACell.Text := GetValueByKey(FEditForm.FEduLevelList, ACell.Text);
end;
ColEng:
begin
ACell.Text := GetValueByKey(FEditForm.FEngLevelList, ACell.Text);
end;
end;
end;
end;
procedure TformHumanList.IWButton1Click(Sender: TObject);
var
ID:Integer;
begin
inherited;
//
with dmHR do
begin
adocHR.BeginTrans;
try
ID:=badoHuman.FieldByName('hid').AsInteger;
adocEdit.commandText := format('delete from tblHumanTech where HId=%d',
[ID]);
adocEdit.Execute;
adocEdit.CommandText:=Format('delete from tblhuman where hid=%d', [ID]);
adocEdit.Execute;
adocHR.CommitTrans;
badohuman.requery;
except
adocHR.RollbackTrans;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -