?? 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
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -