// mainfrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "sesadump.h"

#include "mainfrm.h"

#include "sesadlg.h"
#include "sesa.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  //{{AFX_MSG_MAP(CMainFrame)
  ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
  //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
  // TODO: add member initialization code here
}

CMainFrame::~CMainFrame()
{
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
  CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
  CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

void CMainFrame::OnFileOpen()
{
  CSesaDlg dlg;  
  if (dlg.DoModal() == IDOK)
  {
    BOOL ok = SESA_OpenDatabase(dlg.m_strDSN, dlg.m_strConnect);
    if (ok)
    {                      
      SESA_DumpTable(dlg.m_strTable);
      SESA_CloseDatabase();
    }
  }
}