unit allcl1;
//Client application for using distributed transactions
//By N.Elmanova
//05.12.1998
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, DBGrids, Db, DBClient, StdCtrls, MConnect, ExtCtrls, ComCtrls;
type
TForm1 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
DCOMConnection1: TDCOMConnection;
ClientDataSet1: TClientDataSet;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Edit1: TEdit;
Label1: TLabel;
Button1: TButton;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
Splitter1: TSplitter;
DCOMConnection2: TDCOMConnection;
ClientDataSet2: TClientDataSet;
DataSource2: TDataSource;
DCOMConnection3: TDCOMConnection;
ClientDataSet3: TClientDataSet;
DataSource3: TDataSource;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var n:integer;val:double;gnam,addr:widestring;
begin
try
n:= ClientDataSet1.FieldByName('GOODSNUMBER').Value;
val:= ClientDataSet1.FieldByName('PRICE').Value;
gnam:= ClientDataSet1.FieldByName('GOODSNAME').Value;
addr:=Edit1.Text;
DcomConnection2.Connected:=true;
DCOMConnection2.AppServer.DoTrans(n,val,addr,gnam);
ShowMessage('Заказ принят');
except
ShowMessage('Заказ не принят ');
end;
DcomConnection2.Connected:=false;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
DCOMConnection1.Connected:=true;
DCOMConnection2.Connected:=true;
DCOMConnection3.Connected:=true;
CLientdataset1.data:=Dcomconnection1.Appserver.GetGoods;
CLientdataset2.data:=Dcomconnection2.Appserver.GetPays;
CLientdataset3.data:=Dcomconnection3.Appserver.GetDelivery;
DCOMCOnnection1.Connected:=false;
DCOMCOnnection2.Connected:=false;
DCOMCOnnection3.Connected:=false;
end;
end.