Beispiel #1
0
void CRegisterUserDlg::OnCancel()
{
	// TODO: 在此添加专用代码和/或调用基类

	if (!Flag)
	{
		CDialog::OnCancel();
		return;
	}

	CMainFrame *pMainFrm = (CMainFrame *)AfxGetMainWnd();
	CUserSet* pUserSet = &pMainFrm->userSet;
	CUser* pUser = &pMainFrm->user;
	
	CMyTreeView* pTreeView = (CMyTreeView *)(pMainFrm->m_wndSplitterWnd).GetPane(0,0);
	CTreeCtrl* m_theTreeCtrl=pTreeView->m_TreeCtrl;
	m_theTreeCtrl->DeleteAllItems();
	HTREEITEM rootItem;
	rootItem = m_theTreeCtrl->InsertItem(_T("用户列表"),2,2,TVI_ROOT);

	CString userTreeHeader[3]={"管理员","售药员","医生"};
	HTREEITEM userItem[3];
	for(int i=0;i<3;i++)
	{
		userItem[i]=m_theTreeCtrl->InsertItem(userTreeHeader[i],2,2,rootItem);
		m_theTreeCtrl->SetItemData(userItem[i],(DWORD)i);
	}

	HTREEITEM thePoint;
	for(int i=0;i<3;i++)
	{
		pUserSet->m_strFilter = "UserType='"+userTreeHeader[i]+"'";
		pUserSet->Requery();
		for(int j=0;;j++)
		{
			if(pUserSet->IsEOF())
			{
				break;
			}	
			if(pUserSet->m_UserAccount == pUser->GetAccount())
			{
				HTREEITEM userSpecifics = m_theTreeCtrl->InsertItem(pUserSet->m_UserAccount+"(当前用户)",0,0,userItem[i]);
				m_theTreeCtrl->SetItemData(userSpecifics,(DWORD)j);
				thePoint = userSpecifics;
			}
			else
			{
				HTREEITEM userSpecifics = m_theTreeCtrl->InsertItem(pUserSet->m_UserAccount,1,1,userItem[i]);
				m_theTreeCtrl->SetItemData(userSpecifics,(DWORD)j);
			}
			pUserSet->MoveNext();
		}
	}

	m_theTreeCtrl->Select(thePoint,TVGN_CARET);

	CDialog::OnCancel();
}
Beispiel #2
0
void CMyTreeView::OnInitialUpdate()
{
	CTreeView::OnInitialUpdate();

	m_TreeCtrl = &GetTreeCtrl();

	CBitmap bmp;
	bmp.LoadBitmap(IDB_USERS_LIST);

	m_imgList.Create(16, 16, ILC_COLORDDB|ILC_MASK|ILC_COLOR24, 3, 0);
	m_imgList.Add(&bmp,RGB(255,255,255));

	m_TreeCtrl->SetImageList(&m_imgList,TVSIL_NORMAL);
	m_TreeCtrl->SetLineColor(RGB(0,0,255));

	CString userTreeHeaders[3] = {_T("管理员"),_T("售药员"),_T("医生")};
	HTREEITEM rootItem;
	rootItem = m_TreeCtrl->InsertItem(_T("用户列表"),2,2,TVI_ROOT);

	HTREEITEM userItem[3];
	for (int i = 0;i < 3;i++)
	{
		userItem[i] = m_TreeCtrl->InsertItem(userTreeHeaders[i],2,2,rootItem);
		m_TreeCtrl->SetItemData(userItem[i],i);
	}

	CUser *pUser = &((CMainFrame *)AfxGetMainWnd())->user;
	CUserSet *pUserSet = &((CMainFrame *)AfxGetMainWnd())->userSet;
	if (pUserSet->IsOpen())
	{
		pUserSet->Close();
	}
	pUserSet->Open();

	CLogInDlg loginDlg;
	loginDlg.DoModal();

	HTREEITEM thePoint;
	CString strFilter;
	for(int i=0;i<3;i++)
	{
		strFilter.Format(_T("UserType=\'%s\'"),userTreeHeaders[i]);
		pUserSet->m_strFilter = strFilter;
		//pUserSet->m_strFilter = (_T("UserType='"+userTreeHeaders[i]+"'");
		pUserSet->Requery();
		for(int j=0;;j++)
		{
			if(pUserSet->IsEOF())
			{
				break;
			}	
			if(pUserSet->m_UserAccount == pUser->GetAccount())
			{
				HTREEITEM userLog = m_TreeCtrl->InsertItem(pUserSet->m_UserAccount+_T("(当前用户)"),0,0,userItem[i]);
				m_TreeCtrl->SetItemData(userLog,j);
				thePoint=userLog;
			}
			else
			{
				HTREEITEM userOthers = m_TreeCtrl->InsertItem(pUserSet->m_UserAccount,1,1,userItem[i]);
				m_TreeCtrl->SetItemData(userOthers,j);
			}
			pUserSet->MoveNext();
		}
	}
	//m_TreeCtrl->Expand(rootItem,TVE_EXPAND);
	//m_TreeCtrl->Expand(userItem[0],TVE_EXPAND);
	//m_TreeCtrl->Expand(userItem[1],TVE_EXPAND);
	//m_TreeCtrl->Expand(userItem[2],TVE_EXPAND);
	m_TreeCtrl->Select(thePoint,TVGN_CARET);

	// TODO: 在此添加专用代码和/或调用基类
}
Beispiel #3
0
void CDPAccountClient::OnAddAccount( CAr & ar, DPID dpid )
{
	BYTE	cbResult;
	DWORD	dwAuthKey = 0;
	BYTE	cbAccountFlag = 0;
	long	lTimeSpan = 0;

	ar >> cbResult;
	ar >> dwAuthKey;
	ar >> cbAccountFlag;

#ifdef __BILLING0712
	ar >> lTimeSpan;
#endif

#ifdef __GPAUTH_01
	char szGPotatoNo[10]	= { 0,};
#ifdef __GPAUTH_02
	char szCheck[255]	= { 0,};
#endif	// __GPAUTH_02
#ifdef __EUROPE_0514
	char szBak[MAX_ACCOUNT]	= { 0,};
#endif	// __EUROPE_0514
	BOOL bGPotatoAuth	= ::GetLanguage() == LANG_GER || ::GetLanguage() == LANG_FRE;
	if( bGPotatoAuth )
	{
		ar.ReadString( szGPotatoNo, 10 );
#ifdef __GPAUTH_02
		ar.ReadString( szCheck, 255 );
#endif	// __GPAUTH_02
	}
#ifdef __EUROPE_0514
	ar.ReadString( szBak, MAX_ACCOUNT );
#endif	// __EUROPE_0514

#endif	// __GPAUTH_01

	switch( cbResult )
	{
		case ACCOUNT_DUPLIACTE:					// 중복 에러
			g_dpCertifier.SendError( ERROR_DUPLICATE_ACCOUNT, dpid );			
			break;
		case ACCOUNT_CHECK_OK:					// 성공
			{
				{
					CMclAutoLock Lock( CUserMng::GetInstance()->m_AddRemoveLock );
					CUser* pUser	= CUserMng::GetInstance()->GetUser( dpid );
					if( !pUser )
						return;
					pUser->m_dwTick		= 0xffffffff;
#ifdef __EUROPE_0514
					if( lstrcmp( pUser->GetAccount(), szBak ) )
					{
						Error( "CDPAccountClient.OnAddAccount: %s, %s", pUser->GetAccount(), szBak );
						return;
					}
#endif	// __EUROPE_0514
				}

			#ifdef __GPAUTH_01
				#ifdef __GPAUTH_02
#ifdef __EUROPE_0514
				g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan, szGPotatoNo, szCheck, szBak );
#else	// __EUROPE_0514
				g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan, szGPotatoNo, szCheck );
#endif	// __EUROPE_0514
				#else	// __GPAUTH_02
				g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan, szGPotatoNo );
				#endif	// __GPAUTH_02
			#else	// __GPAUTH_01
				g_dpCertifier.SendServerList( dpid, dwAuthKey, cbAccountFlag, lTimeSpan );
			#endif	// __GPAUTH_01
				break;
			}
		case ACCOUNT_EXTERNAL_ADDR:				// 허용되지 않는 주소 
			g_dpCertifier.SendError( ERROR_EXTERNAL_ADDR, dpid );
			break;
		case ACCOUNT_OVERFLOW:					// 인원초과
			g_dpCertifier.SendError( ERROR_OVERFLOW, dpid );
			break;
		case ACCOUNT_BILLING_INFO_FAILED:		// 빌링 정보 없음
			g_dpCertifier.SendError( ERROR_BILLING_INFO_FAILED, dpid );
			break;
		case ACCOUNT_BILLING_DATABASE_ERROR:	// 빌링 DB 에러 
			g_dpCertifier.SendError( ERROR_BILLING_DATABASE_ERROR, dpid );
			break;
		case ACCOUNT_BILLING_TIME_OVER:			// 빌링 사용시간 만료 
			g_dpCertifier.SendError( ERROR_BILLING_TIME_OVER, dpid );
			break;
		case ACCOUNT_BILLING_OTHER_ERROR:		// 빌링 기타 다른 에러 
			g_dpCertifier.SendError( ERROR_BILLING_OTHER_ERROR, dpid );
			break;
		case ACCOUNT_BILLING_DISCONNECTED:
			g_dpCertifier.SendError( ERROR_BILLING_DISCONNECTED, dpid );
			break;
		case ACCOUNT_IPCUT_ADDR:
			g_dpCertifier.SendError( ERROR_IP_CUT, dpid );
			break;
		default:
			{
				Error("CDPAccountClient::OnAddAccount result:%d ", cbResult );
				CMclAutoLock Lock( CUserMng::GetInstance()->m_AddRemoveLock );
				CUser* pUser	= CUserMng::GetInstance()->GetUser( dpid );
				if( pUser )
					Error("account: %s", pUser->GetAccount() );
				break;
			}
	}
}