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

📄 dresume.cpp

📁 商品销售管理系统:随着信息技术的快速进步
💻 CPP
字号:
// DResume.cpp : implementation file
//

#include "stdafx.h"
#include "商品销售管理系统.h"
#include "DResume.h"

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


CDResume::CDResume(CWnd* pParent /*=NULL*/)
	: CDialog(CDResume::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDResume)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDResume::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDResume)
	DDX_Control(pDX, IDC_STATIT, m_Statit);
	DDX_Control(pDX, IDC_SHORTPACH, m_ShortPach);
	DDX_Control(pDX, IDC_EDIT1, m_Pach);
	DDX_Control(pDX, IDC_LIST1, m_Grid);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDResume, CDialog)
	//{{AFX_MSG_MAP(CDResume)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnDblclkList1)
	ON_NOTIFY(NM_RCLICK, IDC_LIST1, OnRclickList1)
	ON_BN_CLICKED(IDC_RESUME, OnResume)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDResume message handlers

void CDResume::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
}

BOOL CDResume::OnInitDialog() 
{
	CDialog::OnInitDialog();
	this->m_Statit.ShowWindow(SW_HIDE);

	m_Grid.SetDataBase("备份信息表",adCmdTable);
	m_Grid.ReadOnly(true);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDResume::OnButton1() 
{
	// TODO: Add your control notification handler code here
	
}

void CDResume::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	CString sPach,sShortPath,sFileName;

	if(m_Grid.GetHotItem()<0)
		return;
	sPach=m_Grid.GetItemText(m_Grid.GetHotItem(),1);
	this->m_Pach.SetWindowText(sPach);
	if(sPach.GetLength()>30)
	{
		int nstartpos=0,npos;
		while(true)
		{
			nstartpos=sPach.Find("\\",nstartpos+1);
			if(nstartpos==-1)
				break;
			npos=nstartpos;
		}
		sFileName=sPach.Mid(npos);
		sShortPath=sPach.Left(7);
		this->m_ShortPach.SetWindowText(sShortPath+"..."+sFileName);
	}
	else
		this->m_ShortPach.SetWindowText(sPach);

	*pResult = 0;
}

void CDResume::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	RxRecordset rst;
	int  i=m_Grid.GetHotItem();
	if(MessageBox("备份信息删除后不可恢复,确定要删除吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)==1)	
	{
		CString sPach,sSQL;
		sPach=m_Grid.GetItemText(i,1);
		sSQL.Format("DELETE 备份信息表 WHERE 备份路径 LIKE '%s'",sPach);
		rst.Open(sSQL,adCmdText);
	}
	rst.Open("备份信息表");
	m_Grid.AddCellValue(rst);
	*pResult = 0;
}

void CDResume::OnResume() 
{
	this->m_Statit.ShowWindow(SW_SHOW);
	this->UpdateWindow();
	CString sSQL;
	//ado.Close();
	cnn->Close();
	cnn=NULL;
	CString sFileName;
	this->m_Pach.GetWindowText(sFileName);
	if(ado.SetConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=(local)")==false)
		return;
	cnn=ado.GetConnection();	
	sSQL.Format( "RESTORE DATABASE spxxglxt FROM DISK = '%s'",sFileName);
	RxRecordset rst;
	
	bool err=rst.Open(sSQL,adCmdText);
	if(err==false)
		MessageBox("数据恢复失败!","系统提示",MB_OK|MB_ICONSTOP);
	else
		MessageBox("数据恢复成功!","系统提示",MB_OK|MB_ICONINFORMATION);

	cnn->Close();
	cnn=NULL;
		
	if(ado.SetConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=spxxglxt;Data Source=(local)")==false)
		return ;
	cnn=ado.GetConnection();
	this->m_Statit.ShowWindow(SW_HIDE);

}

⌨️ 快捷键说明

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