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

📄 dialogsetup.cpp

📁 IP电话计费管理系统本地版
💻 CPP
字号:
// DialogSetup.cpp : implementation file
//

#include "stdafx.h"
#include "ipcount.h"
#include "DialogSetup.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDialogSetup dialog


CDialogSetup::CDialogSetup(CWnd* pParent /*=NULL*/)
	: CDialog(CDialogSetup::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDialogSetup)
	m_user = _T("");
	m_password = _T("");
	//}}AFX_DATA_INIT
}


void CDialogSetup::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogSetup)
	DDX_Text(pDX, IDC_EDIT1, m_user);
	DDX_Text(pDX, IDC_EDIT2, m_password);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CDialogSetup message handlers

void CDialogSetup::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);
	strLevel="";
	int nResult1,nResult2;
	nResult1=nResult2=-1;
	
	//获得文件的当前路径
	TCHAR pFileName[MAX_PATH];
	GetModuleFileName(NULL,pFileName,MAX_PATH);
	if(strchr(pFileName,'\\'))
		*strrchr(pFileName,'\\')='\0';
    strcat(pFileName,"\\IPUser.dat");
	set.Open(pFileName);
	
	while(!set.IsEOF())
	{
		nResult1=strcmp(set.UserName,m_user);
		nResult2=strcmp(set.UserPswd,m_password);
		if((nResult1==0)&&(nResult2==0))
		{
			strLevel=set.UserLevel;
			break;
		}
		set.MoveNext();
		
	}
	set.UserName="";
	set.UserPswd="";
	set.UserLevel="";
	if((nResult1!=0)||(nResult2!=0))
	{
		//AfxMessageBox("登陆失败!");
	    PostQuitMessage(0);
	}
	else
	{
		if(strcmp(strLevel,"营业员")==0)
			nFlagLevel=1;
		else if(strcmp(strLevel,"超级管理员")==0)
			nFlagLevel=2;
		//m_BLogin.ShowWindow(SW_HIDE);
		//标题按钮图标
		//m_BTitle.ShowWindow(SW_SHOW);
        //m_BTitle.SetIcon(IDI_ICON_TITLE,20,20);
		//m_BTitle.SetImageOffset(5);
		//m_BTitle.SetTextOffset(-5);
		switch(nFlagLevel)
		{
		case 1:
			m_modifypassword=FALSE;
			/*m_BLogin.EnableWindow(FALSE);
			m_BModPswd.EnableWindow(TRUE);
			m_BMang.EnableWindow(TRUE);
			m_BStatics.EnableWindow(TRUE);
			m_BTitle.EnableWindow(FALSE);
			m_BRate.EnableWindow(FALSE);
			m_BSetUp.EnableWindow(FALSE);
			*/
			break;
		case 2:
			m_modifypassword=TRUE;
		    /*m_BTitle.EnableWindow(TRUE);
			m_BLogin.EnableWindow(FALSE);
			m_BRate.EnableWindow(TRUE);
			m_BMang.EnableWindow(TRUE);
			m_BStatics.EnableWindow(TRUE);
			m_BModPswd.EnableWindow(TRUE);
			m_BSetUp.EnableWindow(TRUE);
			*/
			break;
		default:
			break;
		}
	}
	
    set.Close();	
	CDialog::OnOK();
}

void CDialogSetup::OnCancel() 
{
	// TODO: Add extra cleanup here
	PostQuitMessage(0);
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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