www.pudn.com > Raclient.rar > InputCertView.cpp


// InputCertView.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Raclient.h" 
#include "InputCertView.h" 
#include "inputinfo.h" 
#include "MainFrm.h" 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CInputCertView 
extern CString str[36]; 
extern CString strCA[36]; 
 
IMPLEMENT_DYNCREATE(CInputCertView, CFormView) 
 
CInputCertView::CInputCertView() 
	: CFormView(CInputCertView::IDD) 
{ 
	//{{AFX_DATA_INIT(CInputCertView) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
	m_bmpView.LoadBitmap(IDB_BITMAPVIEW); 
	m_bmpInput.LoadBitmap(IDB_BITMAPINPUT); 
	m_bmpCancel.LoadBitmap(IDB_BITMAPCANCELBIG); 
} 
 
CInputCertView::~CInputCertView() 
{ 
} 
 
void CInputCertView::DoDataExchange(CDataExchange* pDX) 
{ 
	CFormView::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CInputCertView) 
	DDX_Control(pDX, IDC_STATIC2, m_line2); 
	DDX_Control(pDX, IDC_COMBO_SELECT, m_selectcom); 
	DDX_Control(pDX, IDC_STATIC1, m_line); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CInputCertView, CFormView) 
	//{{AFX_MSG_MAP(CInputCertView) 
	ON_BN_CLICKED(IDC_BUTTON_INPUT_QUERY, OnButtonInputQuery) 
	ON_BN_CLICKED(IDC_BUTTON_APPLY, OnButtonApply) 
	ON_BN_CLICKED(IDC_BUTTON_CANCLE, OnButtonCancle) 
	ON_WM_DESTROY() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CInputCertView diagnostics 
 
#ifdef _DEBUG 
void CInputCertView::AssertValid() const 
{ 
	CFormView::AssertValid(); 
} 
 
void CInputCertView::Dump(CDumpContext& dc) const 
{ 
	CFormView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CInputCertView message handlers 
void CInputCertView::OnInitialUpdate()  
{ 
	CFormView::OnInitialUpdate(); 
	((CButton*)GetDlgItem(IDC_BUTTON_INPUT_QUERY))->SetBitmap(m_bmpView); 
	((CButton*)GetDlgItem(IDC_BUTTON_APPLY))->SetBitmap(m_bmpInput); 
	((CButton*)GetDlgItem(IDC_BUTTON_CANCLE))->SetBitmap(m_bmpCancel); 
	 
 
	GetParentFrame()->SetWindowText("证书申请"); 
	// TODO: Add your specialized code here and/or call the base class 
	m_line.	SetWindowPos(NULL,0,0,1024,2,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE); 
	m_line2.SetWindowPos(NULL,0,0,1024,2,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE); 
 
	GetDlgItem(IDC_EDIT16)->SetWindowText("中国"); 
	GetDlgItem(IDC_EDIT16)->EnableWindow(false); 
	((CComboBox *)GetDlgItem(IDC_COMBO2))->SetCurSel(1); 
	m_selectcom.SetCurSel(1); 
 
 
} 
 
 
void CInputCertView::OnButtonInputQuery()  
{ 
	// TODO: Add your control notification handler code here 
 
	CString str; 
	GetDlgItem(IDC_EDIT1)->GetWindowText(str); 
	if(str==""||m_selectcom.GetCurSel()==CB_ERR) return; 
	if(str=="001") 
	{ 
		for(int i=0;i<21;i++)//修改纪录 
		{ 
			GetDlgItem(10003+i)->SetWindowText(strCA[i]); 
		} 
		((CRaChildFrame*)GetParentFrame( ))->Msg("查询到一条纪录,请选择修改查询结束!"); 
 
	} 
	else 
		((CRaChildFrame*)GetParentFrame( ))->Msg("没有查询到相关证书,请选择填写表项,查询结束!"); 
	GetDlgItem(IDC_EDIT16)->SetWindowText("中国"); 
	GetDlgItem(IDC_EDIT1)->EnableWindow(false); 
//	GetDlgItem(IDC_BUTTON_INPUT_QUERY)->EnableWindow(false); 
 
} 
 
 
void CInputCertView::OnButtonApply() //申请按钮 
{ 
 
	// TODO: Add your control notification handler code here 
	CString str1; 
	GetDlgItem(IDC_EDIT1)->GetWindowText(str1); 
	if(str1=="") return; 
	CString strsn; 
	GetDlgItem(IDC_EDIT2)->GetWindowText(strsn); 
	if(strsn=="")  
	{ 
		MessageBox("*为必添项"); 
		return; 
	} 
 
	CInputInfoDlg dlg; 
	dlg.DoModal(); 
	GetDlgItem(IDC_EDIT1)->GetWindowText(str[0]); 
	str[1]="证书序号"; 
 
 
	SYSTEMTIME tm; 
	GetLocalTime(&tm); 
	CString timebegin,timeend; 
	timebegin.Format(_T(" %d年-%d月-%d日"), tm.wYear,tm.wMonth,tm.wDay); 
	str[2]=timebegin;//录入日期 
 
	 
	for(int i=0;i<21;i++)//修改纪录 
	{ 
		GetDlgItem(10003+i)->GetWindowText(str[i]); 
	} 
	str[25]=dlg.m_strinfo[2];//由谁产生 
	str[26]=dlg.m_strinfo[3];//证书类型 
	str[27]=dlg.m_strinfo[4];//存储介质 
	int num=((CRaclientApp*)AfxGetApp())->GetRand(100,999);//岁计数 
	str[28].Format("%d",num);//内部序号	 
	str[29]=dlg.m_strinfo[1];//证书级别 
	num=((CRaclientApp*)AfxGetApp())->GetRand(1000,9999);//岁计数 
	str[30].Format("%d",num);//持有者id 
	str[31]=dlg.m_strinfo[0];//有效期 
	str[32]=timebegin;//"证书有效起始日期" 
	timeend.Format(_T(" %d年-%d月-%d日"), tm.wYear+1,tm.wMonth,tm.wDay); 
	str[33]=timeend;//"证书有效终止日期" 
	str[34]="1";//"证书状态" 
	str[35]="1";//"内部表示" 
 
 
	((CRaChildFrame*)GetParentFrame( ))->Msg("录入成功,内部序号为"+str[28]); 
	GetDlgItem(IDC_EDIT1)->EnableWindow(true); 
//	GetDlgItem(IDC_BUTTON_INPUT_QUERY)->EnableWindow(true); 
	GetDlgItem(IDC_EDIT1)->SetWindowText(""); 
 
	for(i=0;i<21;i++) 
	{ 
		GetDlgItem(10003+i)->SetWindowText(""); 
	} 
 
//添加历史纪录 
	CString strOper; 
	timebegin.Format(_T(" %d年-%d月-%d日 %d:%d:%d"), tm.wYear,tm.wMonth,tm.wDay,tm.wHour,tm.wMinute,tm.wSecond); 
	strOper=timebegin+"录入了证书"+"内部序号为"+str[28]; 
	GetDlgItem(IDC_EDIT16)->SetWindowText("中国"); 
 
} 
 
 
void CInputCertView::OnButtonCancle()  
{ 
	// TODO: Add your control notification handler code here 
	GetDlgItem(IDC_EDIT1)->EnableWindow(true); 
//	GetDlgItem(IDC_BUTTON_INPUT_QUERY)->EnableWindow(true); 
	GetDlgItem(IDC_EDIT1)->SetWindowText(""); 
 
	for(int i=0;i<21;i++) 
	{ 
		GetDlgItem(10003+i)->SetWindowText(""); 
	} 
	((CRaChildFrame*)GetParentFrame( ))->Msg("取消操作"); 
	GetDlgItem(IDC_EDIT16)->SetWindowText("中国"); 
 
} 
 
void CInputCertView::OnDestroy()  
{ 
	CFormView::OnDestroy(); 
	((CMainFrame*)AfxGetMainWnd())->m_pInput=NULL; // 清空窗口指针 
 
	// TODO: Add your message handler code here 
	 
}