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

📄 businessobj.pas

📁 Delphi面向对象编程思想附书源码 好用哦!
💻 PAS
字号:
unit BusinessObj;


{本单元是基于特定窗体及其数据模块的业务逻辑代码,用于处理相关查询}
interface
 uses dbtables, db, dbgrids, Graphics,variants,Classes;

type
  TBiz = class(TComponent)
  private
    { Private declarations }
  public
    Procedure LocateCorrectAddress(var vqryAddress: Tquery;
                               const cstrType: string);
    Procedure HighLightBank(var vcolCurrent: TColumn;
                        const cintColumn: integer);
    Procedure FindRightBank(var vqryOrder, vqryFinancial: tQuery);
  end;

implementation

Procedure TBiz.LocateCorrectAddress(var vqryAddress: Tquery;
                               const cstrType: string);
begin
 vqryAddress.Locate('CustomerNumber;AddressType',
                    VarArrayOf([vqryAddress['CustomerNumber'], cstrType]),
                    []);
end;

{为某些含有特殊字符的银行名称进行着色处理,突出显示效果}
Procedure TBiz.HighLightBank(var vcolCurrent: TColumn;const cintColumn: integer);
begin
  If cintColumn = 2 then
    If pos('中国', vcolCurrent.Field.asstring) > 0 then
       vcolCurrent.Color := clAqua
    else
    If pos('USA', vcolCurrent.Field.asstring) > 0 then
       vcolCurrent.Color := clRed;
end;

Procedure TBiz.FindRightBank(var vqryOrder, vqryFinancial: tQuery);
begin
 {根据帐户号定位银行}
 vqryFinancial.Locate('CustomerNumber;CreditCard',
                    VarArrayOf([vqryOrder['CustomerNumber'],
                                vqryOrder['CreditCard']]),
                    []);
end;

end.

⌨️ 快捷键说明

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