-
Notifications
You must be signed in to change notification settings - Fork 0
/
userControlush.xaml.cs
97 lines (94 loc) · 3.9 KB
/
userControlush.xaml.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
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using BE;
using BL;
namespace PLWPF
{
/// <summary>
/// Interaction logic for userControlush.xaml
/// </summary>
public partial class userControlush : UserControl
{
IBL myBL = FactoryBl.GetBl();
GuestRequest guestUser;
Host HostUser;
public event EventHandler CostumerChange;
ValueUserControl ee;
public userControlush(Object obj)
{
InitializeComponent();
guestUser = obj as GuestRequest;
HostUser = obj as Host;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (passwordMask.Password == "")
{
MessageBox.Show("enter your password", "empty password", MessageBoxButton.OK, MessageBoxImage.Error);
}
else
{
if (HostUser != null)
{
List<BE.Host> hosts = myBL.getHosts(item => passwordMask.Password == item.HostId.Substring(5, 4));
if (hosts.Count() == 0)
{
MessageBox.Show("please sign up", "Connection failed", MessageBoxButton.OK, MessageBoxImage.Error);
passwordMask.Password = "";
}
else
{
//העתקה עמוקה
HostUser.HostId = hosts[0].HostId;
HostUser.PrivateName = hosts[0].PrivateName;
HostUser.FamilyName = hosts[0].FamilyName;
HostUser.PhoneNumber = hosts[0].PhoneNumber;
HostUser.MailAdress = hosts[0].MailAdress;
HostUser.BankAccountNumber = hosts[0].BankAccountNumber;
HostUser.CollectionClearance = hosts[0].CollectionClearance;
HostUser.IsInPlace = hosts[0].IsInPlace;
HostUser.Languages = hosts[0].Languages;
HostUser.BankBranchDetails = hosts[0].BankBranchDetails;
passwordMask.Password = "";
ee = new ValueUserControl(HostOrGuest.host);
if (CostumerChange != null)
CostumerChange(this, ee);
}
}
if (guestUser != null)
{
List<GuestRequest> guestRequests = myBL.getGuestRequests(item => passwordMask.Password == item.GuestId.Substring(5, 4));
if (guestRequests.Count() == 0)
{
MessageBox.Show("you dont have guest request", "Connection failed", MessageBoxButton.OK, MessageBoxImage.Error);
passwordMask.Password = "";
}
else
{
guestUser.GuestId = guestRequests[0].GuestId;
guestUser.Family_Name = guestRequests[0].Family_Name;
guestUser.Private_Name = guestRequests[0].Private_Name;
guestUser.MailAddress = guestRequests[0].MailAddress;
passwordMask.Password = "";
ee = new ValueUserControl(HostOrGuest.guest);
if (CostumerChange != null)
CostumerChange(this, ee);
}
}
}
}
}
}