-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoteSearch.cpp
More file actions
103 lines (95 loc) · 2.01 KB
/
NoteSearch.cpp
File metadata and controls
103 lines (95 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "NoteSearch.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#include <Vcl.Imaging.pngimage.hpp>
TForm3 *Form3;
//---------------------------------------------------------------------------
__fastcall TForm3::TForm3(TComponent* Owner, std::vector<Note>& notes_)
: TForm(Owner)
{
success = false;
notes = notes_;
}
//---------------------------------------------------------------------------
std::vector<Note> TForm3::getNotes()
{
return notes;
}
void __fastcall TForm3::FindButtonClick(TObject *Sender)
{
auto lastName = LastNameEdit->Text;
if(lastName.Length() > 0)
{
std::vector<Note> newNotes;
for(auto item : notes)
{
if(item.lastName == lastName)
{
newNotes.push_back(item);
}
}
notes = newNotes;
}
auto firstName = FirstNameEdit->Text;
if(firstName.Length() > 0)
{
std::vector<Note> newNotes;
for(auto item : notes)
{
if(item.firstName == firstName)
{
newNotes.push_back(item);
}
}
notes = newNotes;
}
auto middleName = MiddleNameEdit->Text;
if(middleName.Length() > 0)
{
std::vector<Note> newNotes;
for(auto item : notes)
{
if(item.middleName == middleName)
{
newNotes.push_back(item);
}
}
notes = newNotes;
}
auto number = NumberEdit->Text;
if(number.Length() > 0)
{
std::vector<Note> newNotes;
for(auto item : notes)
{
if(item.number == number)
{
newNotes.push_back(item);
}
}
notes = newNotes;
}
auto adress = AdressEdit->Text;
if(adress.Length() > 0)
{
std::vector<Note> newNotes;
for(auto item : notes)
{
if(item.adress == adress)
{
newNotes.push_back(item);
}
}
notes = newNotes;
}
success = true;
Close();
}
bool TForm3::isSuccess()
{
return success;
}