narsil/Tanshu.Accounts.PointOfSale/Authentication/MsrLoginForm.cs
tanshu 3ca8b29e04 Regression: BillItemKey added the compare methods back
Regression: PrintLocation added the compare methods back
Breaking: Kot.Code is now integers
Breaking: Kot Update is now via Stored Procedure to get DB Values
Breaking: Reprints Insert is now via Stored Procedure to get DV Values
Breaking: Voucher.BillID and KotID are now integers
Breaking: Voucher Insert/Update is now via Stored Procedures to get DV Values also Dirty Checking for Voucher has been overwritten to set dirty for LastEditDate update
Fix: Login forms simplified
Feature: PrintLocation and Products are cached application wide.
2014-11-02 13:33:31 +05:30

57 lines
1.5 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() { MsrString = _loginString };
this.Close();
}
}
public User User()
{
return _user;
}
private void MsrLoginForm_KeyPress(object sender, KeyPressEventArgs e)
{
btnLogin.Enabled = true;
this._loginString += e.KeyChar.ToString();
}
}
}