git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES/trunk@5 9a1d36f3-7752-2d40-8ccb-50eb49674c68
92 lines
2.7 KiB
ObjectPascal
92 lines
2.7 KiB
ObjectPascal
unit srvComisiones_Impl;
|
|
|
|
{----------------------------------------------------------------------------}
|
|
{ This unit was automatically generated by the RemObjects SDK after reading }
|
|
{ the RODL file associated with this project . }
|
|
{ }
|
|
{ This is where you are supposed to code the implementation of your objects. }
|
|
{----------------------------------------------------------------------------}
|
|
|
|
interface
|
|
|
|
uses
|
|
{vcl:} Classes, SysUtils,
|
|
{RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
|
|
{Ancestor Implementation:} DARemoteService_Impl,
|
|
{Used RODLs:} DataAbstract_Intf,
|
|
{Generated:} FactuGES_Intf, uDAClasses, uDataModuleServer, uDADataTable,
|
|
uDABINAdapter;
|
|
|
|
type
|
|
{ TsrvComisiones }
|
|
TsrvComisiones = class(TDARemoteService, IsrvComisiones)
|
|
DABINAdapter: TDABINAdapter;
|
|
schComisiones: TDASchema;
|
|
private
|
|
protected
|
|
function GetComision(const CodigoContacto: Integer): Double;
|
|
procedure SetComision(const CodigoContacto: Integer; const Value: Double);
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
uses
|
|
{Generated:} FactuGES_Invk,
|
|
uDAInterfaces, Dialogs;
|
|
|
|
procedure Create_srvComisiones(out anInstance : IUnknown);
|
|
begin
|
|
anInstance := TsrvComisiones.Create(NIL);
|
|
end;
|
|
|
|
{ srvComisiones }
|
|
{ TsrvComisiones }
|
|
|
|
function TsrvComisiones.GetComision(const CodigoContacto: Integer): Double;
|
|
var
|
|
dsComision: IDADataset;
|
|
begin
|
|
Result := 0;
|
|
Connection.BeginTransaction;
|
|
try
|
|
dsComision := schComisiones.NewDataset(Connection, 'COMISIONES', ['CODIGOCONTACTO'], [CodigoContacto]);
|
|
dsComision.Open;
|
|
if dsComision.RecordCount > 0 then
|
|
Result := dsComision.FieldValues[0];
|
|
dsComision.Close;
|
|
except
|
|
on E: Exception do
|
|
Result := 0;
|
|
end;
|
|
Connection.RollbackTransaction;
|
|
end;
|
|
|
|
procedure TsrvComisiones.SetComision(const CodigoContacto: Integer;
|
|
const Value: Double);
|
|
var
|
|
dsComision: IDASQLCommand;
|
|
begin
|
|
Connection.BeginTransaction;
|
|
try
|
|
dsComision := schComisiones.NewCommand(Connection, 'Update_COMISIONES', ['CODIGOCONTACTO', 'COMISION'], [CodigoContacto, Value], False);
|
|
if dsComision.Execute = 0 then
|
|
// No Existe la fila asi que la insertamos
|
|
dsComision := schComisiones.NewCommand(Connection, 'Insert_COMISIONES', ['CODIGOCONTACTO', 'COMISION'], [CodigoContacto, Value]);
|
|
Connection.CommitTransaction;
|
|
except
|
|
on E: Exception do
|
|
begin
|
|
Connection.RollbackTransaction;
|
|
raise;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
initialization
|
|
TROClassFactory.Create('srvComisiones', Create_srvComisiones, TsrvComisiones_Invoker);
|
|
|
|
finalization
|
|
|
|
end.
|