diff --git a/Source/Modulos/Delegaciones/Controller/Delegaciones_controller.dpk b/Source/Modulos/Delegaciones/Controller/Delegaciones_controller.dpk new file mode 100644 index 0000000..b5b5bc2 Binary files /dev/null and b/Source/Modulos/Delegaciones/Controller/Delegaciones_controller.dpk differ diff --git a/Source/Modulos/Delegaciones/Controller/Delegaciones_controller.dproj b/Source/Modulos/Delegaciones/Controller/Delegaciones_controller.dproj new file mode 100644 index 0000000..3d8f1dc --- /dev/null +++ b/Source/Modulos/Delegaciones/Controller/Delegaciones_controller.dproj @@ -0,0 +1,543 @@ + + + + {7f80f8aa-6912-4714-986d-aed73035472b} + Delegaciones_controller.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\Output\Debug\Cliente\Delegaciones_controller.bpl + + + 7.0 + False + False + 0 + .\ + .\ + .\ + ..\..\..\..\Output\Release\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + RELEASE + + + 7.0 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + + + Delphi.Personality + Package + +FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0Delegaciones_controller.dpk + + + + + MainSource + + + + + + + + + + + + + diff --git a/Source/Modulos/Delegaciones/Controller/View/uIEditorDelegaciones.pas b/Source/Modulos/Delegaciones/Controller/View/uIEditorDelegaciones.pas new file mode 100644 index 0000000..b5954d5 --- /dev/null +++ b/Source/Modulos/Delegaciones/Controller/View/uIEditorDelegaciones.pas @@ -0,0 +1,23 @@ +unit uIEditorDelegaciones; + +interface + +uses + uEditorDBBase, uBizDelegaciones, uDelegacionesController; + +type + IEditorDelegaciones = interface(IEditorDBBase) + ['{B40A7484-AD56-4D95-AFF6-E43DADE57CF7}'] + function GetDelegaciones: IBizDelegacion; + procedure SetDelegaciones(const Value: IBizDelegacion); + property Delegaciones: IBizDelegacion read GetDelegaciones write SetDelegaciones; + + function GetController : IDelegacionesController; + procedure SetController (const Value : IDelegacionesController); + property Controller : IDelegacionesController read GetController write SetController; + end; + + +implementation + +end. diff --git a/Source/Modulos/Delegaciones/Controller/uDelegacionesController.pas b/Source/Modulos/Delegaciones/Controller/uDelegacionesController.pas new file mode 100644 index 0000000..b085a1c --- /dev/null +++ b/Source/Modulos/Delegaciones/Controller/uDelegacionesController.pas @@ -0,0 +1,234 @@ +unit uDelegacionesController; + +interface + + +uses + Classes, SysUtils, uDADataTable, uControllerBase, uEditorDBItem, + uIDataModuleDelegaciones, uBizDelegaciones; + +type + IDelegacionesController = interface(IControllerBase) + ['{D3B7113C-C525-4400-8A21-B05BF4341ED8}'] + function BuscarTodos: IBizDelegacion; + procedure VerTodos(ADelegaciones: IBizDelegacion); + procedure Anadir(ADelegacion : IBizDelegacion); + function Eliminar(ADelegacion : IBizDelegacion): Boolean; + function Guardar(ADelegacion : IBizDelegacion): Boolean; + procedure DescartarCambios(ADelegacion : IBizDelegacion); + function Localizar(ADelegaciones: IBizDelegacion; ADescripcion:String): Boolean; + function DarListaDelegaciones: TStringList; + end; + + TDelegacionesController = class(TControllerBase, IDelegacionesController) + protected + FDataModule : IDataModuleDelegaciones; + + procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); override; + function CreateEditor(const AName : String; const IID: TGUID; out Intf): Boolean; + + function ValidarDelegacion(ADelegacion: IBizDelegacion): Boolean; + + //Estos son los tres métodos a sobre escribir si se desea heredar toda la logica de + //este controller + procedure AsignarDataModule; virtual; + + procedure ValidarObjetos; virtual; + + public + constructor Create; override; + destructor Destroy; override; + + function Eliminar(ADelegacion : IBizDelegacion): Boolean; + function Guardar(ADelegacion : IBizDelegacion): Boolean; + procedure DescartarCambios(ADelegacion : IBizDelegacion); virtual; + procedure Anadir(ADelegacion : IBizDelegacion); + function BuscarTodos: IBizDelegacion; + procedure VerTodos(ADelegaciones: IBizDelegacion); + function Localizar(ADelegaciones: IBizDelegacion; ADescripcion:String): Boolean; + function DarListaDelegaciones: TStringList; + end; + +implementation + +uses + cxControls, DB, uEditorRegistryUtils, schDelegacionesClient_Intf, + uIEditorDelegaciones, uDataModuleDelegaciones, + uDAInterfaces, uDataTableUtils, + uDateUtils, uROTypes, DateUtils, Controls, Windows; + +{ TDelegacionesController } + +procedure TDelegacionesController.Anadir(ADelegacion: IBizDelegacion); +begin + ADelegacion.Insert; +end; + +procedure TDelegacionesController.AsignarDataModule; +begin + FDataModule := TDataModuleDelegaciones.Create(Nil); +end; + +function TDelegacionesController.BuscarTodos: IBizDelegacion; +begin + Result := FDataModule.GetItems; +end; + +constructor TDelegacionesController.Create; +begin + inherited; + AsignarDataModule; +end; + +function TDelegacionesController.CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean; +begin + Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); +end; + +function TDelegacionesController.DarListaDelegaciones: TStringList; +var + ADelegaciones: IBizDelegacion; +begin + ADelegaciones := BuscarTodos; + ADelegaciones.DataTable.Active := True; + Result := TStringList.Create; + try + with Result do + begin + ADelegaciones.DataTable.First; + while not ADelegaciones.DataTable.EOF do + begin + Add(ADelegaciones.DESCRIPCION); + ADelegaciones.DataTable.Next; + end; + end; + finally + ADelegaciones := NIL; + end; +end; + +procedure TDelegacionesController.DescartarCambios(ADelegacion: IBizDelegacion); +begin + if not Assigned(ADelegacion) then + raise Exception.Create ('Delegación no asignada'); + + ShowHourglassCursor; + try + if (ADelegacion.State in dsEditModes) then + ADelegacion.Cancel; + + ADelegacion.DataTable.CancelUpdates; + finally + HideHourglassCursor; + end; +end; + +destructor TDelegacionesController.Destroy; +begin + FDataModule := Nil; + inherited; +end; + +function TDelegacionesController.ValidarDelegacion(ADelegacion: IBizDelegacion): Boolean; +begin + Result := False; + + if not Assigned(ADelegacion) then + raise Exception.Create ('Delegación no asignada'); + + if (ADelegacion.DataTable.State in dsEditModes) then + ADelegacion.DataTable.Post; + + Result := True; +end; + +procedure TDelegacionesController.ValidarObjetos; +begin +// +end; + +procedure TDelegacionesController.VerTodos(ADelegaciones: IBizDelegacion); +var + AEditor : IEditorDelegaciones; +begin + AEditor := NIL; + + CreateEditor('EditorDelegaciones', IEditorDelegaciones, AEditor); + if Assigned(AEditor) then + try + AEditor.Controller := Self; //OJO ORDEN MUY IMPORTANTE + AEditor.Delegaciones := ADelegaciones; + AEditor.ShowModal; + finally + AEditor.Release; + AEditor := NIL; + end; +end; + +function TDelegacionesController.Eliminar(ADelegacion: IBizDelegacion): Boolean; +begin + Result := False; + + if not Assigned(ADelegacion) then + raise Exception.Create ('Delegación no asignada'); + + ShowHourglassCursor; + try + if (ADelegacion.State in dsEditModes) then + ADelegacion.Cancel; + + ADelegacion.Delete; + ADelegacion.DataTable.ApplyUpdates; + HideHourglassCursor; + Result := True; + finally + HideHourglassCursor; + end; +end; + +procedure TDelegacionesController.RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); +begin + inherited; +// +end; + +function TDelegacionesController.Guardar(ADelegacion: IBizDelegacion): Boolean; +begin + Result := False; + + if not Assigned(ADelegacion) then + raise Exception.Create ('Delegación no asignada'); + + ValidarObjetos; + + if ValidarDelegacion(ADelegacion) then + begin + ShowHourglassCursor; + try + ADelegacion.DataTable.ApplyUpdates; + Result := True; + finally + HideHourglassCursor; + end; + end; +end; + +function TDelegacionesController.Localizar(ADelegaciones: IBizDelegacion; ADescripcion: String): Boolean; +begin + Result := True; + ShowHourglassCursor; + try + with ADelegaciones.DataTable do + begin + DisableControls; + First; + if not Locate(fld_DelegacionesDESCRIPCION, ADescripcion, []) then + Result := False; + EnableControls; + end; + finally + HideHourglassCursor; + end; +end; + +end. diff --git a/Source/Modulos/Delegaciones/Data/Delegaciones_data.dpk b/Source/Modulos/Delegaciones/Data/Delegaciones_data.dpk new file mode 100644 index 0000000..03aa287 Binary files /dev/null and b/Source/Modulos/Delegaciones/Data/Delegaciones_data.dpk differ diff --git a/Source/Modulos/Delegaciones/Data/Delegaciones_data.dproj b/Source/Modulos/Delegaciones/Data/Delegaciones_data.dproj new file mode 100644 index 0000000..fac76c7 --- /dev/null +++ b/Source/Modulos/Delegaciones/Data/Delegaciones_data.dproj @@ -0,0 +1,546 @@ + + + + {55d06c67-fc74-4d88-8787-801dee872bb3} + Delegaciones_data.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\Output\Debug\Cliente\Delegaciones_data.bpl + + + 7.0 + False + False + 0 + 3 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + RELEASE + + + 7.0 + 3 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + + + Delphi.Personality + Package + +FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0Delegaciones_data.dpk + + + + + MainSource + + + + + + + + +
DataModuleDelegaciones
+ TDAClientDataModule +
+
+
+ diff --git a/Source/Modulos/Delegaciones/Data/uDataModuleDelegaciones.dfm b/Source/Modulos/Delegaciones/Data/uDataModuleDelegaciones.dfm new file mode 100644 index 0000000..193d9c8 --- /dev/null +++ b/Source/Modulos/Delegaciones/Data/uDataModuleDelegaciones.dfm @@ -0,0 +1,57 @@ +inherited DataModuleDelegaciones: TDataModuleDelegaciones + OnCreate = DAClientDataModuleCreate + Height = 248 + Width = 489 + object RORemoteService: TRORemoteService + Message = dmConexion.ROMessage + Channel = dmConexion.ROChannel + ServiceName = 'srvDelegaciones' + Left = 48 + Top = 24 + end + object rda_delegaciones: TDARemoteDataAdapter + DataStreamer = Bin2DataStreamer + GetSchemaCall.RemoteService = RORemoteService + GetDataCall.RemoteService = RORemoteService + UpdateDataCall.RemoteService = RORemoteService + GetScriptsCall.RemoteService = RORemoteService + RemoteService = RORemoteService + Left = 203 + Top = 23 + end + object Bin2DataStreamer: TDABin2DataStreamer + Left = 48 + Top = 96 + end + object tbl_Delegaciones: TDAMemDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ID' + DataType = datAutoInc + GeneratorName = 'GEN_DELEGACIONES_ID' + Required = True + InPrimaryKey = True + end + item + Name = 'DESCRIPCION' + DataType = datString + Size = 255 + DisplayLabel = 'Delegaciones_DESCRIPCION' + DictionaryEntry = 'Delegaciones_DESCRIPCION' + end> + Params = <> + StreamingOptions = [soDisableEventsWhileStreaming] + RemoteDataAdapter = rda_delegaciones + LogicalName = 'Delegaciones' + IndexDefs = <> + Left = 352 + Top = 96 + end + object ds_Delegaciones: TDADataSource + DataSet = tbl_Delegaciones.Dataset + DataTable = tbl_Delegaciones + Left = 352 + Top = 32 + end +end diff --git a/Source/Modulos/Delegaciones/Data/uDataModuleDelegaciones.pas b/Source/Modulos/Delegaciones/Data/uDataModuleDelegaciones.pas new file mode 100644 index 0000000..ed72e1e --- /dev/null +++ b/Source/Modulos/Delegaciones/Data/uDataModuleDelegaciones.pas @@ -0,0 +1,112 @@ +{ +=============================================================================== + Copyright (©) 2007. Rodax Software. +=============================================================================== + Los contenidos de este fichero son propiedad de Rodax Software titular del + copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado, + en su totalidad o en parte, con el permiso escrito de Rodax Software, o de + acuerdo con los términos y condiciones establecidas en el acuerdo/contrato + bajo el que se suministra. + ----------------------------------------------------------------------------- + Web: www.rodax-software.com +=============================================================================== + Fecha primera versión: + Versión actual: 1.0.0 + Fecha versión actual: +=============================================================================== + Modificaciones: + + Fecha Comentarios + --------------------------------------------------------------------------- +=============================================================================== +} + +unit uDataModuleDelegaciones; + +interface + +uses + SysUtils, Classes, DB, uDADataTable, uDABINAdapter, + uDAScriptingProvider, uDACDSDataTable, uROWinInetHttpChannel, uROTypes, + uRORemoteService, uROClient, uROBinMessage, + uDADesigntimeCall, + + uIDataModuleDelegaciones, uBizDelegaciones, uDADataStreamer, uDARemoteDataAdapter, + uDAInterfaces, uRODynamicRequest, uDABin2DataStreamer, uDAMemDataTable, + uDataModuleBase; + +type + TDataModuleDelegaciones = class(TDataModuleBase, IDataModuleDelegaciones) + RORemoteService: TRORemoteService; + rda_delegaciones: TDARemoteDataAdapter; + Bin2DataStreamer: TDABin2DataStreamer; + tbl_Delegaciones: TDAMemDataTable; + ds_Delegaciones: TDADataSource; + procedure DAClientDataModuleCreate(Sender: TObject); + public + function GetItems: IBizDelegacion; + function GetItem(const ID : Integer) : IBizDelegacion; + function NewItem : IBizDelegacion; + end; + +implementation + +{$R *.DFM} + +uses + FactuGES_Intf, uDataModuleConexion, uDataTableUtils, cxControls, + schDelegacionesClient_Intf; + +{ TDataModuleDelegaciones } + +procedure TDataModuleDelegaciones.DAClientDataModuleCreate(Sender: TObject); +begin + RORemoteService.Channel := dmConexion.Channel; + RORemoteService.Message := dmConexion.Message; +end; + +function TDataModuleDelegaciones.GetItems: IBizDelegacion; +var + ADelegacion : TDAMemDataTable; +begin + ShowHourglassCursor; + try + ADelegacion := CloneDataTable(tbl_Delegaciones); + ADelegacion.BusinessRulesID := BIZ_CLIENT_Delegacion; + + Result := (ADelegacion as IBizDelegacion); + finally + HideHourglassCursor; + end; +end; + +function TDataModuleDelegaciones.NewItem: IBizDelegacion; +begin + Result := GetItem(ID_NULO) +end; + +function TDataModuleDelegaciones.GetItem(const ID: Integer): IBizDelegacion; +var + Condicion: TDAWhereExpression; +begin + ShowHourglassCursor; + try + Result := Self.GetItems; + + with Result.DataTable.DynamicWhere do + begin + // (ID = :ID) + Condicion := NewBinaryExpression(NewField('', fld_DelegacionesID), NewConstant(ID, datInteger), dboEqual); + + if IsEmpty then + Expression := Condicion + else + Expression := NewBinaryExpression(Expression, Condicion, dboAnd); + end; + + finally + HideHourglassCursor; + end; +end; + +end. diff --git a/Source/Modulos/Delegaciones/Delegaciones_Group.groupproj b/Source/Modulos/Delegaciones/Delegaciones_Group.groupproj new file mode 100644 index 0000000..2667c8b --- /dev/null +++ b/Source/Modulos/Delegaciones/Delegaciones_Group.groupproj @@ -0,0 +1,124 @@ + + + {033276d8-059f-49be-9cc2-3276e536a74d} + + + + + + + + + + + + + + + + Default.Personality + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Modulos/Delegaciones/Model/Data/uIDataModuleDelegaciones.pas b/Source/Modulos/Delegaciones/Model/Data/uIDataModuleDelegaciones.pas new file mode 100644 index 0000000..1e46ad8 --- /dev/null +++ b/Source/Modulos/Delegaciones/Model/Data/uIDataModuleDelegaciones.pas @@ -0,0 +1,42 @@ +{ +=============================================================================== + Copyright (©) 2007. Rodax Software. +=============================================================================== + Los contenidos de este fichero son propiedad de Rodax Software titular del + copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado, + en su totalidad o en parte, con el permiso escrito de Rodax Software, o de + acuerdo con los términos y condiciones establecidas en el acuerdo/contrato + bajo el que se suministra. + ----------------------------------------------------------------------------- + Web: www.rodax-software.com +=============================================================================== + Fecha primera versión: + Versión actual: 1.0.0 + Fecha versión actual: +=============================================================================== + Modificaciones: + + Fecha Comentarios + --------------------------------------------------------------------------- +=============================================================================== +} + +unit uIDataModuleDelegaciones; + +interface + +uses + uBizDelegaciones; + +type + IDataModuleDelegaciones = interface + ['{8256C354-1B41-42A4-B259-F60CE741D720}'] + function GetItems: IBizDelegacion; + function GetItem(const ID : Integer) : IBizDelegacion; + function NewItem : IBizDelegacion; + + end; + +implementation + +end. diff --git a/Source/Modulos/Delegaciones/Model/Delegaciones_model.dpk b/Source/Modulos/Delegaciones/Model/Delegaciones_model.dpk new file mode 100644 index 0000000..455892f Binary files /dev/null and b/Source/Modulos/Delegaciones/Model/Delegaciones_model.dpk differ diff --git a/Source/Modulos/Delegaciones/Model/Delegaciones_model.dproj b/Source/Modulos/Delegaciones/Model/Delegaciones_model.dproj new file mode 100644 index 0000000..9d9cce3 --- /dev/null +++ b/Source/Modulos/Delegaciones/Model/Delegaciones_model.dproj @@ -0,0 +1,545 @@ + + + + {82fe21d8-609d-444d-879e-4d9e1c291607} + Delegaciones_model.dpk + Debug + AnyCPU + DCC32 + ..\..\..\..\Output\Debug\Cliente\Delegaciones_model.bpl + + + 7.0 + False + False + 0 + 3 + .\ + .\ + .\ + ..\..\..\..\Output\Release\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + RELEASE + + + 7.0 + 3 + .\ + .\ + .\ + ..\..\..\..\Output\Debug\Cliente + ..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + ..\..\..\Lib;..\..\Lib + + + Delphi.Personality + Package + +FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0Delegaciones_model.dpk + + + + + MainSource + + + + + + + + + + + + + diff --git a/Source/Modulos/Delegaciones/Model/schDelegacionesClient_Intf.pas b/Source/Modulos/Delegaciones/Model/schDelegacionesClient_Intf.pas new file mode 100644 index 0000000..9a4770a --- /dev/null +++ b/Source/Modulos/Delegaciones/Model/schDelegacionesClient_Intf.pas @@ -0,0 +1,134 @@ +unit schDelegacionesClient_Intf; + +interface + +uses + Classes, DB, schBase_Intf, SysUtils, uROClasses, uDAInterfaces, uDADataTable, FmtBCD, uROXMLIntf; + +const + { Data table rules ids + Feel free to change them to something more human readable + but make sure they are unique in the context of your application } + RID_Delegaciones = '{483FFD64-AFEB-4A87-880D-918F5F5ABFD5}'; + + { Data table names } + nme_Delegaciones = 'Delegaciones'; + + { Delegaciones fields } + fld_DelegacionesID = 'ID'; + fld_DelegacionesDESCRIPCION = 'DESCRIPCION'; + + { Delegaciones field indexes } + idx_DelegacionesID = 0; + idx_DelegacionesDESCRIPCION = 1; + +type + { IDelegaciones } + IDelegaciones = interface(IDAStronglyTypedDataTable) + ['{B7985C38-9BE8-47FD-AFA4-933E88E93621}'] + { Property getters and setters } + function GetIDValue: Integer; + procedure SetIDValue(const aValue: Integer); + function GetIDIsNull: Boolean; + procedure SetIDIsNull(const aValue: Boolean); + function GetDESCRIPCIONValue: String; + procedure SetDESCRIPCIONValue(const aValue: String); + function GetDESCRIPCIONIsNull: Boolean; + procedure SetDESCRIPCIONIsNull(const aValue: Boolean); + + + { Properties } + property ID: Integer read GetIDValue write SetIDValue; + property IDIsNull: Boolean read GetIDIsNull write SetIDIsNull; + property DESCRIPCION: String read GetDESCRIPCIONValue write SetDESCRIPCIONValue; + property DESCRIPCIONIsNull: Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull; + end; + + { TDelegacionesDataTableRules } + TDelegacionesDataTableRules = class(TIntfObjectDADataTableRules, IDelegaciones) + private + protected + { Property getters and setters } + function GetIDValue: Integer; virtual; + procedure SetIDValue(const aValue: Integer); virtual; + function GetIDIsNull: Boolean; virtual; + procedure SetIDIsNull(const aValue: Boolean); virtual; + function GetDESCRIPCIONValue: String; virtual; + procedure SetDESCRIPCIONValue(const aValue: String); virtual; + function GetDESCRIPCIONIsNull: Boolean; virtual; + procedure SetDESCRIPCIONIsNull(const aValue: Boolean); virtual; + + { Properties } + property ID: Integer read GetIDValue write SetIDValue; + property IDIsNull: Boolean read GetIDIsNull write SetIDIsNull; + property DESCRIPCION: String read GetDESCRIPCIONValue write SetDESCRIPCIONValue; + property DESCRIPCIONIsNull: Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull; + + public + constructor Create(aDataTable: TDADataTable); override; + destructor Destroy; override; + + end; + +implementation + +uses Variants, uROBinaryHelpers; + +{ TDelegacionesDataTableRules } +constructor TDelegacionesDataTableRules.Create(aDataTable: TDADataTable); +begin + inherited; +end; + +destructor TDelegacionesDataTableRules.Destroy; +begin + inherited; +end; + +function TDelegacionesDataTableRules.GetIDValue: Integer; +begin + result := DataTable.Fields[idx_DelegacionesID].AsInteger; +end; + +procedure TDelegacionesDataTableRules.SetIDValue(const aValue: Integer); +begin + DataTable.Fields[idx_DelegacionesID].AsInteger := aValue; +end; + +function TDelegacionesDataTableRules.GetIDIsNull: boolean; +begin + result := DataTable.Fields[idx_DelegacionesID].IsNull; +end; + +procedure TDelegacionesDataTableRules.SetIDIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_DelegacionesID].AsVariant := Null; +end; + +function TDelegacionesDataTableRules.GetDESCRIPCIONValue: String; +begin + result := DataTable.Fields[idx_DelegacionesDESCRIPCION].AsString; +end; + +procedure TDelegacionesDataTableRules.SetDESCRIPCIONValue(const aValue: String); +begin + DataTable.Fields[idx_DelegacionesDESCRIPCION].AsString := aValue; +end; + +function TDelegacionesDataTableRules.GetDESCRIPCIONIsNull: boolean; +begin + result := DataTable.Fields[idx_DelegacionesDESCRIPCION].IsNull; +end; + +procedure TDelegacionesDataTableRules.SetDESCRIPCIONIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_DelegacionesDESCRIPCION].AsVariant := Null; +end; + + +initialization + RegisterDataTableRules(RID_Delegaciones, TDelegacionesDataTableRules); + +end. diff --git a/Source/Modulos/Delegaciones/Model/schDelegacionesServer_Intf.pas b/Source/Modulos/Delegaciones/Model/schDelegacionesServer_Intf.pas new file mode 100644 index 0000000..b0096cf --- /dev/null +++ b/Source/Modulos/Delegaciones/Model/schDelegacionesServer_Intf.pas @@ -0,0 +1,143 @@ +unit schDelegacionesServer_Intf; + +interface + +uses + Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, FmtBCD, uROXMLIntf, schDelegacionesClient_Intf; + +const + { Delta rules ids + Feel free to change them to something more human readable + but make sure they are unique in the context of your application } + RID_DelegacionesDelta = '{69DBAF9C-CA9F-4F5F-91BC-0AD7767FEC0B}'; + +type + { IDelegacionesDelta } + IDelegacionesDelta = interface(IDelegaciones) + ['{69DBAF9C-CA9F-4F5F-91BC-0AD7767FEC0B}'] + { Property getters and setters } + function GetOldIDValue : Integer; + function GetOldDESCRIPCIONValue : String; + + { Properties } + property OldID : Integer read GetOldIDValue; + property OldDESCRIPCION : String read GetOldDESCRIPCIONValue; + end; + + { TDelegacionesBusinessProcessorRules } + TDelegacionesBusinessProcessorRules = class(TDABusinessProcessorRules, IDelegaciones, IDelegacionesDelta) + private + protected + { Property getters and setters } + function GetIDValue: Integer; virtual; + function GetIDIsNull: Boolean; virtual; + function GetOldIDValue: Integer; virtual; + function GetOldIDIsNull: Boolean; virtual; + procedure SetIDValue(const aValue: Integer); virtual; + procedure SetIDIsNull(const aValue: Boolean); virtual; + function GetDESCRIPCIONValue: String; virtual; + function GetDESCRIPCIONIsNull: Boolean; virtual; + function GetOldDESCRIPCIONValue: String; virtual; + function GetOldDESCRIPCIONIsNull: Boolean; virtual; + procedure SetDESCRIPCIONValue(const aValue: String); virtual; + procedure SetDESCRIPCIONIsNull(const aValue: Boolean); virtual; + + { Properties } + property ID : Integer read GetIDValue write SetIDValue; + property IDIsNull : Boolean read GetIDIsNull write SetIDIsNull; + property OldID : Integer read GetOldIDValue; + property OldIDIsNull : Boolean read GetOldIDIsNull; + property DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue; + property DESCRIPCIONIsNull : Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull; + property OldDESCRIPCION : String read GetOldDESCRIPCIONValue; + property OldDESCRIPCIONIsNull : Boolean read GetOldDESCRIPCIONIsNull; + + public + constructor Create(aBusinessProcessor: TDABusinessProcessor); override; + destructor Destroy; override; + + end; + +implementation + +uses + Variants, uROBinaryHelpers, uDAInterfaces; + +{ TDelegacionesBusinessProcessorRules } +constructor TDelegacionesBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); +begin + inherited; +end; + +destructor TDelegacionesBusinessProcessorRules.Destroy; +begin + inherited; +end; + +function TDelegacionesBusinessProcessorRules.GetIDValue: Integer; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesID]; +end; + +function TDelegacionesBusinessProcessorRules.GetIDIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesID]); +end; + +function TDelegacionesBusinessProcessorRules.GetOldIDValue: Integer; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_DelegacionesID]; +end; + +function TDelegacionesBusinessProcessorRules.GetOldIDIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DelegacionesID]); +end; + +procedure TDelegacionesBusinessProcessorRules.SetIDValue(const aValue: Integer); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesID] := aValue; +end; + +procedure TDelegacionesBusinessProcessorRules.SetIDIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesID] := Null; +end; + +function TDelegacionesBusinessProcessorRules.GetDESCRIPCIONValue: String; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesDESCRIPCION]; +end; + +function TDelegacionesBusinessProcessorRules.GetDESCRIPCIONIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesDESCRIPCION]); +end; + +function TDelegacionesBusinessProcessorRules.GetOldDESCRIPCIONValue: String; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_DelegacionesDESCRIPCION]; +end; + +function TDelegacionesBusinessProcessorRules.GetOldDESCRIPCIONIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DelegacionesDESCRIPCION]); +end; + +procedure TDelegacionesBusinessProcessorRules.SetDESCRIPCIONValue(const aValue: String); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesDESCRIPCION] := aValue; +end; + +procedure TDelegacionesBusinessProcessorRules.SetDESCRIPCIONIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_DelegacionesDESCRIPCION] := Null; +end; + + +initialization + RegisterBusinessProcessorRules(RID_DelegacionesDelta, TDelegacionesBusinessProcessorRules); + +end.