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

📄 lientlogdlg.cpp

📁 订单管理系统
💻 CPP
字号:
// lientLogDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ordermanagement.h"
#include "lientLogDlg.h"
#include "liInfoDlg.h"
#include "ADOConn.h"
#include "ProductDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
ADOConn clconn;
_bstr_t cSQL;
/////////////////////////////////////////////////////////////////////////////
// ClientLogDlg dialog


ClientLogDlg::ClientLogDlg(CWnd* pParent /*=NULL*/)
	: CDialog(ClientLogDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(ClientLogDlg)
	m_cliID = _T("");
	m_cliPwd = _T("");
	//}}AFX_DATA_INIT
}


void ClientLogDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ClientLogDlg)
	DDX_Control(pDX, IDC_EDIT2, m_EditCliPwd);
	DDX_Control(pDX, IDC_EDIT1, m_EditCliID);
	DDX_Text(pDX, IDC_EDIT1, m_cliID);
	DDX_Text(pDX, IDC_EDIT2, m_cliPwd);
	DDX_Control(pDX, IDOK, m_ButLogin);
	DDX_Control(pDX, IDCANCEL, m_Butcancel);
DDX_Control(pDX, IDC_BTN_CLIREWRITE, m_Chongz);
	DDX_Control(pDX, IDC_BTN_ADD, m_Zhuc);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(ClientLogDlg, CDialog)
	//{{AFX_MSG_MAP(ClientLogDlg)
	ON_BN_CLICKED(IDC_BTN_ADD, OnBtnAdd)
	ON_BN_CLICKED(IDC_BTN_CLIREWRITE, OnBtnClirewrite)
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ClientLogDlg message handlers

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

void ClientLogDlg::OnBtnAdd() 
{
		CliInfoDlg clinfodlg;
	clinfodlg.modfy = 0;
	clinfodlg.DoModal();
	
}

void ClientLogDlg::OnBtnClirewrite() 
{
m_cliID = "";
	m_cliPwd = "";
	UpdateData(false);
	m_EditCliID.SetFocus();	
	
}

void ClientLogDlg::OnOK() 
{
	UpdateData(true);							  //更新空件值变量
	if(m_cliID.IsEmpty())
	{
		AfxMessageBox("用户名不能为空,请重新输入!");
		m_EditCliID.SetFocus();			  //焦点返回用户名输入框

	}
	else if(m_cliPwd.IsEmpty())
	{
		AfxMessageBox("密码不能为空,请重新输入!");
		m_EditCliPwd.SetFocus();			  //焦点返回密码输入框

	}
	else 
	{
		int len = m_EditCliPwd.LineLength(); //取得密码长度
		if(len <= 6)
		{
			AfxMessageBox("密码不少于七位,请重新输入!");
			m_EditCliPwd.SetFocus();		  //焦点返回用户名输入框	

		}
		else								  // 核对用户名和密码是否合法
		{
			if(CliTest())
			{
				ProductDlg pdlg;
				CDialog::OnOK();//关闭对话框
				pdlg.DoModal();		
			}
			else 
			{
				OnBtnClirewrite() ;
				AfxMessageBox("用户名或密码错误!");
			}
		}
	}		
}
bool ClientLogDlg::CliTest()//如果用户名和密码正确则返回true
{
	try{
		//如果Concection对象为空,则重新连接
		if(clconn.m_pConn == NULL)
			clconn.OnInitADOConn();
	
		//编辑SQL语句
		cSQL = "SELECT * FROM ClientMessage WHERE clientID='"+m_cliID+"' AND userpwd ='"+m_cliPwd+"'";
		
		//执行SQL语句
		clconn.m_pRs = clconn.GetRecordSet(cSQL);
		if(!clconn.m_pRs->adoBOF)
		{
			cSQL = "UPDATE ClientMessage SET currState = 1 WHERE clientID='"+m_cliID+"' AND userpwd ='"+m_cliPwd+"'";
			clconn.ExecuteSQL(cSQL);

CString sq;
sq="Y"; 





			//编辑SQL语句
		cSQL = "SELECT * FROM ClientMessage WHERE clientID='"+m_cliID+"' AND shenqing ='"+sq+"'";
		
		//执行SQL语句
		clconn.m_pRs = clconn.GetRecordSet(cSQL);
		if(!clconn.m_pRs->adoBOF)
		{
			return true;
		}


AfxMessageBox("您未通过申请!");




		
		}
	}
	catch(_com_error e)
	{
		AfxMessageBox(e.Description());
		return false;
	}
	return false; 
}

HBRUSH ClientLogDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
		//HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
COLORREF backColor = RGB(231, 231, 231); //office 2003背景色 
pDC->SetBkMode(TRANSPARENT);                //设置控件背景透明 
return CreateSolidBrush(backColor);            //创建背景刷子 	
	// TODO: Return a different brush if the default is not desired
	//return hbr;

	//HBRUSH hbr = CDialog::OnCtlColor(pDC,pWnd,nCtlColor); 
//pDC->SetBkMode(TRANSPARENT);   
//return    (HBRUSH)GetStockObject(NULL_BRUSH);  
}

⌨️ 快捷键说明

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