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.
This commit is contained in:
tanshu
2014-11-02 13:33:31 +05:30
parent 45831e2e4d
commit 3ca8b29e04
33 changed files with 528 additions and 332 deletions

View File

@ -15,16 +15,17 @@ namespace Tanshu.Accounts.PointOfSale
{
return LoginUser(true);
}
bool LoginUser(bool setThreadPrincipal)
bool LoginUser(bool setSession)
{
using (LoginForm login = new LoginForm(new KeyboardControl()))
using (LoginForm frm = new LoginForm(new KeyboardControl()))
{
string userName;
login.ShowDialog();
bool authenticated = login.UserName(out userName);
if (authenticated && setThreadPrincipal)
SetThreadPrincipal(userName);
return authenticated;
frm.ShowDialog();
var user = frm.User();
if (user != null && setSession)
{
Session.User = user;
}
return user != null;
}
}
@ -34,14 +35,5 @@ namespace Tanshu.Accounts.PointOfSale
Session.User = null;
return true;
}
static void SetThreadPrincipal(string userName)
{
if (userName.Contains(":"))
userName = userName.Substring(userName.IndexOf(":") + 1);
using (var bi = new UserBI())
Session.User = bi.Get(x => x.Name == userName);
}
}
}

View File

@ -41,17 +41,16 @@ namespace Tanshu.Accounts.PointOfSale
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"));
_user = bi.ValidateUser(txtUserName.Text.Trim(), txtPassword.Text);
if (_user != null)
this.Close();
else
MessageBox.Show("Username or password is not valid");
}
public bool UserName(out string userName)
public User User()
{
userName = this._user == null ? "" : this._user.Name;
return this._user != null;
return _user;
}
private void btnExit_Click(object sender, EventArgs e)

View File

@ -11,19 +11,17 @@ namespace Tanshu.Accounts.PointOfSale
return LoginUser(true);
}
static bool LoginUser(bool setThreadPrincipal)
static bool LoginUser(bool setSession)
{
using (var frm = new MsrLoginForm(false))
{
string userName;
frm.ShowDialog();
var authenticated = frm.UserName(out userName);
if (authenticated && setThreadPrincipal)
using (var bi = new UserBI())
{
Session.User = bi.Get(x => x.Name == userName);
}
return authenticated;
var user = frm.User();
if (user != null && setSession)
{
Session.User = user;
}
return user != null;
}
}

View File

@ -26,7 +26,6 @@ namespace Tanshu.Accounts.PointOfSale
using (var bi = new UserBI())
{
var user = bi.MsrValidateUser(_loginString);
if (user != null)
{
this._user = user;
@ -38,15 +37,14 @@ namespace Tanshu.Accounts.PointOfSale
}
else
{
this._user = new User() { Name = _loginString };
this._user = new User() { MsrString = _loginString };
this.Close();
}
}
public bool UserName(out string userName)
public User User()
{
userName = this._user == null ? "" : this._user.Name;
return this._user != null;
return _user;
}
private void MsrLoginForm_KeyPress(object sender, KeyPressEventArgs e)