void CConnectionOptionsDlg::OnOK() {
    int button = GetCheckedRadioButton( IDC_DSNRADIO, IDC_SQLRADIO );
    CString address, server, database;
    switch ( button ) {
    case IDC_DSNRADIO :
        preferences.SetString("ConnectionType","DSN");
        GetDlgItemText( IDC_DSN, database );
        preferences.SetString("DSNDatabase", (LPCTSTR)database );
        preferences.SetString("DSN",(LPCTSTR)database);
        break;
    case IDC_ACCESSRADIO :
        preferences.SetString("ConnectionType","Access");
        GetDlgItemText( IDC_ACCESS, database );
        preferences.SetString("AccessDatabase", (LPCTSTR)database);
        database = (CString)"Driver={Microsoft Access Driver (*.mdb)};Dbq=" + database + ";";
        preferences.SetString("DSN",(LPCTSTR)database);
        break;
    case IDC_SQLRADIO :
        preferences.SetString("ConnectionType","SQL");
        GetDlgItemText( IDC_SQLSERVER, server );
        GetDlgItemText( IDC_SQLADDRESS, address );
        GetDlgItemText( IDC_SQLDATABASE, database );
        preferences.SetString("SQLServer", (LPCTSTR)server);
        preferences.SetString("SQLAddress", (LPCTSTR)address);
        preferences.SetString("SQLDatabase", (LPCTSTR)database);
        database = "Driver={SQL Server};Server=" + server + ";Address=" + address + ";Network=DBMSSOCN;Database=" + database + ";";
        preferences.SetString("DSN",(LPCTSTR)database);
        break;
    }
    preferences.SetBool( "UsePrefix", ( ((CButton*)GetDlgItem( IDC_PREFIX ))->CButton::GetCheck() ? true : false ) );
    CDialog::OnOK();
}
Exemple #2
0
void CMainWindow::OnClose() {
	CWnd* child = GetWindow( GW_CHILD )->GetWindow( GW_CHILD );

	vector< CStudentEditWnd* > children;

	while ( child ) {
		if ( child->IsKindOf( RUNTIME_CLASS( CStudentEditWnd ) ) ) {
			children.push_back( (CStudentEditWnd*)child );
		}
		child = child->GetWindow( GW_HWNDNEXT );
	}

	for ( int i=0; i<children.size(); i++ ) {
		if ( !children[i]->AttemptClose() ) {
			return;
		}
	}

	if ( chooser->IsZoomed() ) {
		preferences.SetInt( "ChooserWindowState", SW_SHOWMAXIMIZED );
	} else {
		preferences.SetInt( "ChooserWindowState", SW_NORMAL );
	}
	chooser->ShowWindow( SW_NORMAL );

	if ( IsZoomed() ) {
		preferences.SetInt( "MainWindowState", SW_SHOWMAXIMIZED );
	} else {
		preferences.SetInt( "MainWindowState", SW_NORMAL );
	}
	ShowWindow( SW_NORMAL );

	CRect area;
	GetWindowRect( area );
	preferences.SetRect( "MainWindowRect", area );
	toolbar.ShowWindow( SW_HIDE );
	RecalcLayout();
	preferences.SetBool( "ShowStudentChooser", ( chooser->IsWindowVisible() ? true : false ) );
	CRect chooserArea;
	chooser->GetWindowRect( chooserArea );
	ScreenToClient( chooserArea );
	chooserArea.bottom-=2;
	chooserArea.left-=2;
	chooserArea.right-=2;
	chooserArea.top-=2;
	preferences.SetRect( "StudentChooserRect", chooserArea );
	preferences.SetInt( "CurrentSchoolYear", chooser->GetSchoolYearID() );

	CMDIFrameWnd::OnClose();
}
void CNewStudentOptionsDlg::OnOK() {
	if ( !((CButton*)GetDlgItem(IDC_SHOWNEWOPTIONS))->GetCheck() ) {
		preferences.SetBool( "ShowNewStudentOptions", false );
	}
	if ( GetCheckedRadioButton( IDC_CREATENEW, IDC_IMPORT ) == IDC_IMPORT ) {
		importSSN.ValidateData();
		if ( storage.StudentExists( importSSN.GetString() ) ) {
			mainWnd->EditStudent( importSSN.GetString(), chooser->GetSchoolYearID() );
		} else {
			MessageBox( "No student exists with that SSN.", "Student Info" );
			return;
		}
	} else {
		chooser->CreateStudent();
	}
	CDialog::OnOK();
}
Exemple #4
0
void CMainWindow::OnFileShowOptionsOnNew() {
	preferences.SetBool( "ShowNewStudentOptions", !preferences.GetBool( "ShowNewStudentOptions" ) );
}