Breaking Changes. Upgrade Script in Sql directory. Deployed
This commit is contained in:
55
Tanshu.Accounts.PointOfSale/Authentication/MsrLoginForm.cs
Normal file
55
Tanshu.Accounts.PointOfSale/Authentication/MsrLoginForm.cs
Normal file
@ -0,0 +1,55 @@
|
||||
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 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)
|
||||
{
|
||||
var user = UserBI.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user