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

📄 formdlgview.cpp

📁 一个好的旅游管理系统,分享一下.不错的啊 .
💻 CPP
字号:
// FormDlgView.cpp : implementation file
//

#include "stdafx.h"
#include "常州旅游管理系统.h"
#include "常州旅游管理系统View.h"

#include "SYSDLG.h"
#include "PasswordDlg.h"
#include "MainFrm.h"
#include "FormDlgView.h"

#include "RESOURSEDLG.h"
#include "QUERYDLG.h"
#include "TICKETDLG.h"
#include "TRACFFICDLG.h"

#include "SYSTEMDLG.h"
#include "PasswordSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// FormDlgView

IMPLEMENT_DYNCREATE(FormDlgView, CFormView)

FormDlgView::FormDlgView()
	: CFormView(FormDlgView::IDD)
{

//	m_crBackground=RGB(255,255,230);
//	m_wndbkBrush.CreateSolidBrush(m_crBackground);
	//{{AFX_DATA_INIT(FormDlgView)
	// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

FormDlgView::~FormDlgView()
{
}

void FormDlgView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(FormDlgView)
	DDX_Control(pDX, IDC_TRACFFIC, m_tracffic);
	DDX_Control(pDX, IDC_TICKET, m_ticket);
	DDX_Control(pDX, IDC_SHEZHI, m_shezhi);
	DDX_Control(pDX, IDC_RESOURSE, m_resourse);
	DDX_Control(pDX, IDC_QUERY, m_query);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(FormDlgView, CFormView)
	//{{AFX_MSG_MAP(FormDlgView)
	ON_BN_CLICKED(IDC_RESOURSE, OnResourse)
	ON_BN_CLICKED(IDC_TICKET, OnTicket)
	ON_BN_CLICKED(IDC_TRACFFIC, OnTracffic)
	ON_BN_CLICKED(IDC_QUERY, OnQuery)
	ON_WM_ERASEBKGND()
	ON_BN_CLICKED(IDC_SHEZHI, OnShezhi)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// FormDlgView diagnostics

#ifdef _DEBUG
void FormDlgView::AssertValid() const
{
	CFormView::AssertValid();
}

void FormDlgView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// FormDlgView message handlers

void FormDlgView::OnResourse() 
{
   
	 RESOURSEDLG  dlg;
	 dlg.DoModal();
	
}

void FormDlgView::OnTicket() 
{
    
     
     TICKETDLG dlg;
	 dlg.DoModal();




}

void FormDlgView::OnTracffic() 
{
	 
     TRACFFICDLG dlg;
	 dlg.DoModal();

	
}

void FormDlgView::OnQuery() 
{
              
     QUERYDLG dlg;
    dlg.DoModal();
    
	

}

void FormDlgView::OnShezhi() 
{
bool passwordflag=false;
CString user,password;
SYSDLG m_dlg;

m_database=new CDatabase;
m_database->Open("景点管理",FALSE,FALSE,"ODBC;UID=sa;PWD=",TRUE);
CString strSQL="select * from 用户密码表";
m_pSet=new PasswordSet(m_database);
m_pSet->Open(CRecordset::snapshot,strSQL);
for(int i=0;i<3;i++)
{ 
	m_pSet->MoveFirst();//从第一条记录开始
	if(m_dlg.DoModal()==IDOK)//IDOK
	{
		if(m_dlg.m_name.IsEmpty()||(m_dlg.m_password.IsEmpty()))
		{
			AfxMessageBox("请输入您的用户名与密码!");
			continue;
		}
		else
		{    
			while(!m_pSet->IsEOF())
			{ 
				user=m_pSet->m_PASSWORD;//取密码表字段的成员变量值
				user.TrimRight();
				user.TrimLeft();
				
				password=m_pSet->m_NAME;//取密码表字段的成员变量值
				password.TrimRight();
				password.TrimLeft();
				
				if((m_dlg.m_name==user)&&(m_dlg.m_password==password))
				{
					passwordflag=true;
					m_pSet->Close();//关闭数据库
					break;
				}
				else
				{
					m_pSet->MoveNext();//指向下一个记录
				}
			}
			if(!passwordflag)
			{
				AfxMessageBox("登陆出现错误,请检查您的用户名与密码,重新登陆!");
				continue;
			}
			else 				
				break;	
		}		
	}
	else// IDCANCEL
	{	
		return ;
	}	
}
if(!passwordflag)
{
	AfxMessageBox("您登陆错误超过3次,无权再输入!");
	return ;
}
	else
		
	{
		SYSTEMDLG dlg;
	    dlg.DoModal();
	}
	

}

void FormDlgView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	
	CRect rect;
	GetClientRect(rect);
	CDC memDC;//定义一个兼容DC
	memDC.CreateCompatibleDC(&dc);//创建DC
	CBitmap bmpDraw;
	bmpDraw.LoadBitmap(ID_BMP);//装入DDB
	CBitmap* pbmpOld=memDC.SelectObject(&bmpDraw);//保存原有DDB,并选入新DDB入DC
	dc.BitBlt(0,0,rect.Width(),rect.Height(),&memDC,0,0,SRCCOPY);//将源DC中(0,0,20,20)复制到目的DC(0,0,20,20)
//	pDC->BitBlt(20,20,40,40,&memDC,0,0,SRCAND);//将源DC中(0,0,20,20)和目的DC(20,20,40,40)中区域进行AND操作
	memDC.SelectObject(pbmpOld);//选入原DDB
}

⌨️ 快捷键说明

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