//---------------------------------------------------------------------------

#ifndef FrmLoginFH
#define FrmLoginFH
//---------------------------------------------------------------------------

#include <vcl.h>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <Graphics.hpp>
#include <Menus.hpp>
//---------------------------------------------------------------------------
#include "ITSDbF.h"
#include <ADODB.hpp>
#include <DB.hpp>
#include "cxButtons.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxEdit.hpp"
#include "cxGraphics.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinsCore.hpp"
#include "dxGDIPlusClasses.hpp"
//---------------------------------------------------------------------------

#define     USER_LOGIN_TRY_CNT      3
typedef enum
{
    LOGIN_OK        = 0,
    LOGIN_ID_ERR,
    LOGIN_PSWD_ERR,
    LOGIN_DB_ERR,
} EN_LOGIN;

//---------------------------------------------------------------------------
class TFRMLogin : public TForm
{
__published:	// IDE-managed Components
    TPanel *Panel1;
    TEdit *EdUserID;
    TEdit *EdPswd;
    TCheckBox *ChkIdSave;
    TImage *Image1;
    TcxButton *BtnLogin;
    TcxButton *BtnPswdChnge;
    TcxButton *BtnClose;
    TcxLabel *LbMessage;
    void __fastcall BtnCloseClick(TObject *Sender);
    void __fastcall BtnPswdChngeClick(TObject *Sender);
    void __fastcall BtnLoginClick(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall EdUserIDKeyPress(TObject *Sender, char &Key);
    void __fastcall EdPswdKeyPress(TObject *Sender, char &Key);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall Image1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
private:	// User declarations

public:		// User declarations
    __fastcall TFRMLogin(TComponent* Owner);

	void __fastcall SetLocalSkin();
    int  __fastcall GetUserPassword(String sUserID, String sPswd);
    String __fastcall GetLocalIp();
    String __fastcall GetPassword(String APswd);

    int     m_nLoginTryCnt;

	String  m_sUserName;
	String  m_sUserID;
	String  m_sUserRightID;
	String  m_sUserRightName;
    String  m_sLoginTime;

    bool    m_bLogin;
};
//---------------------------------------------------------------------------
extern PACKAGE TFRMLogin *FRMLogin;
//---------------------------------------------------------------------------
#endif
