void CReferenceDlg::OnSelchangeCombosourcetext() { CReferenceUtils ru; UpdateData(TRUE); //get new value of m_ncboSourceText m_nSourceText=m_ncboSourceText; if (!m_bGreekAndHebrewInstalled) m_nSourceText+=3; //if Hebrew and Greek not installed, account for their databases if (!m_bEnglishBibleInstalled) m_nSourceText+=2; //if English Bible and Missions Documents not installed, account for their databases if (m_nSourceText==5) //if user chose target language text option which is disabled { AfxMessageBox(L"This option is not enabled. Please select another Source Text."); m_nSourceText=6; m_ncboSourceText=6; if (!m_bGreekAndHebrewInstalled) m_ncboSourceText-=3; //if Hebrew and Greek not installed, account for their dbs if (!m_bEnglishBibleInstalled) m_ncboSourceText-=2; //if English Bible and Missions Documents not installed, account for their dbs } m_pDoc->GetDevelopmentReference(&m_nBook,&m_nChapter,&m_nVerse,m_nSourceText); // m_nBook=m_nChapter=m_nVerse=1; LoadBooks(); //update the book drop down and chapter and verse drop downs }
BOOL CReferenceDlg::OnInitDialog() { CWnd* pWnd; CReferenceUtils ru; CDialog::OnInitDialog(); m_cboSourceText.ResetContent(); m_bGreekAndHebrewInstalled=FALSE; //m_bGreekAndHebrewInstalled=ru.GreekAndHebrewInstalled(m_pDoc); //check if Greek and Hebrew installed //if (m_bGreekAndHebrewInstalled) //if Hebrew and Greek installed //{ // m_cboSourceText.AddString(L"Hebrew OT"); // m_cboSourceText.AddString(L"Greek NT"); // m_cboSourceText.AddString(L"Greek Grammar Introduction"); //} m_bEnglishBibleInstalled=ru.EnglishBibleInstalled(m_pDoc); //check if English Bible and Missions Documents installed if (m_bEnglishBibleInstalled) { m_cboSourceText.AddString(L"Missions Documents"); m_cboSourceText.AddString(L"Bible"); } else { pWnd=GetDlgItem(IDC_STATICVERSE); pWnd->SetWindowTextW(L"Text:"); } m_cboSourceText.AddString(L"(this option not enabled)"); m_cboSourceText.AddString(L"Grammar Introduction"); m_cboSourceText.AddString(L"Community Development Texts"); m_nOriginalSourceText=m_nSourceText; //save so that when user hits OK, we'll check if it changed m_ncboSourceText=m_nSourceText; if (!m_bGreekAndHebrewInstalled) m_ncboSourceText-=3; //if Hebrew and Greek not installed, account for their dbs if (!m_bEnglishBibleInstalled) m_ncboSourceText-=2; //if English Bible and Missions Documents not installed, account for their dbs pWnd=&m_cboSourceText; if (m_bChangeSourceTextEnabled==FALSE) pWnd->EnableWindow(FALSE); LoadBooks(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
int main(){ char inputs[10]; int input; int admin = 0; //0 for NO, 1 for YES LoadBooks(&bookRoot); LoadMembers(&memRoot); while(1){ //Main Menu printf("\n\n\t\t\t\t UEC Library\n\n"); printf("1. Issue a book\n"); printf("2. Return book\n"); printf("3. Display all books\n"); printf("4. Find a book\n"); if(admin == 0){ printf("5. Admin Login\n"); printf("6. Exit\n"); }else{ printf("5. Add new book\n"); printf("6. Delete book\n"); printf("7. Add new member\n"); printf("8. Display all members\n"); printf("9. Find member\n"); printf("10. Delete member\n"); printf("11. Logout\n"); printf("12. Exit\n"); } printf("\nEnter your choice: "); fgets(inputs, 10, stdin); input = atoi(inputs); if(input == 0){ printf("Saving database...\n"); FILE *f = fopen(BOOKFILE, "w"); SaveBooks(bookRoot, &f); fclose(f); f = fopen(MEMBERFILE, "w"); SaveMembers(memRoot, &f); fclose(f); exit(1); } if(input <= 0) exit(1); if(admin == 0){ switch(input){ case 1: IssueABook(); break; case 2: ReturnBook(); break; case 3: DisplayAllBooks(); break; case 4: FindBook(); break; case 5: AdminLogin(&admin); break; default: printf("Saving database...\n"); FILE *f = fopen(BOOKFILE, "w"); SaveBooks(bookRoot, &f); fclose(f); f = fopen(MEMBERFILE, "w"); SaveMembers(memRoot, &f); fclose(f); exit(1); } }else{ switch(input){ case 1: IssueABook(); break; case 2: ReturnBook(); break; case 3: DisplayAllBooks(); break; case 4: FindBook(); break; case 5: AddNewBook(); break; case 6: DeleteBook(); break; case 7: AddNewMember(); break; case 8: DisplayAllMembers(); break; case 9: FindMember(); break; case 10: DeleteMember(); break; case 11: admin = 0; break; case 12: default: printf("Saving database...\n"); FILE *f = fopen(BOOKFILE, "w"); SaveBooks(bookRoot, &f); fclose(f); f = fopen(MEMBERFILE, "w"); SaveMembers(memRoot, &f); fclose(f); exit(1); } } } return 0; }