narsil/Tanshu.Accounts.PointOfSale/Authentication/MsrLogin.cs
tanshu 69617949bd Important! : Need to update to new schema using SQL Scripts
Important! : This version will not work.  It is pre-alpha and saved in case of catastrophic failure
Refactor: Remove dependency on Fluent Nhibernate.
Refactor: All Primary keys are now Guids.
Refactor: Class Mappings changed from AutoMap to Explicit Mappings.
Breakage: All Cascading is now disabled and entities must be explicitly saved/updated/deleted
Breakage: Auto Commiting is now off and "SaveChanges()" needs to be called on all BIs.
Refactor: Changed the pattern where all relevant db code for an operation is basically in the same function.
Chore: Removed Advance and Payments options.
2014-10-12 15:11:45 +05:30

38 lines
1.0 KiB
C#

using Tanshu.Accounts.Repository;
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);
}
static bool LoginUser(bool setThreadPrincipal)
{
using (var frm = new MsrLoginForm(false))
{
string userName;
frm.ShowDialog();
var authenticated = frm.UserName(out userName);
if (authenticated && setThreadPrincipal)
using (var bi = new UserBI())
{
Session.User = bi.Get(x => x.Name == userName);
}
return authenticated;
}
}
public bool LogoutUser()
{
Session.User = null;
return true;
}
}
}