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.
This commit is contained in:
@ -39,7 +39,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
if (userName.Contains(":"))
|
||||
userName = userName.Substring(userName.IndexOf(":") + 1);
|
||||
|
||||
Session.User = UserBI.GetUserFromName(userName);
|
||||
using (var bi = new UserBI())
|
||||
Session.User = bi.Get(x => x.Name == userName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -40,7 +40,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
_user = UserBI.ValidateUser(txtUserName.Text.Trim(), Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
|
||||
using (var bi = new UserBI())
|
||||
_user = bi.ValidateUser(txtUserName.Text.Trim(), Tanshu.Common.Md5.Hash(txtPassword.Text, "v2"));
|
||||
if (_user != null)
|
||||
this.Close();
|
||||
else
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using System.Threading;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Common.KeyboardControl;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
@ -16,15 +10,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
return LoginUser(true);
|
||||
}
|
||||
bool LoginUser(bool setThreadPrincipal)
|
||||
|
||||
static bool LoginUser(bool setThreadPrincipal)
|
||||
{
|
||||
using (var frm = new MsrLoginForm(false))
|
||||
{
|
||||
string userName;
|
||||
frm.ShowDialog();
|
||||
bool authenticated = frm.UserName(out userName);
|
||||
var authenticated = frm.UserName(out userName);
|
||||
if (authenticated && setThreadPrincipal)
|
||||
SetThreadPrincipal(userName);
|
||||
using (var bi = new UserBI())
|
||||
Session.User = bi.Get(x => x.Name == userName);
|
||||
return authenticated;
|
||||
}
|
||||
|
||||
@ -35,14 +31,5 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Session.User = null;
|
||||
return true;
|
||||
}
|
||||
static void SetThreadPrincipal(string userName)
|
||||
{
|
||||
//log.Warn(string.Format("User Login: '{0}'", userName));
|
||||
if (userName.Contains(":"))
|
||||
userName = userName.Substring(userName.IndexOf(":") + 1);
|
||||
|
||||
Session.User = UserBI.GetUserFromName(userName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,14 +7,14 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class MsrLoginForm : Form
|
||||
{
|
||||
private string loginString;
|
||||
private User user;
|
||||
private bool register;
|
||||
private string _loginString;
|
||||
private User _user;
|
||||
private readonly bool register;
|
||||
public MsrLoginForm(bool register)
|
||||
{
|
||||
InitializeComponent();
|
||||
user = null;
|
||||
loginString = string.Empty;
|
||||
_user = null;
|
||||
_loginString = string.Empty;
|
||||
this.register = register;
|
||||
this.btnLogin.Enabled = false;
|
||||
}
|
||||
@ -23,33 +23,36 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
if (!register)
|
||||
{
|
||||
var user = UserBI.MsrValidateUser(loginString);
|
||||
|
||||
if (user != null)
|
||||
using (var bi = new UserBI())
|
||||
{
|
||||
this.user = user;
|
||||
this.Close();
|
||||
var user = bi.MsrValidateUser(_loginString);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
this._user = user;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Unrecognised Card");
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Unrecognised Card");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.user = new User() { Name = loginString };
|
||||
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;
|
||||
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();
|
||||
this._loginString += e.KeyChar.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user