1 Star 0 Fork 2

issicc/AutoPHS

forked from leegoobin/AutoPHS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dlgbackupundo.cpp 3.43 KB
一键复制 编辑 原始数据 按行查看 历史
uksoft 提交于 2014-11-26 16:31 . VSS代码移植到Git
// DlgBackupUndo.cpp : implementation file
//
#include "stdafx.h"
#include "autophs.h"
#include "DlgBackupUndo.h"
#include "EDIBgbl.h"
#include "modregistry.h"
#include "user.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgBackupUndo dialog
CDlgBackupUndo::CDlgBackupUndo(CWnd* pParent /*=NULL*/)
: CDialog(CDlgBackupUndo::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgBackupUndo)
//}}AFX_DATA_INIT
m_strAppInstallPath=_T("");
}
void CDlgBackupUndo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgBackupUndo)
DDX_Control(pDX, IDC_COMBO_HAD_BACKUP, m_comboHadBackup);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgBackupUndo, CDialog)
//{{AFX_MSG_MAP(CDlgBackupUndo)
ON_CBN_SELCHANGE(IDC_COMBO_HAD_BACKUP, OnSelchangeComboHadBackup)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgBackupUndo message handlers
void CDlgBackupUndo::OnSelchangeComboHadBackup()
{
CString str;
m_comboHadBackup.GetLBText(m_comboHadBackup.GetCurSel(),str);
//m_strDes = m_map[str];
UpdateData(FALSE);
}
void CDlgBackupUndo::OnOK()
{
UpdateData(FALSE);
if( AfxMessageBox(IDS_RESTOREDB_YESNO,MB_ICONINFORMATION|MB_YESNO) == IDYES )
{
//在还原以前首先对当前的数据库作备份以防万一
CopyFile(m_strPrjDBPath+"AllPrjDB.mdb",m_strPrjDBPath+"AllPrjDB.bak",FALSE);
CopyFile(m_strPrjDBPath+"Sort.mdb",m_strPrjDBPath+"Sort.bak",FALSE);
EDIBgbl::dbPRJDB.Close();
EDIBgbl::dbSORT.Close();
CString strDir;
m_comboHadBackup.GetLBText(m_comboHadBackup.GetCurSel(),strDir);
CopyFile(m_strAppInstallPath+"BackupDB\\"+strDir+"\\AllPrjDB.mdb",m_strPrjDBPath+"AllPrjDB.mdb",FALSE);
CopyFile(m_strAppInstallPath+"BackupDB\\"+strDir+"\\Sort.mdb",m_strPrjDBPath+"Sort.mdb",FALSE);
AfxMessageBox(IDS_RESTART_AUTOPHS);
CDialog::OnOK();
}
return;
}
BOOL CDlgBackupUndo::OnInitDialog()
{
CDialog::OnInitDialog();
/* CDaoRecordset rsbackup;
rsbackup.m_pDatabase=&EDIBgbl::dbPRJ;
CString strSQL;
strSQL = "SELECT * FROM BackupDBTbl";
rsbackup.Open(AFX_DAO_USE_DEFAULT_TYPE,strSQL);
COleVariant varField;
CString str1,str2,strFirst;
while( !rsbackup.IsEOF() )
{
rsbackup.GetFieldValue(1,varField);//BackupDB_Tablename
str1 = vtos(varField);
rsbackup.GetFieldValue(2,varField);//Description
str2 = vtos(varField);
m_comboHadBackup.AddString(str1);
m_map[str1]=str2;
rsbackup.MoveNext();
}
rsbackup.Close();*/
m_strPrjDBPath = GetRegKey(_T("Directory"), _T("EDInBox_PrjDBDir"), CString(_T("")));
m_strAppInstallPath = GetRegKey(_T("Directory"), _T("EDInBox_InsDir"), CString(_T("")));
CFileFind filefinder;
BOOL bWorking=FALSE;
filefinder.FindFile(m_strAppInstallPath+"BackupDB\\*.*");
do
{
bWorking = filefinder.FindNextFile();
if( filefinder.IsDirectory() )
{
if( !filefinder.IsDots() )
m_comboHadBackup.AddString(filefinder.GetFileName());
}
}while( bWorking );
if( m_comboHadBackup.GetCount()>0 )
{
m_comboHadBackup.SetCurSel(0);
//m_comboHadBackup.GetLBText(0,strFirst);
//m_strDes = m_map[strFirst];
}
else
{
m_comboHadBackup.AddString(_T("暂无备份"));
m_comboHadBackup.SetCurSel(0);
GetDlgItem(IDOK)->EnableWindow(FALSE);
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/issicccc/AutoPHS.git
git@gitee.com:issicccc/AutoPHS.git
issicccc
AutoPHS
AutoPHS
CAE

搜索帮助