narsil/Tanshu.Accounts.PointOfSale/Authentication/KeyboardLogin.cs
unknown d8ecec8bb6 Added inverse Attribute to ProductGroup.
BillInventory Renamed.
Refactored Bill to be more usable.
Added Bill Detail Report.
Added Open Bill and Bill Details Roles.
Zero Rate Products have Yellow background Color.
Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI,
Cached the Products List.
Product and Product Group Form Working.
2011-06-23 18:17:48 +05:30

48 lines
1.2 KiB
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 setThreadPrincipal)
{
using (LoginForm login = new LoginForm(new KeyboardControl()))
{
string userName;
login.ShowDialog();
bool authenticated = login.UserName(out userName);
if (authenticated && setThreadPrincipal)
SetThreadPrincipal(userName);
return authenticated;
}
}
public bool LogoutUser()
{
Session.User = null;
return true;
}
static void SetThreadPrincipal(string userName)
{
if (userName.Contains(":"))
userName = userName.Substring(userName.IndexOf(":") + 1);
using (var bi = new UserBI())
Session.User = bi.Get(x => x.Name == userName);
}
}
}