// Start =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// General information section.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// $Author:yongkiang$ User who last changed the file
// $Date:1/2/2013 12:16:32 PM$ Date and time of last check in
// $Revision:1.0$ Visual SourceSafe version number
// $Workfile::   Login.h                                               $ Filename
// End =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#if !defined(AFX_LOGIN_H__ABD101E1_F409_11D0_BB4C_00A0C9338123__INCLUDED_)
#define AFX_LOGIN_H__ABD101E1_F409_11D0_BB4C_00A0C9338123__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "RunView.h"

#ifdef  BUILD_GUIDLL
#define     DLLCLASS    __declspec(dllexport)
#else
#define     DLLCLASS    __declspec(dllimport)
#endif

// Login.h : header file
//
class CMainDoc;
/////////////////////////////////////////////////////////////////////////////
// CLogin dialog

class DLLCLASS CLogin : public CDialog
{
// Construction
public:
// Gary 13May11, V1.24.02
// method to get entered password
    CString GetPassword();

// method to inform do not do authentication
    void SetNoAuthentication();

// method to query the Login Level
    int GetLoginLevel();

// method to query the Login User Name
    CString GetLoginUserName();

// method to check if the Authentication is successful
    bool IsAuthenticationSuccessful();

    CLogin(CWnd* pParent = NULL,
           int iSel = 0,                   // Minimum Login Level required
           bool bHideCancelBut = false,    // Hide Cancel Button
           bool bChangeUserLevel = true,   // Change current User Level after Login successfully
           CMainDoc *pDoc = NULL,          // Pointer to mainDoc
           bool bAutoLogoutOption = false, // Auto Logout Option
           CString csTitle = _T("Login")   // Title text
           );                              // standard constructor

// Dialog Data
// {{AFX_DATA(CLogin)
    enum {
        IDD = IDD_LOGIN_DLG
    };
    CEdit          m_editUserName;
    CComboBox      m_currPwdLevel;
    CEdit          m_pwdEditCtrl;
    CString        m_currPwd;
    CShadeButtonST m_cbOk;
    CShadeButtonST m_cbCancel;
// }}AFX_DATA

// Overrides
// ClassWizard generated virtual function overrides
// {{AFX_VIRTUAL(CLogin)
protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// }}AFX_VIRTUAL

// Attributes:
private:
    void SetDlgItemFont();
    void CreateDlgFont(CString Name = "MS Sans Serif");

//  init dialog icons
    void InitDlgIcons();

//  set ok and cancel button placement
    void SetButtonPlacement();

    CMainDoc *m_pDoc;
    CFont     m_fontLogo;

    int m_iSel;

    bool m_bHideCancelBut;
    bool m_bChangeUserLevel;
    bool m_bAutoLogoutOption;

// Gary 1 Feb 10, new multi-user password access
    bool m_bMultiUser;
    int  m_nMultiUserLevel;

// Gary 2Mar10, V1.22.12
    bool m_bAuthenticationSuccessful;

    int m_nLoginUserLevel;

    CString m_csLoginUserName;

    bool m_bAutoLogoutEnable;

    int m_nAutoLogoutDuration;

    CString m_csTitle;

// Gary 13May11, V1.24.02
    CString m_csPassword;

    bool m_bNoAuthentication;

// Implementation
protected:
    bool ComparePassword(void);
    bool CompareEncryptedString(CString &);
// Generated message map functions
// {{AFX_MSG(CLogin)
    virtual void   OnOK();
    virtual BOOL   OnInitDialog();
    afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
    afx_msg void   OnClose();
    virtual void   OnCancel();
// }}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

// {{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_LOGIN_H__ABD101E1_F409_11D0_BB4C_00A0C9338123__INCLUDED_)
