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

📄 schoolmanager_tlb.pas

📁 学籍管理
💻 PAS
📖 第 1 页 / 共 2 页
字号:
// *********************************************************************//
 TSchoolMTSProperties = class(TPersistent)
  private
    FServer:    TSchoolMTS;
    function    GetDefaultInterface: ISchoolMTS;
    constructor Create(AServer: TSchoolMTS);
  protected
  public
    property DefaultInterface: ISchoolMTS read GetDefaultInterface;
  published
  end;
{$ENDIF}


procedure Register;

implementation

uses ComObj;

class function CoSchoolMTS.Create: ISchoolMTS;
begin
  Result := CreateComObject(CLASS_SchoolMTS) as ISchoolMTS;
end;

class function CoSchoolMTS.CreateRemote(const MachineName: string): ISchoolMTS;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_SchoolMTS) as ISchoolMTS;
end;

procedure TSchoolMTS.InitServerData;
const
  CServerData: TServerData = (
    ClassID:   '{99CFAB84-F322-4780-B78C-05A6F1DB47D4}';
    IntfIID:   '{2BF4138E-6A5E-4216-90AB-291A1D48C103}';
    EventIID:  '';
    LicenseKey: nil;
    Version: 500);
begin
  ServerData := @CServerData;
end;

procedure TSchoolMTS.Connect;
var
  punk: IUnknown;
begin
  if FIntf = nil then
  begin
    punk := GetServer;
    Fintf:= punk as ISchoolMTS;
  end;
end;

procedure TSchoolMTS.ConnectTo(svrIntf: ISchoolMTS);
begin
  Disconnect;
  FIntf := svrIntf;
end;

procedure TSchoolMTS.DisConnect;
begin
  if Fintf <> nil then
  begin
    FIntf := nil;
  end;
end;

function TSchoolMTS.GetDefaultInterface: ISchoolMTS;
begin
  if FIntf = nil then
    Connect;
  Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  Result := FIntf;
end;

constructor TSchoolMTS.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps := TSchoolMTSProperties.Create(Self);
{$ENDIF}
end;

destructor TSchoolMTS.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  FProps.Free;
{$ENDIF}
  inherited Destroy;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TSchoolMTS.GetServerProperties: TSchoolMTSProperties;
begin
  Result := FProps;
end;
{$ENDIF}

function  TSchoolMTS.AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; 
                                     MaxErrors: Integer; out ErrorCount: Integer; 
                                     var OwnerData: OleVariant): OleVariant;
begin
  Result := DefaultInterface.AS_ApplyUpdates(ProviderName, Delta, MaxErrors, ErrorCount, OwnerData);
end;

function  TSchoolMTS.AS_GetRecords(const ProviderName: WideString; Count: Integer; 
                                   out RecsOut: Integer; Options: Integer; 
                                   const CommandText: WideString; var Params: OleVariant; 
                                   var OwnerData: OleVariant): OleVariant;
begin
  Result := DefaultInterface.AS_GetRecords(ProviderName, Count, RecsOut, Options, CommandText, 
                                           Params, OwnerData);
end;

function  TSchoolMTS.AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant;
begin
  Result := DefaultInterface.AS_DataRequest(ProviderName, Data);
end;

function  TSchoolMTS.AS_GetProviderNames: OleVariant;
begin
  Result := DefaultInterface.AS_GetProviderNames;
end;

function  TSchoolMTS.AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant;
begin
  Result := DefaultInterface.AS_GetParams(ProviderName, OwnerData);
end;

function  TSchoolMTS.AS_RowRequest(const ProviderName: WideString; Row: OleVariant; 
                                   RequestType: Integer; var OwnerData: OleVariant): OleVariant;
begin
  Result := DefaultInterface.AS_RowRequest(ProviderName, Row, RequestType, OwnerData);
end;

procedure TSchoolMTS.AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
                                var Params: OleVariant; var OwnerData: OleVariant);
begin
  DefaultInterface.AS_Execute(ProviderName, CommandText, Params, OwnerData);
end;

procedure TSchoolMTS.GetHostNotes(var Notes: OleVariant);
begin
  DefaultInterface.GetHostNotes(Notes);
end;

procedure TSchoolMTS.GetSystemTime(var SystemTime: OleVariant);
begin
  DefaultInterface.GetSystemTime(SystemTime);
end;

procedure TSchoolMTS.GetSystemUse(var SystemUse: OleVariant);
begin
  DefaultInterface.GetSystemUse(SystemUse);
end;

procedure TSchoolMTS.GetAllTables(var TablesNames: OleVariant);
begin
  DefaultInterface.GetAllTables(TablesNames);
end;

procedure TSchoolMTS.SearchRecord(var CommandTxt: OleVariant);
begin
  DefaultInterface.SearchRecord(CommandTxt);
end;

procedure TSchoolMTS.NewPassword(var UseName: OleVariant; var OldPassword: OleVariant; 
                                 var NewPassword: OleVariant);
begin
  DefaultInterface.NewPassword(UseName, OldPassword, NewPassword);
end;

procedure TSchoolMTS.ClearLink;
begin
  DefaultInterface.ClearLink;
end;

{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TSchoolMTSProperties.Create(AServer: TSchoolMTS);
begin
  inherited Create;
  FServer := AServer;
end;

function TSchoolMTSProperties.GetDefaultInterface: ISchoolMTS;
begin
  Result := FServer.DefaultInterface;
end;

{$ENDIF}

procedure Register;
begin
  RegisterComponents('Servers',[TSchoolMTS]);
end;

end.

⌨️ 快捷键说明

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