narsil/Tanshu.Accounts.PointOfSale/Authentication/MsrLoginForm.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

59 lines
1.6 KiB
C#

using System;
using System.Windows.Forms;
using Tanshu.Accounts.Entities.Auth;
using Tanshu.Accounts.Repository;
namespace Tanshu.Accounts.PointOfSale
{
public partial class MsrLoginForm : Form
{
private string _loginString;
private User _user;
private readonly bool register;
public MsrLoginForm(bool register)
{
InitializeComponent();
_user = null;
_loginString = string.Empty;
this.register = register;
this.btnLogin.Enabled = false;
}
private void btnLogin_Click(object sender, EventArgs e)
{
if (!register)
{
using (var bi = new UserBI())
{
var user = bi.MsrValidateUser(_loginString);
if (user != null)
{
this._user = user;
this.Close();
}
else
MessageBox.Show("Unrecognised Card");
}
}
else
{
this._user = new User() { Name = _loginString };
this.Close();
}
}
public bool UserName(out string userName)
{
userName = this._user == null ? "" : this._user.Name;
return this._user != null;
}
private void MsrLoginForm_KeyPress(object sender, KeyPressEventArgs e)
{
btnLogin.Enabled = true;
this._loginString += e.KeyChar.ToString();
}
}
}