aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 14:56:16 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-06-14 14:56:16 +0300
commit099cb04861e293cf675d8b5216448a766eef7954 (patch)
tree29c9cd2cb877e8b44d51dbc1b755c9a81cf300b9 /Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs
parent03959e785f635697fcdf0f99aad9454fafbf4e2e (diff)
downloadTango-099cb04861e293cf675d8b5216448a766eef7954.tar.gz
Tango-099cb04861e293cf675d8b5216448a766eef7954.zip
Implemented new fast job pie chart rendering using GDI!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs45
1 files changed, 45 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs
new file mode 100644
index 000000000..8a60caf6d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Authentication/DefaultAuthenticationProvider.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Entities;
+using Tango.Core;
+using Tango.PPC.Common.Authentication;
+
+namespace Tango.PPC.UI.Authentication
+{
+ public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider
+ {
+ private User _currentUser;
+
+ public User CurrentUser
+ {
+ get { return _currentUser; }
+ private set
+ {
+ _currentUser = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ public event EventHandler<User> CurrentUserChanged;
+
+ public Task<User> Login(string email, string password)
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ CurrentUser = ObservablesEntitiesAdapter.Instance.Users.SingleOrDefault(x => x.Email.ToLower() == email && x.Password == password);
+ CurrentUserChanged?.Invoke(this, CurrentUser);
+ return CurrentUser;
+ });
+ }
+
+ public void Logout()
+ {
+ CurrentUser = null;
+ CurrentUserChanged?.Invoke(this, CurrentUser);
+ }
+ }
+}