-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchingPhonebook.cs
61 lines (53 loc) · 1.61 KB
/
SearchingPhonebook.cs
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Phonebook.models;
namespace Phonebook
{
public partial class SearchingPhonebook : Form
{
private readonly IDataAccess _dataAccess;
public SearchingPhonebook(IDataAccess _dataAccess)
{
InitializeComponent();
this._dataAccess = _dataAccess;
}
PersonDTO personDTO = new PersonDTO();
private void ResultSearch()
{
if(personDTO.PersonId == 0)
{
pnlResultFound.Visible = false;
}
else
{
pnlResultFound.Visible = true;
lblPersonId.Text = personDTO.PersonId.ToString();
lblNameSurname.Text = personDTO.NameSurname;
lblNumber.Text = personDTO.Number;
}
}
private void btnSearchNameSurname_Click(object sender, EventArgs e)
{
personDTO = _dataAccess.SearchByNameNumber(txtNameSurname.Text, null);
ResultSearch();
}
private void btnSearchNumber_Click(object sender, EventArgs e)
{
personDTO = _dataAccess.SearchByNameNumber(null, txtNumber.Text);
ResultSearch();
}
private void btnBack_Click(object sender, EventArgs e)
{
MainScreenForm mainScreenForm = new MainScreenForm();
mainScreenForm.Show();
this.Hide();
}
}
}