964d0a78bf
Added Voucher Type During Printing Added Discount Report Fixed Void bill table not getting cleared error Added PAX to table Removed Itital Setup button in MainForm as it was not doing anything
63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using Tanshu.Accounts.Entities.Auth;
|
|
using Tanshu.Accounts.Repository;
|
|
using Tanshu.Common.KeyboardControl;
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
{
|
|
public partial class LoginForm : Form
|
|
{
|
|
private User _user;
|
|
private IKeyboardControl _keyboardControl;
|
|
public LoginForm(IKeyboardControl keyboardControl)
|
|
{
|
|
InitializeComponent();
|
|
_user = null;
|
|
this._keyboardControl = keyboardControl;
|
|
|
|
var control = keyboardControl as UserControl;
|
|
if (control != null)
|
|
{
|
|
control.Location = new Point(6, 87);
|
|
this.Controls.Add(control);
|
|
this.Size = this.SizeFromClientSize(new Size(6 + control.Width + 6, 87 + control.Height + 6));
|
|
}
|
|
}
|
|
|
|
private void txtUserName_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Return)
|
|
txtPassword.Focus();
|
|
}
|
|
|
|
private void txtPassword_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Return)
|
|
btnLogin_Click(sender, e);
|
|
}
|
|
|
|
private void btnLogin_Click(object sender, EventArgs e)
|
|
{
|
|
using (var bi = new UserBI())
|
|
_user = bi.ValidateUser(txtUserName.Text.Trim(), Common.Md5.Hash(txtPassword.Text, "v2"));
|
|
if (_user != null)
|
|
this.Close();
|
|
else
|
|
MessageBox.Show("Username or password is not valid");
|
|
}
|
|
|
|
public bool UserName(out string userName)
|
|
{
|
|
userName = this._user == null ? "" : this._user.Name;
|
|
return this._user != null;
|
|
}
|
|
|
|
private void btnExit_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|