/[H6]/h6-udlånssystemDlg.cpp
ViewVC logotype

Diff of /h6-udlånssystemDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by torben, Tue Sep 5 12:50:38 2006 UTC revision 47 by torben, Wed Sep 6 20:27:24 2006 UTC
# Line 8  Line 8 
8  #include "h6-udlånssystemDlg.h"  #include "h6-udlånssystemDlg.h"
9  #include ".\h6-udlånssystemdlg.h"  #include ".\h6-udlånssystemdlg.h"
10    
11    #include "ConfigFile.h"
12  #include "commonstorage.h"  #include "commonstorage.h"
13    
14  #include "databaselayer.h"  #include "databaselayer.h"
15  #include "microsoftdblayer.h"  #include "microsoftdblayer.h"
16  #include "mysqllayer.h"  #include "mysqllayer.h"
17    #include "postgreslayer.h"
18    
19  #ifdef _DEBUG  #ifdef _DEBUG
20  #define new DEBUG_NEW  #define new DEBUG_NEW
# Line 111  BOOL Ch6udlnssystemDlg::OnInitDialog() Line 114  BOOL Ch6udlnssystemDlg::OnInitDialog()
114          m_tabs.Init();          m_tabs.Init();
115          m_tabs.SetCurSel(0);          m_tabs.SetCurSel(0);
116    
117            ConfigFile config;
118            try {
119                    config.Read();
120            } catch(...) {
121                    MessageBox("Could not open config file");
122                    OnOK();
123            }
124    
125          try {          try {
126                  //DatabaseLayer *dbl = new DatabaseLayer;                  DatabaseLayer *dbl = 0;
127                  DatabaseLayer *dbl = new MySQLLayer;                  if (config.driver.MakeLower() == "mysql")
128                            dbl = new MySQLLayer(config);
129                    else if (config.driver.MakeLower() == "postgresql")
130                            dbl = new PostgresLayer(config);
131                    else if (config.driver.MakeLower() == "microsoftsql")
132                            dbl = new MicrosoftDBLayer(config);
133                    else {
134                            CString tmp;
135                            tmp.Format("Unsupported driver: %s", config.driver);
136                            MessageBox(tmp);
137                            OnOK();
138                    }
139                  CommonStorage::Instance()->setDBLayer(dbl);                  CommonStorage::Instance()->setDBLayer(dbl);
140          } catch (...) {          } catch (...) {
141                  MessageBox(CString("Could not establish connection to the database server\r\n") +                  MessageBox(CString("Could not establish connection to the database server\r\n") +
142                                     "Please contact your network administrator\r\n" +                                     "Please contact your network administrator");
                                    "(This application shuts down automatically)");  
143                  OnOK();                  OnOK();
144          }          }
145    

Legend:
Removed from v.41  
changed lines
  Added in v.47

  ViewVC Help
Powered by ViewVC 1.1.20