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

📄 fenterdlg.cpp

📁 初学VC,编写的一个机房管理系统,功能基本上完善,但代码可读性不强.
💻 CPP
字号:
// FEnterDlg.cpp : implementation file
//

#include "stdafx.h"
#include "server.h"
#include "FEnterDlg.h"
#include "EnterDlg.h"
#include "adminSet.h"
#include "admactionSet.h"
#include "time.h"
#include "serverDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
bool tagofhadm=false;
CWnd *phserver;
/////////////////////////////////////////////////////////////////////////////
// CFEnterDlg dialog
CString glbname;
CString glbpassword;

CFEnterDlg::CFEnterDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFEnterDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CFEnterDlg)
	id = _T("");
	password = _T("");
	
	//}}AFX_DATA_INIT
}


void CFEnterDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFEnterDlg)
	DDX_Text(pDX, IDC_ID, id);
	DDX_Text(pDX, IDC_PASSWORD, password);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CFEnterDlg, CDialog)
	//{{AFX_MSG_MAP(CFEnterDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFEnterDlg message handlers

void CFEnterDlg::OnOK() 
{
	UpdateData(TRUE);
	if(id.IsEmpty()||password.IsEmpty())
		MessageBox("请输入完整!");
	else
	{
    CAdminSet admin;
	bool tag=true;
	admin.Open();
 	while(!admin.IsEOF())
	{
	if(admin.m_id==id&&admin.m_password==password)
	{
	 tag=false;
	 glbpassword=admin.m_password;
	 glbname=admin.m_name;
	 if(admin.m_tag)
		 tagofhadm=true;
	 else
		 tagofhadm=false;
	 break;
    }
	admin.MoveNext();
	}
	admin.Close();
	if(tag) 
	{	MessageBox("failed!");
	    id.Empty();
	    password.Empty();
	    UpdateData(FALSE);
	}
	else
	{	CAdmactionSet admaction;
		admaction.Open();
		admaction.AddNew();
		admaction.m_name=glbname;
		CTime currenttime=CTime::GetCurrentTime();
        CString mtime=currenttime.Format("%#Y年%#m月%#d日%#H时%#M分%#S秒");
		admaction.m_date=mtime;
		admaction.m_action="登录";
        admaction.Update();
		admaction.Close();
	/*	currenttime=CTime::GetCurrentTime();
		int nowtime=currenttime.GetHour();
		nowtime=nowtime/6;
		CString wenhou=_T("");
		switch(nowtime)
		{
		case 1:	wenhou="上午好!";break;
		case 2:	wenhou="下午好!";break;
		case 3:	wenhou="晚上好!";break;
		}
		CString *msg;
		msg=new CString;
		msg->Format("%s,%s",wenhou,glbname);
		MessageBox(*msg,glbname,MB_OK);*/
		CDialog::OnOK();
		CServerDlg dlg;
		phserver=&dlg;
		dlg.DoModal();
	

	}
	}
}

⌨️ 快捷键说明

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