narsil/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs

40 lines
902 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanshu.Accounts.Repository;
using System.Threading;
using Tanshu.Accounts.Contracts;
using Tanshu.Common.KeyboardControl;
namespace Tanshu.Accounts.PointOfSale
{
class KeyboardLogin : ILogin
{
public bool LoginUser()
{
return LoginUser(true);
}
bool LoginUser(bool setSession)
{
using (LoginForm frm = new LoginForm(new KeyboardControl()))
{
frm.ShowDialog();
var user = frm.User();
if (user != null && setSession)
{
Session.User = user;
}
return user != null;
}
}
public bool LogoutUser()
{
Session.User = null;
return true;
}
}
}