unit uDatosBancariosEmpresaController; interface uses Windows, Forms, Classes, Controls, Contnrs, SysUtils, uDADataTable, uBizEmpresas, uBizEmpresasDatosBancarios, uIDataModuleEmpresas, uControllerBase; type IDatosBancariosEmpresaController = interface(IControllerBase) ['{E9B0313E-7B16-420A-B47E-20E42E96BAC6}'] procedure Ver(ADatosBancarios : IBizEmpresasDatosBancarios); end; TDatosBancariosEmpresaController = class(TControllerBase, IDatosBancariosEmpresaController) private FDataModule : IDataModuleEmpresas; protected public function ValidarDatosBancarios(ADatosBancarios : IBizEmpresasDatosBancarios; AEmpresa : IBizEmpresa): Boolean; virtual; procedure Ver(ADatosBancarios : IBizEmpresasDatosBancarios); constructor Create; override; destructor Destroy; override; end; implementation { TDatosBancariosEmpresaController } uses uDataModuleEmpresas, schEmpresasClient_Intf, uIEditorDatosBancarioEmpresa, uEditorRegistryUtils, cxControls; constructor TDatosBancariosEmpresaController.Create; begin inherited; // FDataModule := TDataModuleEmpresas.Create(Nil); end; destructor TDatosBancariosEmpresaController.Destroy; begin FDataModule := Nil; inherited; end; function TDatosBancariosEmpresaController.ValidarDatosBancarios( ADatosBancarios: IBizEmpresasDatosBancarios; AEmpresa : IBizEmpresa): Boolean; begin ADatosBancarios.DataTable.Edit; try if not ADatosBancarios.IBANIsNull then ADatosBancarios.IBAN := StringReplace(ADatosBancarios.IBAN, ' ', '', [rfReplaceAll]); // Quitar espacios if ADatosBancarios.SUFIJO_PRESENTADORIsNull then ADatosBancarios.SUFIJO_PRESENTADOR := ADatosBancarios.SUFIJO_ACREEDOR; if ADatosBancarios.ENTIDAD_PRESENTADORIsNull then ADatosBancarios.ENTIDAD_PRESENTADOR := ADatosBancarios.ENTIDAD; if ADatosBancarios.SUCURSAL_PRESENTADORIsNull then ADatosBancarios.SUCURSAL_PRESENTADOR := ADatosBancarios.SUCURSAL; if ADatosBancarios.NIF_CIF_PRESENTADORIsNull then ADatosBancarios.NIF_CIF_PRESENTADOR := AEmpresa.NIF_CIF; if ADatosBancarios.NOMBRE_PRESENTADORIsNull then ADatosBancarios.NOMBRE_PRESENTADOR := AEmpresa.NOMBRE; finally ADatosBancarios.DataTable.Post; Result := True; end; end; procedure TDatosBancariosEmpresaController.Ver(ADatosBancarios : IBizEmpresasDatosBancarios); var AEditor : IEditorDatosBancariosEmpresa; begin AEditor := NIL; CreateEditor('EditorDatosBancariosEmpresa', IEditorDatosBancariosEmpresa, AEditor); if Assigned(AEditor) then begin try AEditor.DatosBancarios := ADatosBancarios; AEditor.Controller := Self; AEditor.ShowModal; finally AEditor.Release; AEditor := NIL; end; end; end; end.