/[H6]/SearchDialog.cpp
ViewVC logotype

Contents of /SearchDialog.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Sun Sep 3 10:10:19 2006 UTC (17 years ago) by torben
File size: 2575 byte(s)
Added author/developer comments
1 /*
2 * Developed by Torben H. Nielsen
3 */
4
5 #include "stdafx.h"
6 #include "h6-udlŚnssystem.h"
7 #include "SearchDialog.h"
8 #include ".\searchdialog.h"
9
10 #include "CommonStorage.h"
11 #include "DatabaseLayer.h"
12
13 #include "MyTabCtrl.h"
14
15 // SearchDialog dialog
16
17 IMPLEMENT_DYNAMIC(SearchDialog, CDialog)
18 SearchDialog::SearchDialog(CWnd* pParent /*=NULL*/)
19 : CDialog(SearchDialog::IDD, pParent)
20 {
21 }
22
23 SearchDialog::~SearchDialog()
24 {
25 }
26
27 void SearchDialog::DoDataExchange(CDataExchange* pDX)
28 {
29 CDialog::DoDataExchange(pDX);
30 }
31
32
33 BEGIN_MESSAGE_MAP(SearchDialog, CDialog)
34 ON_WM_SETFOCUS()
35 ON_BN_CLICKED(IDC_CLEAR, OnBnClickedClear)
36 ON_BN_CLICKED(IDC_SEARCH, OnBnClickedSearch)
37 END_MESSAGE_MAP()
38
39
40 // SearchDialog message handlers
41
42 void SearchDialog::OnOK()
43 {
44 //CDialog::OnOK();
45 }
46
47 void SearchDialog::OnCancel()
48 {
49 //CDialog::OnCancel();
50 }
51
52 void SearchDialog::OnSetFocus(CWnd* pOldWnd)
53 {
54 GetDlgItem(IDC_INITS)->EnableWindow( CommonStorage::Instance()->getAdmin() );
55
56 if (! CommonStorage::Instance()->getAdmin() ) {
57 GetDlgItem(IDC_INITS)->SetWindowText("");
58 }
59 }
60
61 BOOL SearchDialog::OnInitDialog()
62 {
63 CDialog::OnInitDialog();
64
65 GetDlgItem(IDC_INITS)->EnableWindow(false);
66 ((CButton*)GetDlgItem(IDC_AVAILABLE))->SetCheck(true);
67 ((CEdit*)GetDlgItem(IDC_BARCODE))->SetLimitText(13); //max 13 chars in barcode field
68
69 return TRUE;
70 }
71
72 void SearchDialog::OnBnClickedClear()
73 {
74 ((CButton*)GetDlgItem(IDC_AVAILABLE))->SetCheck(true);
75 ((CButton*)GetDlgItem(IDC_RESERVED))->SetCheck(false);
76 ((CButton*)GetDlgItem(IDC_DEPOSITED))->SetCheck(false);
77 GetDlgItem(IDC_NAME)->SetWindowText("");
78 GetDlgItem(IDC_BARCODE)->SetWindowText("");
79 GetDlgItem(IDC_INITS)->SetWindowText("");
80 }
81
82
83 void SearchDialog::OnBnClickedSearch()
84 {
85 CString inits,barcode,name;
86 bool available, reserved,deposited;
87
88 available = ( ((CButton*)GetDlgItem(IDC_AVAILABLE))->GetCheck() == 1);
89 reserved = ( ((CButton*)GetDlgItem(IDC_RESERVED))->GetCheck() == 1);
90 deposited = ( ((CButton*)GetDlgItem(IDC_DEPOSITED))->GetCheck() == 1);
91
92 GetDlgItem(IDC_INITS)->GetWindowText(inits);
93 GetDlgItem(IDC_BARCODE)->GetWindowText(barcode);
94 GetDlgItem(IDC_NAME)->GetWindowText(name);
95
96 DatabaseLayer *dblayer = CommonStorage::Instance()->getDBLayer();
97
98
99 vector<Equipment> buffer = dblayer->Search(barcode, name, inits, available, reserved, deposited);
100 CommonStorage::Instance()->setSearchResult(buffer);
101 CommonStorage::Instance()->getTabCtrl()->SetCurSel(1);
102 CommonStorage::Instance()->getTabCtrl()->ChangeFocus();;
103
104 }
105
106

  ViewVC Help
Powered by ViewVC 1.1.20