⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loggingondlg.cpp

📁 用于网络管理统计的
💻 CPP
字号:
// LoggingONDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CustomerManage.h"
#include "LoggingONDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLoggingONDlg dialog


CLoggingONDlg::CLoggingONDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CLoggingONDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CLoggingONDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CLoggingONDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLoggingONDlg)
	DDX_Control(pDX, IDOK, m_ok);
	DDX_Control(pDX, IDCANCEL, m_cancel);
	DDX_Control(pDX, IDC_COMBO_NAME, m_name);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CLoggingONDlg, CDialog)
	//{{AFX_MSG_MAP(CLoggingONDlg)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLoggingONDlg message handlers

BOOL CLoggingONDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	SetButtonBkColor();
	InitialComName();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CLoggingONDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect rcClient;
	GetClientRect(&rcClient);
	bar.DrawLeft(&dc,CRect(0,0,10,rcClient.bottom));
	bar.DrawTop(&dc,CRect(0,0,rcClient.right,10));
	bar.DrawRight(&dc,CRect(rcClient.right-10,0,rcClient.right,rcClient.bottom));
	bar.DrawBottom(&dc,CRect(0,rcClient.bottom-10,rcClient.right,rcClient.bottom));			
	// Do not call CDialog::OnPaint() for painting messages
}
void CLoggingONDlg::SetButtonBkColor()
{
	m_ok.SetActiveBgColor (RGB(162,189,255));
	m_ok.SetInactiveBgColor (RGB(162,189,255));
	m_cancel.SetActiveBgColor (RGB(162,189,255));
	m_cancel.SetInactiveBgColor (RGB(162,189,255));
}
void CLoggingONDlg::InitialComName()
{
	CString strSQL;
	int Index = 0;
	_RecordsetPtr m_pADOSet;
	try
	{
		strSQL = "select ID,UserName from Users";
		m_pADOSet.CreateInstance(__uuidof(Recordset));
		m_pADOSet = theApp.ADOConn->Execute(strSQL.AllocSysString(),NULL,adCmdText);
		while(!m_pADOSet->adoEOF)
		{
			Index = m_name.AddString((LPCSTR)_bstr_t(m_pADOSet->GetCollect("UserName")));
			m_name.SetItemData(Index,m_pADOSet->GetCollect("ID").iVal);
			m_pADOSet->MoveNext();
		}
		m_pADOSet->Close();
		m_name.SetCurSel(0);
	}
	catch(_com_error e)
	{
		MessageBox(e.Description(),MB_OK);
		return;
	}
}

void CLoggingONDlg::OnOK() 
{
	// TODO: Add extra validation here
	CString strSQL;
	CString sPassword;
	CString sUsername;
    _RecordsetPtr m_pADOSet;
	try
	{
		m_name.GetWindowText(sUsername);
		GetDlgItem(IDC_EDIT_PASSWORD)->GetWindowText(sPassword);
		strSQL.Format("select * from Users where UserName='%s' and Pword='%s'",sUsername,sPassword);
		m_pADOSet = theApp.ADOConn->Execute(strSQL.AllocSysString(),NULL,adCmdText);
		if(!m_pADOSet->adoEOF)
		{
			theApp.m_userinfo.UserName = m_pADOSet->GetCollect("UserName").bstrVal;
			if(m_pADOSet->GetCollect("Manager"))
				theApp.m_userinfo.Popedom = 1;
			else
				theApp.m_userinfo.Popedom = 0;
			theApp.m_userinfo.Password = m_pADOSet->GetCollect("Pword").bstrVal;
			CDialog::OnOK();
		}
		else
		{
			MessageBox("密码错,从新输入",MB_OK);
			return;
		}
	}
	catch(_com_error e)
	{
		MessageBox(e.Description(),MB_OK);
		return;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -