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:
unknown
2011-06-23 18:17:48 +05:30
parent 0cb7d3cf09
commit d8ecec8bb6
85 changed files with 3520 additions and 2264 deletions

View File

@ -29,7 +29,8 @@ namespace Tanshu.Accounts.PointOfSale
{
cmbUsers.DisplayMember = "Name";
cmbUsers.ValueMember = "UserID";
cmbUsers.DataSource = UserBI.GetUsers();
using (var bi = new UserBI())
cmbUsers.DataSource = bi.List();
}
private void cmbUsers_SelectedIndexChanged(object sender, EventArgs e)

View File

@ -65,40 +65,42 @@ namespace Tanshu.Accounts.PointOfSale
private bool ChangeUserPassword()
{
User userEntity = new User();
var userEntity = new User();
userEntity.Name = txtUsername.Text.Trim();
userEntity.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
if (UserBI.ValidateUser(userEntity.Name, userEntity.Password) != null)
return UserBI.ChangePassword(userEntity, Tanshu.Common.Md5.Hash(txtnewPassword.Text.Trim(), "v2"));
else
return false;
using (var bi = new UserBI())
if (bi.ValidateUser(userEntity.Name, userEntity.Password) != null)
return bi.ChangePassword(userEntity, Tanshu.Common.Md5.Hash(txtnewPassword.Text.Trim(), "v2"));
else
return false;
}
private void btnMsr_Click(object sender, EventArgs e)
{
User user = new User();
var user = new User();
user.Name = txtUsername.Text.Trim();
user.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
user.Password = Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
if (UserBI.ValidateUser(user.Name, user.Password) == null)
return;
using (var bi = new UserBI())
if (bi.ValidateUser(user.Name, user.Password) == null)
return;
using (var frm = new MsrLoginForm(true))
{
frm.ShowDialog();
string userName;
frm.UserName(out userName);
if (userName != null || userName != string.Empty)
if (MessageBox.Show("Update Msr Card", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) !=
DialogResult.Yes)
return;
using (var bi = new UserBI())
{
if (MessageBox.Show("Update Msr Card", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
user = UserBI.GetUserFromName(user.Name);
user.MsrString = userName;
UserBI.Update(user);
MessageBox.Show("Msr Card Updated");
this.Close();
}
user = bi.Get(x => x.Name == user.Name);
user.MsrString = userName;
bi.Update(user);
}
MessageBox.Show("Msr Card Updated");
this.Close();
}
}
}

View File

@ -89,7 +89,7 @@
this.btnDelete.TabIndex = 9;
this.btnDelete.Text = "&Delete";
this.btnDelete.UseVisualStyleBackColor = true;
this.btnDelete.Click += new System.EventHandler(this.btnCreateUSer_Click);
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnCancel
//

View File

@ -1,26 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tanshu.Accounts.Helpers;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.Entities.Auth;
namespace Tanshu.Accounts.PointOfSale
{
public partial class UserForm : Form
{
User user;
User _user;
public UserForm(int? userID)
{
InitializeComponent();
if (userID.HasValue)
user = UserBI.GetUser(userID.Value);
using (var bi = new UserBI())
_user = bi.Get(x => x.UserID == userID.Value);
}
private void btnCancel_Click(object sender, EventArgs e)
@ -28,33 +21,36 @@ namespace Tanshu.Accounts.PointOfSale
this.Close();
}
private void btnCreateUSer_Click(object sender, EventArgs e)
private void btnDelete_Click(object sender, EventArgs e)
{
UserBI.Delete(user.UserID);
using (var bi = new UserBI())
bi.Delete(x => x.UserID == _user.UserID);
btnCancel_Click(sender, e);
}
private void NewUser_Load(object sender, EventArgs e)
{
if (user != null)
{
txtUsername.Text = user.Name;
txtPassword.Text = user.Password;
chkLocked.Checked = user.LockedOut;
}
if (_user == null)
return;
txtUsername.Text = _user.Name;
txtPassword.Text = _user.Password;
chkLocked.Checked = _user.LockedOut;
}
private bool Save()
{
if (user == null)
user = new User();
user.Name = txtUsername.Text.Trim();
user.Password = Tanshu.Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
user.LockedOut = (chkLocked.Checked == true ? true : false);
if (user.UserID == 0)
UserBI.Insert(user);
if (_user == null)
_user = new User();
_user.Name = txtUsername.Text.Trim();
if (_user.Password != txtPassword.Text.Trim())
_user.Password = Common.Md5.Hash(txtPassword.Text.Trim(), "v2");
_user.LockedOut = (chkLocked.Checked == true ? true : false);
if (_user.UserID == 0)
using (var bi = new UserBI())
bi.Insert(_user);
else
UserBI.Update(user);
using (var bi = new UserBI())
bi.Update(_user);
return true;
}