2011-06-23 12:47:48 +00:00
|
|
|
|
using Tanshu.Accounts.Repository;
|
2011-02-18 16:54:48 +00:00
|
|
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
|
|
|
{
|
|
|
|
|
class MsrLogin : ILogin
|
|
|
|
|
{
|
|
|
|
|
//private static readonly Tanshu.Logging.SqlLogger log = new Tanshu.Logging.SqlLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
public bool LoginUser()
|
|
|
|
|
{
|
|
|
|
|
return LoginUser(true);
|
|
|
|
|
}
|
2011-06-23 12:47:48 +00:00
|
|
|
|
|
|
|
|
|
static bool LoginUser(bool setThreadPrincipal)
|
2011-02-18 16:54:48 +00:00
|
|
|
|
{
|
|
|
|
|
using (var frm = new MsrLoginForm(false))
|
|
|
|
|
{
|
|
|
|
|
string userName;
|
|
|
|
|
frm.ShowDialog();
|
2011-06-23 12:47:48 +00:00
|
|
|
|
var authenticated = frm.UserName(out userName);
|
2011-02-18 16:54:48 +00:00
|
|
|
|
if (authenticated && setThreadPrincipal)
|
2011-06-23 12:47:48 +00:00
|
|
|
|
using (var bi = new UserBI())
|
2014-10-12 09:41:45 +00:00
|
|
|
|
{
|
2011-06-23 12:47:48 +00:00
|
|
|
|
Session.User = bi.Get(x => x.Name == userName);
|
2014-10-12 09:41:45 +00:00
|
|
|
|
}
|
2011-02-18 16:54:48 +00:00
|
|
|
|
return authenticated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool LogoutUser()
|
|
|
|
|
{
|
|
|
|
|
Session.User = null;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|