UsuarioActivo ahora es de tipo TBizUsuarios.

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@235 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
David Arranz 2008-01-15 18:26:46 +00:00
parent 9b53c49069
commit bea34d6306
2 changed files with 18 additions and 20 deletions

View File

@ -34,8 +34,8 @@ type
procedure SetMaxIntentosLogin(const Value: Integer); procedure SetMaxIntentosLogin(const Value: Integer);
property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin; property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin;
function GetCurrentUser: TUCCurrentUser; function GetCurrentUser: IBizUsuario;
property CurrentUser: TUCCurrentUser read GetCurrentUser; property CurrentUser: IBizUsuario read GetCurrentUser;
function GuardarPerfil(APerfil : IBizPerfilUsuario): Boolean; function GuardarPerfil(APerfil : IBizPerfilUsuario): Boolean;
function GuardarUsuario(AUser : IBizUsuario): Boolean; function GuardarUsuario(AUser : IBizUsuario): Boolean;
@ -81,11 +81,11 @@ type
TUsuariosController = class(TControllerBase, IUsuariosController) TUsuariosController = class(TControllerBase, IUsuariosController)
private private
function Eliminar(const AIDUser: integer): Boolean; procedure FiltrarEmpresa(AUsuario: IBizUsuario);
procedure FiltrarEmpresa(AUsuario: IBizUsuario);
protected protected
FDataModule : IDataModuleUsuarios; FDataModule : IDataModuleUsuarios;
FUserControl: TUserControl; FUserControl: TUserControl;
FCurrentUser : IBizUsuario;
function GetMaxIntentosLogin: Integer; function GetMaxIntentosLogin: Integer;
procedure SetMaxIntentosLogin(const Value: Integer); procedure SetMaxIntentosLogin(const Value: Integer);
@ -96,7 +96,7 @@ type
procedure AsignarDataModule; procedure AsignarDataModule;
procedure InicializarUserControl; procedure InicializarUserControl;
procedure ComprobarUsuarioInicial; procedure ComprobarUsuarioInicial;
function GetCurrentUser: TUCCurrentUser; function GetCurrentUser: IBizUsuario;
function AnadirUsuario(AUser : IBizUsuario): Boolean; function AnadirUsuario(AUser : IBizUsuario): Boolean;
function ModificarUsuario(AUser : IBizUsuario): Boolean; function ModificarUsuario(AUser : IBizUsuario): Boolean;
@ -155,7 +155,7 @@ type
property UserControl : TUserControl read FUserControl; property UserControl : TUserControl read FUserControl;
property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin; property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin;
property CurrentUser: TUCCurrentUser read GetCurrentUser; property CurrentUser: IBizUsuario read GetCurrentUser;
property Criptografia: TUCCriptografia read GetCriptografia; property Criptografia: TUCCriptografia read GetCriptografia;
end; end;
@ -327,8 +327,8 @@ begin
if not Result then if not Result then
begin begin
ComprobarUsuarioInicial; ComprobarUsuarioInicial;
Result := ComprobarUsuario(User, Password); Result := ComprobarUsuario(User, Password);
end; end;
end; end;
procedure TUsuariosController.ComprobarUsuarioInicial; procedure TUsuariosController.ComprobarUsuarioInicial;
@ -341,6 +341,7 @@ end;
constructor TUsuariosController.Create; constructor TUsuariosController.Create;
begin begin
AsignarDataModule; AsignarDataModule;
FCurrentUser := NIL;
FUserControl := TUserControl.Create(nil); FUserControl := TUserControl.Create(nil);
InicializarUserControl; InicializarUserControl;
end; end;
@ -406,11 +407,6 @@ begin
inherited; inherited;
end; end;
function TUsuariosController.Eliminar(const AIDUser: integer): Boolean;
begin
//
end;
function TUsuariosController.EliminarPerfil( function TUsuariosController.EliminarPerfil(
APerfil: IBizPerfilUsuario): Boolean; APerfil: IBizPerfilUsuario): Boolean;
var var
@ -488,9 +484,11 @@ begin
end; end;
end; end;
function TUsuariosController.GetCurrentUser: TUCCurrentUser; function TUsuariosController.GetCurrentUser: IBizUsuario;
begin begin
Result := FUserControl.CurrentUser; if not Assigned(FCurrentUser) or (FCurrentUser.ID <> FUserControl.CurrentUser.UserID) then
FCurrentUser := BuscarUsuario(FUserControl.CurrentUser.UserID);
Result := FCurrentUser;
end; end;
function TUsuariosController.GetMaxIntentosLogin: Integer; function TUsuariosController.GetMaxIntentosLogin: Integer;

View File

@ -27,7 +27,7 @@ type
function GetUsuariosController: IUsuariosController; function GetUsuariosController: IUsuariosController;
function GetAppName: String; function GetAppName: String;
function GetAppVersion: String; function GetAppVersion: String;
function GetUsuarioActivo: TUsuario; function GetUsuarioActivo: IBizUsuario;
function GetEmpresaActiva: IBizEmpresa; function GetEmpresaActiva: IBizEmpresa;
function GetModuleManager : THostManager; function GetModuleManager : THostManager;
function GetTerminated: Boolean; function GetTerminated: Boolean;
@ -53,7 +53,7 @@ type
property AppName : String read GetAppName; property AppName : String read GetAppName;
property MainForm : TCustomForm read GetMainForm; property MainForm : TCustomForm read GetMainForm;
property EmpresaActiva : IBizEmpresa read GetEmpresaActiva; property EmpresaActiva : IBizEmpresa read GetEmpresaActiva;
property UsuarioActivo : TUsuario read GetUsuarioActivo; property UsuarioActivo : IBizUsuario read GetUsuarioActivo;
property EmpresasController : IEmpresasController read GetEmpresasController; property EmpresasController : IEmpresasController read GetEmpresasController;
property UsuariosController : IUsuariosController read GetUsuariosController; property UsuariosController : IUsuariosController read GetUsuariosController;
property AppSplashForm : IAppSplashForm read GetAppSplashForm write SetAppSplashForm; property AppSplashForm : IAppSplashForm read GetAppSplashForm write SetAppSplashForm;
@ -84,7 +84,7 @@ type
function GetUsuariosController: IUsuariosController; function GetUsuariosController: IUsuariosController;
function GetAppName: String; function GetAppName: String;
function GetAppVersion: String; function GetAppVersion: String;
function GetUsuarioActivo: TUsuario; function GetUsuarioActivo: IBizUsuario;
function GetEmpresaActiva: IBizEmpresa; function GetEmpresaActiva: IBizEmpresa;
function GetModuleManager : THostManager; function GetModuleManager : THostManager;
function GetTerminated: Boolean; function GetTerminated: Boolean;
@ -121,7 +121,7 @@ type
property MainForm : TCustomForm read GetMainForm; property MainForm : TCustomForm read GetMainForm;
property EmpresaActiva : IBizEmpresa read GetEmpresaActiva; property EmpresaActiva : IBizEmpresa read GetEmpresaActiva;
property AppSplashForm : IAppSplashForm read GetAppSplashForm write SetAppSplashForm; property AppSplashForm : IAppSplashForm read GetAppSplashForm write SetAppSplashForm;
property UsuarioActivo : TUsuario read GetUsuarioActivo; property UsuarioActivo : IBizUsuario read GetUsuarioActivo;
property EmpresasController : IEmpresasController read GetEmpresasController; property EmpresasController : IEmpresasController read GetEmpresasController;
property UsuariosController : IUsuariosController read GetUsuariosController; property UsuariosController : IUsuariosController read GetUsuariosController;
property ModuleManager : THostManager read GetModuleManager; property ModuleManager : THostManager read GetModuleManager;
@ -259,7 +259,7 @@ begin
Result := FTerminated; Result := FTerminated;
end; end;
function TAppFactuGES.GetUsuarioActivo: TUsuario; function TAppFactuGES.GetUsuarioActivo: IBizUsuario;
begin begin
Result := UsuariosController.CurrentUser; Result := UsuariosController.CurrentUser;
end; end;