Chore: Removed Waiter as it was not ever used.
Refactor: Changed the user list form to a normal form. Feature: Service Charge disabled setting removes it from the Product Form.
This commit is contained in:
parent
caf9b3106c
commit
69560cfb07
Sql
Tanshu.Accounts.Contracts
Tanshu.Accounts.Helpers
Tanshu.Accounts.PointOfSale
Controllers
MainForm.csMainForm.designer.csProducts
Properties
Sales
Tanshu.Accounts.PointOfSale.csprojUser Management
Tanshu.Accounts.Print
Tanshu.Accounts.Repository
81
Sql/2016.01.04 Remove Waiter.sql
Normal file
81
Sql/2016.01.04 Remove Waiter.sql
Normal file
@ -0,0 +1,81 @@
|
||||
BEGIN TRANSACTION
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK415A8D773E16E17E]') AND parent_object_id = OBJECT_ID(N'[dbo].[Vouchers]'))
|
||||
ALTER TABLE [dbo].[Vouchers] DROP CONSTRAINT [FK415A8D773E16E17E]
|
||||
GO
|
||||
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Waiters]') AND type in (N'U'))
|
||||
DROP TABLE [dbo].[Waiters]
|
||||
GO
|
||||
ALTER TABLE dbo.Vouchers DROP COLUMN WaiterID
|
||||
GO
|
||||
ALTER PROCEDURE [dbo].[VoucherUpdate]
|
||||
@Pax int,
|
||||
@UserID uniqueidentifier,
|
||||
@TableID uniqueidentifier,
|
||||
@CustomerID uniqueidentifier,
|
||||
@Narration nvarchar(255),
|
||||
@Void bit,
|
||||
@VoidReason nvarchar(255),
|
||||
@Printed bit,
|
||||
@VoucherType int,
|
||||
@VoucherID uniqueidentifier
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @LastEditDate datetime;
|
||||
DECLARE @Date datetime;
|
||||
DECLARE @BillID int;
|
||||
SELECT @Printed = CASE WHEN @Printed = 1 THEN 1 ELSE Printed END,
|
||||
@BillID = BillID, @Date = Date, @LastEditDate = GETDATE()
|
||||
FROM Vouchers WHERE VoucherID = @VoucherID;
|
||||
|
||||
IF @Printed = 1 AND @BillID IS NULL
|
||||
BEGIN
|
||||
IF @VoucherType IN (1,3)
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType IN (1, 3);
|
||||
ELSE
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType = @VoucherType;
|
||||
IF @BillID % 10000 = 0
|
||||
SELECT @BillID = @BillID + 1;
|
||||
SELECT @Date = @LastEditDate;
|
||||
END
|
||||
|
||||
UPDATE Vouchers SET Pax = @Pax, UserID = @UserID, TableID = @TableID,
|
||||
CustomerID = @CustomerID, Narration = @Narration, Void = @Void,
|
||||
VoidReason = @VoidReason, Printed = @Printed, VoucherType = @VoucherType, LastEditDate = @LastEditDate,
|
||||
Date = @Date, BillID = @BillID
|
||||
WHERE VoucherID = @VoucherID;
|
||||
END
|
||||
GO
|
||||
ALTER PROCEDURE [dbo].[VoucherInsert]
|
||||
@Pax int,
|
||||
@UserID uniqueidentifier,
|
||||
@TableID uniqueidentifier,
|
||||
@CustomerID uniqueidentifier,
|
||||
@Narration nvarchar(255),
|
||||
@Void bit,
|
||||
@VoidReason nvarchar(255),
|
||||
@Printed bit,
|
||||
@VoucherType int,
|
||||
@VoucherID uniqueidentifier
|
||||
AS
|
||||
BEGIN
|
||||
DECLARE @Date datetime;
|
||||
DECLARE @BillID int;
|
||||
DECLARE @KotID int;
|
||||
SELECT @Date = GETDATE(), @BillID = null;
|
||||
|
||||
SELECT @KotID = ISNULL(MAX(KotID) + 1, 1) FROM Vouchers;
|
||||
IF @Printed = 1
|
||||
BEGIN
|
||||
IF @VoucherType IN (1,3)
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType IN (1, 3);
|
||||
ELSE
|
||||
SELECT @BillID = ISNULL(MAX(BillID) + 1, 1) FROM Vouchers WHERE VoucherType = @VoucherType;
|
||||
IF @BillID % 10000 = 0
|
||||
SELECT @BillID = @BillID + 1;
|
||||
END
|
||||
INSERT INTO Vouchers (VoucherID, Date, Pax, UserID, CreationDate, LastEditDate, BillID, TableID, CustomerID, Narration, Void, VoidReason, Printed, VoucherType, KotID)
|
||||
VALUES (@VoucherID, @Date, @Pax, @UserID, @Date, @Date, @BillID, @TableID, @CustomerID, @Narration, @Void, @VoidReason, @Printed, @VoucherType, @KotID);
|
||||
END
|
||||
GO
|
||||
COMMIT
|
1
Sql/2016.01.04 Service Charge Setting.sql
Normal file
1
Sql/2016.01.04 Service Charge Setting.sql
Normal file
@ -0,0 +1 @@
|
||||
INSERT INTO Settings (SettingID, Name, Details) VALUES (NEWID(), 'Service Charge Enabled', 'no')
|
@ -14,12 +14,5 @@ namespace Tanshu.Accounts.Contracts
|
||||
return new Guid("2C716F4B-0736-429A-AD51-610D7C47CB5E");
|
||||
}
|
||||
}
|
||||
public static Guid WAITER
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Guid("3ECB3BCE-CBBA-461C-BC16-5823FC075AAA");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,11 @@ namespace Tanshu.Accounts.Entities
|
||||
VoucherType = VoucherType.Regular;
|
||||
}
|
||||
|
||||
public Voucher(User user, Customer customer, FoodTable table, Waiter waiter, bool printed, bool isVoid, string narration)
|
||||
public Voucher(User user, Customer customer, FoodTable table, bool printed, bool isVoid, string narration)
|
||||
: this(user)
|
||||
{
|
||||
Customer = customer;
|
||||
Table = table;
|
||||
Waiter = waiter;
|
||||
Printed = printed;
|
||||
Void = isVoid;
|
||||
Narration = narration;
|
||||
@ -48,7 +47,6 @@ namespace Tanshu.Accounts.Entities
|
||||
protected int? _billID;
|
||||
public virtual int? BillID { get { return _billID; } }
|
||||
public virtual FoodTable Table { get; set; }
|
||||
public virtual Waiter Waiter { get; set; }
|
||||
public virtual Customer Customer { get; set; }
|
||||
public virtual IList<VoucherSettlement> Settlements { get; set; }
|
||||
public virtual string Narration { get; set; }
|
||||
@ -93,8 +91,8 @@ namespace Tanshu.Accounts.Entities
|
||||
Table("Vouchers");
|
||||
Schema("dbo");
|
||||
Lazy(true);
|
||||
SqlInsert(@"exec VoucherInsert ?,?,?,?,?,?,?,?,?,?,?");
|
||||
SqlUpdate(@"exec VoucherUpdate ?,?,?,?,?,?,?,?,?,?,?");
|
||||
SqlInsert(@"exec VoucherInsert ?,?,?,?,?,?,?,?,?,?");
|
||||
SqlUpdate(@"exec VoucherUpdate ?,?,?,?,?,?,?,?,?,?");
|
||||
Id(x => x.VoucherID, map => map.Generator(Generators.GuidComb));
|
||||
Property(x => x.Date, map =>
|
||||
{
|
||||
@ -149,13 +147,6 @@ namespace Tanshu.Accounts.Entities
|
||||
map.Cascade(Cascade.None);
|
||||
});
|
||||
|
||||
ManyToOne(x => x.Waiter, map =>
|
||||
{
|
||||
map.Column("WaiterID");
|
||||
map.NotNullable(true);
|
||||
map.Cascade(Cascade.None);
|
||||
});
|
||||
|
||||
ManyToOne(x => x.Customer, map =>
|
||||
{
|
||||
map.Column("CustomerID");
|
||||
|
@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using NHibernate.Mapping.ByCode.Conformist;
|
||||
using NHibernate.Mapping.ByCode;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Tanshu.Accounts.Entities
|
||||
{
|
||||
public class Waiter
|
||||
{
|
||||
public virtual Guid WaiterID { get; set; }
|
||||
public virtual string Name { get; set; }
|
||||
public virtual IList<Voucher> Vouchers { get; set; }
|
||||
}
|
||||
public class WaiterMap : ClassMapping<Waiter>
|
||||
{
|
||||
public WaiterMap()
|
||||
{
|
||||
Table("Waiters");
|
||||
Schema("dbo");
|
||||
Lazy(true);
|
||||
Id(x => x.WaiterID, map => map.Generator(Generators.GuidComb));
|
||||
Property(x => x.Name, map => { map.NotNullable(true); map.Unique(true); });
|
||||
Bag(x => x.Vouchers, colmap => { colmap.Key(x => x.Column("WaiterID")); colmap.Inverse(true); }, map => { map.OneToMany(); });
|
||||
}
|
||||
}
|
||||
}
|
@ -89,7 +89,6 @@
|
||||
<Compile Include="Data Contracts\FoodTableBO.cs" />
|
||||
<Compile Include="Data Contracts\TaxBO.cs" />
|
||||
<Compile Include="Data Contracts\CustomerBO.cs" />
|
||||
<Compile Include="Data Contracts\WaiterBO.cs" />
|
||||
<Compile Include="Data Contracts\InventoryBO.cs" />
|
||||
<Compile Include="Data Contracts\ProductBO.cs" />
|
||||
<Compile Include="Data Contracts\ProductGroupBO.cs" />
|
||||
|
@ -1,109 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Data;
|
||||
using Tanshu.Accounts.Entities;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectWaiter : Tanshu.Data.BaseSelector<Waiter>
|
||||
{
|
||||
public event WaiterEventHandler WaiterEvent;
|
||||
public SelectWaiter(GetData<Waiter> getData, bool autoClose) : base(getData, true, "Select a Waiter")
|
||||
{
|
||||
var filters = new List<string> {"Name"};
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["WaiterID"].Visible = false;
|
||||
}
|
||||
|
||||
protected override void FilterChanged(Dictionary<string, string> filter)
|
||||
{
|
||||
//data = originalData.Where(d => d.Name.ToLower().Contains(filter["Name"].ToLower())).ToList();
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(Waiter item)
|
||||
{
|
||||
DisplayLabel = item == null ? "" : string.Format("Waiter Name: {0}", item.Name);
|
||||
}
|
||||
|
||||
protected override Waiter HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
var waiter = bindingSource.Current as Waiter;
|
||||
|
||||
if (WaiterEvent == null)
|
||||
{
|
||||
e.Handled = false;
|
||||
return waiter;
|
||||
}
|
||||
|
||||
var eventArgs = new SelectorEventArgs<Waiter>(null,SelectorAction.Insert);
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.F1:
|
||||
{
|
||||
waiter = new Waiter { Name = base.filterColumns["Name"].Trim() };
|
||||
eventArgs = new SelectorEventArgs<Waiter>(waiter,SelectorAction.Insert);
|
||||
break;
|
||||
}
|
||||
case Keys.F2:
|
||||
{
|
||||
if (waiter != null)
|
||||
waiter.Name = base.filterColumns["Name"].Trim();
|
||||
eventArgs = new SelectorEventArgs<Waiter>(waiter, SelectorAction.Update);
|
||||
break;
|
||||
}
|
||||
case Keys.F8:
|
||||
{
|
||||
if (waiter != null)
|
||||
eventArgs = new SelectorEventArgs<Waiter>(waiter, SelectorAction.Delete);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((waiter != null) && ((e.KeyCode == Keys.F1) || (e.KeyCode == Keys.F2) || (e.KeyCode == Keys.F8)))
|
||||
waiter = WaiterEvent(sender, eventArgs);
|
||||
|
||||
e.Handled = eventArgs.Handled;
|
||||
return waiter;
|
||||
}
|
||||
#region Designer Code
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
public delegate Waiter WaiterEventHandler(object sender, SelectorEventArgs<Waiter> e);
|
||||
}
|
@ -67,18 +67,12 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectorEvent.cs" />
|
||||
<Compile Include="SelectUser.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectVoidReason.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectCustomer.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SelectWaiter.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -18,11 +18,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private Guid? _editVoucherID;
|
||||
private ISaleForm _saleForm;
|
||||
|
||||
public Waiter Waiter
|
||||
{
|
||||
get { return _voucher.Waiter; }
|
||||
set { _voucher.Waiter = value; }
|
||||
}
|
||||
public BillController(Guid? editVoucherID)
|
||||
{
|
||||
this._editVoucherID = editVoucherID;
|
||||
@ -30,8 +25,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
_voucher = new Voucher(Session.User);
|
||||
using (var bi = new CustomerBI())
|
||||
_voucher.Customer = bi.Get(x => x.CustomerID == Constants.CASH_CUSTOMER);
|
||||
using (var bi = new WaiterBI())
|
||||
_voucher.Waiter = bi.Get(x => x.WaiterID == Constants.WAITER);
|
||||
}
|
||||
public BillItemValue CurrentProduct
|
||||
{
|
||||
@ -203,63 +196,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
return form.Customer;
|
||||
}
|
||||
}
|
||||
public void ShowWaiters(bool reset)
|
||||
{
|
||||
if (reset)
|
||||
{
|
||||
using (var bi = new WaiterBI())
|
||||
_voucher.Waiter = bi.Get(x => x.WaiterID == Constants.WAITER);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var selectWaiter = new SelectWaiter(WaiterBI.StaticList, true))
|
||||
{
|
||||
selectWaiter.WaiterEvent += selectWaiter_waiterEvent;
|
||||
selectWaiter.ShowDialog();
|
||||
if (selectWaiter.SelectedItem != null)
|
||||
{
|
||||
_voucher.Waiter = selectWaiter.SelectedItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var bi = new WaiterBI())
|
||||
_voucher.Waiter = bi.Get(x => x.WaiterID == Constants.WAITER);
|
||||
}
|
||||
}
|
||||
}
|
||||
_saleForm.SetWaiterDisplay(_voucher.Waiter.Name);
|
||||
}
|
||||
private Waiter selectWaiter_waiterEvent(object sender, SelectorEventArgs<Waiter> e)
|
||||
{
|
||||
var waiter = e.Item;
|
||||
//if (!Thread.CurrentPrincipal.IsInRole("Waiter/Master"))
|
||||
// return waiter;
|
||||
|
||||
using (var bi = new WaiterBI())
|
||||
{
|
||||
switch (e.Action)
|
||||
{
|
||||
case SelectorAction.Insert: // Add
|
||||
bi.Insert(waiter);
|
||||
bi.SaveChanges();
|
||||
e.Handled = true;
|
||||
return waiter;
|
||||
case SelectorAction.Update: // Edit
|
||||
bi.Update(waiter);
|
||||
bi.SaveChanges();
|
||||
e.Handled = true;
|
||||
return waiter;
|
||||
case SelectorAction.Delete: // Delete
|
||||
bi.Delete(x => x.WaiterID == waiter.WaiterID);
|
||||
bi.SaveChanges();
|
||||
e.Handled = true;
|
||||
return bi.Get(x => x.WaiterID == Constants.WAITER);
|
||||
default:
|
||||
e.Handled = true;
|
||||
return bi.Get(x => x.WaiterID == Constants.WAITER);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ShowAmount()
|
||||
{
|
||||
var taxAmount = _bill.Values.Sum(b => b.ServiceTaxAmount + b.VatAmount);
|
||||
@ -351,7 +287,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
_voucher = new Voucher(Session.User);
|
||||
ShowCustomers(true);
|
||||
ShowWaiters(true);
|
||||
_bill.Clear();
|
||||
var newKotKey = new BillItemKey(Guid.Empty);
|
||||
var newKotItem = new BillItemValue();
|
||||
@ -547,7 +482,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
#region Check if Allowed
|
||||
if (!Session.IsAllowed("Print Bill"))
|
||||
return; // throw new PermissionException("Printing not allowed");
|
||||
return;
|
||||
if (_bill.Count == 1) //new kot only
|
||||
return;
|
||||
bool isPrinted = false, isVoid = false;
|
||||
@ -587,15 +522,27 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
public void SplitBill()
|
||||
{
|
||||
bool isPrinted = false;
|
||||
#region Permissions
|
||||
|
||||
bool isPrinted, isVoid;
|
||||
IsPrintedOrVoid(_voucher, out isPrinted, out isVoid);
|
||||
if (_voucher.VoucherID == Guid.Empty || isVoid)
|
||||
return; // must be existing non void bill
|
||||
|
||||
if (!Session.IsAllowed("Split Bill"))
|
||||
return;
|
||||
if (_voucher.VoucherID == Guid.Empty)
|
||||
return; // must be existing non void bill
|
||||
using (var bi = new VoucherBI())
|
||||
{
|
||||
var dbVoucher = bi.Get(x => x.VoucherID == _voucher.VoucherID);
|
||||
if (dbVoucher.Void)
|
||||
{
|
||||
MessageBox.Show(string.Format("This Bill is already void.\nReason: {0}", _voucher.VoidReason), "Bill already Voided", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;// must be a non void bill
|
||||
}
|
||||
if (dbVoucher.Printed && !Session.IsAllowed("Edit Printed Bill"))
|
||||
{
|
||||
MessageBox.Show("This Bill is already Printed.\nYou do not have the authority to alter it", "Bill already Printed", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;// not allowed to edit printed bill
|
||||
}
|
||||
isPrinted = dbVoucher.Printed;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get Move List
|
||||
@ -625,7 +572,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
Customer = _voucher.Customer,
|
||||
Table = table,
|
||||
Waiter = _voucher.Waiter,
|
||||
Printed = isPrinted,
|
||||
Void = false,
|
||||
Narration = "",
|
||||
@ -642,7 +588,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
Customer = _voucher.Customer,
|
||||
Table = _voucher.Table,
|
||||
Waiter = _voucher.Waiter,
|
||||
Printed = isPrinted,
|
||||
Void = false,
|
||||
Narration = "",
|
||||
@ -725,7 +670,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
Customer = _voucher.Customer,
|
||||
Table = _voucher.Table,
|
||||
Waiter = _voucher.Waiter,
|
||||
Printed = true,
|
||||
Void = false,
|
||||
Narration = "",
|
||||
@ -783,7 +727,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
var voucher = bi.Get(x => x.VoucherID == _voucher.VoucherID);
|
||||
voucher.User = Session.User;
|
||||
voucher.Customer = _voucher.Customer;
|
||||
voucher.Waiter = _voucher.Waiter;
|
||||
voucher.Printed = finalBill;
|
||||
voucher.VoucherType = _voucher.VoucherType;
|
||||
foreach (var item in _bill.Where(x => x.Key.BillItemType == BillItemType.Product && x.Key.KotID != Guid.Empty))
|
||||
|
@ -13,7 +13,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
void ClearBill(List<BillItemValue> bill);
|
||||
void SetCustomerDisplay(string name);
|
||||
void SetWaiterDisplay(string p);
|
||||
void CloseWindow();
|
||||
void ShowAmount(decimal discountAmount, decimal grossAmount, decimal serviceChargeAmount, decimal taxAmount, decimal valueAmount, List<BillItemValue> bill);
|
||||
void ShowInfo(Voucher voucher);
|
||||
|
@ -24,21 +24,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Text = "Point of Sale: Login (" + Environment.MachineName + ")";
|
||||
}
|
||||
|
||||
private User form_userEvent(object sender, UserEventArgs e)
|
||||
{
|
||||
var user = e.User;
|
||||
|
||||
if (user == null)
|
||||
using (var form = new UserForm(null))
|
||||
form.ShowDialog();
|
||||
else
|
||||
using (var form = new UserForm(user.UserID))
|
||||
form.ShowDialog();
|
||||
|
||||
e.Handled = true;
|
||||
return new User();
|
||||
}
|
||||
|
||||
private void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoginUser(new KeyboardLogin());
|
||||
@ -79,17 +64,11 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnCreateUser_Click(object sender, EventArgs e)
|
||||
private void btnUsers_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Session.IsAllowed("Roles"))
|
||||
using (var bi = new UserBI())
|
||||
{
|
||||
using (var form = new SelectUser(bi.GetFilteredUsers, true))
|
||||
{
|
||||
form.UserEvent += form_userEvent;
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
using (var frm = new UserListForm())
|
||||
frm.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnUserRoles_Click(object sender, EventArgs e)
|
||||
@ -163,7 +142,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
btnCustomer.Visible = Session.IsAllowed("Customers");
|
||||
|
||||
btnCreateUser.Visible = Session.IsAllowed("Users");
|
||||
btnUsers.Visible = Session.IsAllowed("Users");
|
||||
btnUserRoles.Visible = Session.IsAllowed("Users");
|
||||
|
||||
btnGroupRoles.Visible = Session.IsAllowed("Roles");
|
||||
|
22
Tanshu.Accounts.PointOfSale/MainForm.designer.cs
generated
22
Tanshu.Accounts.PointOfSale/MainForm.designer.cs
generated
@ -39,7 +39,7 @@
|
||||
this.btnMachines = new System.Windows.Forms.Button();
|
||||
this.btnModifiers = new System.Windows.Forms.Button();
|
||||
this.btnOpenBill = new System.Windows.Forms.Button();
|
||||
this.btnCreateUser = new System.Windows.Forms.Button();
|
||||
this.btnUsers = new System.Windows.Forms.Button();
|
||||
this.btnUserRoles = new System.Windows.Forms.Button();
|
||||
this.btnGroupRoles = new System.Windows.Forms.Button();
|
||||
this.btnCashierCheckout = new System.Windows.Forms.Button();
|
||||
@ -87,7 +87,7 @@
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnMachines);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnModifiers);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnOpenBill);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnCreateUser);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnUsers);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnUserRoles);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnGroupRoles);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnCashierCheckout);
|
||||
@ -186,15 +186,15 @@
|
||||
this.btnOpenBill.UseVisualStyleBackColor = true;
|
||||
this.btnOpenBill.Click += new System.EventHandler(this.btnOpenBill_Click);
|
||||
//
|
||||
// btnCreateUser
|
||||
// btnUsers
|
||||
//
|
||||
this.btnCreateUser.Location = new System.Drawing.Point(3, 215);
|
||||
this.btnCreateUser.Name = "btnCreateUser";
|
||||
this.btnCreateUser.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnCreateUser.TabIndex = 10;
|
||||
this.btnCreateUser.Text = "Create User";
|
||||
this.btnCreateUser.UseVisualStyleBackColor = true;
|
||||
this.btnCreateUser.Click += new System.EventHandler(this.btnCreateUser_Click);
|
||||
this.btnUsers.Location = new System.Drawing.Point(3, 215);
|
||||
this.btnUsers.Name = "btnUsers";
|
||||
this.btnUsers.Size = new System.Drawing.Size(150, 100);
|
||||
this.btnUsers.TabIndex = 10;
|
||||
this.btnUsers.Text = "Users";
|
||||
this.btnUsers.UseVisualStyleBackColor = true;
|
||||
this.btnUsers.Click += new System.EventHandler(this.btnUsers_Click);
|
||||
//
|
||||
// btnUserRoles
|
||||
//
|
||||
@ -346,7 +346,7 @@
|
||||
private System.Windows.Forms.Button btnMachines;
|
||||
private System.Windows.Forms.Button btnModifiers;
|
||||
private System.Windows.Forms.Button btnOpenBill;
|
||||
private System.Windows.Forms.Button btnCreateUser;
|
||||
private System.Windows.Forms.Button btnUsers;
|
||||
private System.Windows.Forms.Button btnUserRoles;
|
||||
private System.Windows.Forms.Button btnGroupRoles;
|
||||
private System.Windows.Forms.Button btnCashierCheckout;
|
||||
|
@ -33,7 +33,7 @@
|
||||
this.bsProductGroups = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.Label7 = new System.Windows.Forms.Label();
|
||||
this.bsServiceTax = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.lblServiceCharge = new System.Windows.Forms.Label();
|
||||
this.Label2 = new System.Windows.Forms.Label();
|
||||
this.txtUnits = new System.Windows.Forms.TextBox();
|
||||
this.txtName = new System.Windows.Forms.TextBox();
|
||||
@ -46,12 +46,13 @@
|
||||
this.cmbProductGroup = new System.Windows.Forms.ComboBox();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnOk = new System.Windows.Forms.Button();
|
||||
this.txtFullPrice = new System.Windows.Forms.TextBox();
|
||||
this.cmbServiceTax = new System.Windows.Forms.ComboBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.chkIsScTaxable = new System.Windows.Forms.CheckBox();
|
||||
this.chkIsNotAvailable = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtFullPrice = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsVat)).BeginInit();
|
||||
@ -60,11 +61,11 @@
|
||||
// Label4
|
||||
//
|
||||
this.Label4.AutoSize = true;
|
||||
this.Label4.Location = new System.Drawing.Point(19, 41);
|
||||
this.Label4.Location = new System.Drawing.Point(75, 41);
|
||||
this.Label4.Name = "Label4";
|
||||
this.Label4.Size = new System.Drawing.Size(85, 13);
|
||||
this.Label4.Size = new System.Drawing.Size(31, 13);
|
||||
this.Label4.TabIndex = 15;
|
||||
this.Label4.Text = "Price / Full Price";
|
||||
this.Label4.Text = "Price";
|
||||
//
|
||||
// bsProductGroups
|
||||
//
|
||||
@ -73,24 +74,24 @@
|
||||
// Label7
|
||||
//
|
||||
this.Label7.AutoSize = true;
|
||||
this.Label7.Location = new System.Drawing.Point(70, 143);
|
||||
this.Label7.Location = new System.Drawing.Point(70, 172);
|
||||
this.Label7.Name = "Label7";
|
||||
this.Label7.Size = new System.Drawing.Size(36, 13);
|
||||
this.Label7.TabIndex = 17;
|
||||
this.Label7.TabIndex = 20;
|
||||
this.Label7.Text = "Group";
|
||||
//
|
||||
// bsServiceTax
|
||||
//
|
||||
this.bsServiceTax.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
|
||||
//
|
||||
// label5
|
||||
// lblServiceCharge
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(26, 117);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(80, 13);
|
||||
this.label5.TabIndex = 16;
|
||||
this.label5.Text = "Service Charge";
|
||||
this.lblServiceCharge.AutoSize = true;
|
||||
this.lblServiceCharge.Location = new System.Drawing.Point(26, 146);
|
||||
this.lblServiceCharge.Name = "lblServiceCharge";
|
||||
this.lblServiceCharge.Size = new System.Drawing.Size(80, 13);
|
||||
this.lblServiceCharge.TabIndex = 19;
|
||||
this.lblServiceCharge.Text = "Service Charge";
|
||||
//
|
||||
// Label2
|
||||
//
|
||||
@ -107,7 +108,7 @@
|
||||
this.txtUnits.Location = new System.Drawing.Point(307, 12);
|
||||
this.txtUnits.Name = "txtUnits";
|
||||
this.txtUnits.Size = new System.Drawing.Size(96, 20);
|
||||
this.txtUnits.TabIndex = 2;
|
||||
this.txtUnits.TabIndex = 1;
|
||||
//
|
||||
// txtName
|
||||
//
|
||||
@ -115,12 +116,12 @@
|
||||
this.txtName.Location = new System.Drawing.Point(112, 12);
|
||||
this.txtName.Name = "txtName";
|
||||
this.txtName.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtName.TabIndex = 1;
|
||||
this.txtName.TabIndex = 0;
|
||||
//
|
||||
// txtPrice
|
||||
//
|
||||
this.txtPrice.AccessibleName = "";
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 38);
|
||||
this.txtPrice.Location = new System.Drawing.Point(112, 64);
|
||||
this.txtPrice.Name = "txtPrice";
|
||||
this.txtPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtPrice.TabIndex = 3;
|
||||
@ -131,10 +132,10 @@
|
||||
this.cmbVat.DataSource = this.bsVat;
|
||||
this.cmbVat.DisplayMember = "Name";
|
||||
this.cmbVat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbVat.Location = new System.Drawing.Point(112, 88);
|
||||
this.cmbVat.Location = new System.Drawing.Point(112, 117);
|
||||
this.cmbVat.Name = "cmbVat";
|
||||
this.cmbVat.Size = new System.Drawing.Size(189, 21);
|
||||
this.cmbVat.TabIndex = 4;
|
||||
this.cmbVat.TabIndex = 6;
|
||||
this.cmbVat.ValueMember = "TaxID";
|
||||
//
|
||||
// bsVat
|
||||
@ -144,132 +145,141 @@
|
||||
// chkIsActive
|
||||
//
|
||||
this.chkIsActive.AutoSize = true;
|
||||
this.chkIsActive.Location = new System.Drawing.Point(307, 66);
|
||||
this.chkIsActive.Location = new System.Drawing.Point(307, 95);
|
||||
this.chkIsActive.Name = "chkIsActive";
|
||||
this.chkIsActive.Size = new System.Drawing.Size(67, 17);
|
||||
this.chkIsActive.TabIndex = 7;
|
||||
this.chkIsActive.TabIndex = 5;
|
||||
this.chkIsActive.Text = "Is Active";
|
||||
this.chkIsActive.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// txtServiceCharge
|
||||
//
|
||||
this.txtServiceCharge.AccessibleName = "Phone 1";
|
||||
this.txtServiceCharge.Location = new System.Drawing.Point(112, 115);
|
||||
this.txtServiceCharge.Location = new System.Drawing.Point(112, 144);
|
||||
this.txtServiceCharge.Name = "txtServiceCharge";
|
||||
this.txtServiceCharge.Size = new System.Drawing.Size(189, 20);
|
||||
this.txtServiceCharge.TabIndex = 5;
|
||||
this.txtServiceCharge.TabIndex = 8;
|
||||
this.txtServiceCharge.Text = "0";
|
||||
//
|
||||
// btnAddProductGroup
|
||||
//
|
||||
this.btnAddProductGroup.Location = new System.Drawing.Point(307, 141);
|
||||
this.btnAddProductGroup.Location = new System.Drawing.Point(307, 170);
|
||||
this.btnAddProductGroup.Name = "btnAddProductGroup";
|
||||
this.btnAddProductGroup.Size = new System.Drawing.Size(96, 21);
|
||||
this.btnAddProductGroup.TabIndex = 9;
|
||||
this.btnAddProductGroup.TabIndex = 11;
|
||||
this.btnAddProductGroup.Text = "Add Group";
|
||||
//
|
||||
// cmbProductGroup
|
||||
//
|
||||
this.cmbProductGroup.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProductGroups, "ProductGroupID", true));
|
||||
this.cmbProductGroup.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProductGroups, "Name", true));
|
||||
this.cmbProductGroup.DataSource = this.bsProductGroups;
|
||||
this.cmbProductGroup.DisplayMember = "Name";
|
||||
this.cmbProductGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbProductGroup.Location = new System.Drawing.Point(112, 141);
|
||||
this.cmbProductGroup.Location = new System.Drawing.Point(112, 170);
|
||||
this.cmbProductGroup.Name = "cmbProductGroup";
|
||||
this.cmbProductGroup.Size = new System.Drawing.Size(189, 21);
|
||||
this.cmbProductGroup.TabIndex = 8;
|
||||
this.cmbProductGroup.TabIndex = 10;
|
||||
this.cmbProductGroup.ValueMember = "ProductGroupID";
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(328, 169);
|
||||
this.btnCancel.Location = new System.Drawing.Point(328, 198);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnCancel.TabIndex = 11;
|
||||
this.btnCancel.TabIndex = 13;
|
||||
this.btnCancel.Text = "&Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
this.btnOk.Location = new System.Drawing.Point(247, 169);
|
||||
this.btnOk.Location = new System.Drawing.Point(247, 198);
|
||||
this.btnOk.Name = "btnOk";
|
||||
this.btnOk.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnOk.TabIndex = 10;
|
||||
this.btnOk.TabIndex = 12;
|
||||
this.btnOk.Text = "&Ok";
|
||||
this.btnOk.UseVisualStyleBackColor = true;
|
||||
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
|
||||
//
|
||||
// txtFullPrice
|
||||
//
|
||||
this.txtFullPrice.AccessibleName = "";
|
||||
this.txtFullPrice.Location = new System.Drawing.Point(222, 38);
|
||||
this.txtFullPrice.Name = "txtFullPrice";
|
||||
this.txtFullPrice.Size = new System.Drawing.Size(79, 20);
|
||||
this.txtFullPrice.TabIndex = 19;
|
||||
this.txtFullPrice.Text = "0";
|
||||
//
|
||||
// cmbServiceTax
|
||||
//
|
||||
this.cmbServiceTax.DataSource = this.bsServiceTax;
|
||||
this.cmbServiceTax.DisplayMember = "Name";
|
||||
this.cmbServiceTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbServiceTax.Location = new System.Drawing.Point(112, 61);
|
||||
this.cmbServiceTax.Location = new System.Drawing.Point(112, 90);
|
||||
this.cmbServiceTax.Name = "cmbServiceTax";
|
||||
this.cmbServiceTax.Size = new System.Drawing.Size(189, 21);
|
||||
this.cmbServiceTax.TabIndex = 20;
|
||||
this.cmbServiceTax.TabIndex = 4;
|
||||
this.cmbServiceTax.ValueMember = "TaxID";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(42, 67);
|
||||
this.label6.Location = new System.Drawing.Point(42, 96);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(64, 13);
|
||||
this.label6.TabIndex = 21;
|
||||
this.label6.TabIndex = 17;
|
||||
this.label6.Text = "Service Tax";
|
||||
//
|
||||
// chkIsScTaxable
|
||||
//
|
||||
this.chkIsScTaxable.AutoSize = true;
|
||||
this.chkIsScTaxable.Location = new System.Drawing.Point(307, 118);
|
||||
this.chkIsScTaxable.Location = new System.Drawing.Point(307, 147);
|
||||
this.chkIsScTaxable.Name = "chkIsScTaxable";
|
||||
this.chkIsScTaxable.Size = new System.Drawing.Size(91, 17);
|
||||
this.chkIsScTaxable.TabIndex = 22;
|
||||
this.chkIsScTaxable.TabIndex = 9;
|
||||
this.chkIsScTaxable.Text = "Is Sc Taxable";
|
||||
this.chkIsScTaxable.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkIsNotAvailable
|
||||
//
|
||||
this.chkIsNotAvailable.AutoSize = true;
|
||||
this.chkIsNotAvailable.Location = new System.Drawing.Point(307, 93);
|
||||
this.chkIsNotAvailable.Location = new System.Drawing.Point(307, 122);
|
||||
this.chkIsNotAvailable.Name = "chkIsNotAvailable";
|
||||
this.chkIsNotAvailable.Size = new System.Drawing.Size(57, 17);
|
||||
this.chkIsNotAvailable.TabIndex = 23;
|
||||
this.chkIsNotAvailable.TabIndex = 7;
|
||||
this.chkIsNotAvailable.Text = "Is N/A";
|
||||
this.chkIsNotAvailable.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(78, 94);
|
||||
this.label1.Location = new System.Drawing.Point(78, 123);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(28, 13);
|
||||
this.label1.TabIndex = 24;
|
||||
this.label1.TabIndex = 18;
|
||||
this.label1.Text = "VAT";
|
||||
//
|
||||
// txtFullPrice
|
||||
//
|
||||
this.txtFullPrice.AccessibleName = "";
|
||||
this.txtFullPrice.Location = new System.Drawing.Point(112, 38);
|
||||
this.txtFullPrice.Name = "txtFullPrice";
|
||||
this.txtFullPrice.Size = new System.Drawing.Size(104, 20);
|
||||
this.txtFullPrice.TabIndex = 2;
|
||||
this.txtFullPrice.Text = "0";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(15, 67);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(91, 13);
|
||||
this.label3.TabIndex = 16;
|
||||
this.label3.Text = "Happy Hour Price";
|
||||
//
|
||||
// ProductForm
|
||||
//
|
||||
this.AcceptButton = this.btnOk;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(415, 282);
|
||||
this.ClientSize = new System.Drawing.Size(415, 285);
|
||||
this.Controls.Add(this.txtFullPrice);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.chkIsNotAvailable);
|
||||
this.Controls.Add(this.chkIsScTaxable);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.cmbServiceTax);
|
||||
this.Controls.Add(this.txtFullPrice);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnOk);
|
||||
this.Controls.Add(this.btnAddProductGroup);
|
||||
@ -278,7 +288,7 @@
|
||||
this.Controls.Add(this.txtServiceCharge);
|
||||
this.Controls.Add(this.Label7);
|
||||
this.Controls.Add(this.txtPrice);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.lblServiceCharge);
|
||||
this.Controls.Add(this.cmbVat);
|
||||
this.Controls.Add(this.txtUnits);
|
||||
this.Controls.Add(this.txtName);
|
||||
@ -304,7 +314,7 @@
|
||||
internal System.Windows.Forms.Label Label7;
|
||||
private System.Windows.Forms.BindingSource bsProductGroups;
|
||||
private System.Windows.Forms.BindingSource bsServiceTax;
|
||||
internal System.Windows.Forms.Label label5;
|
||||
internal System.Windows.Forms.Label lblServiceCharge;
|
||||
internal System.Windows.Forms.Label Label2;
|
||||
internal System.Windows.Forms.TextBox txtUnits;
|
||||
internal System.Windows.Forms.TextBox txtName;
|
||||
@ -316,12 +326,13 @@
|
||||
internal System.Windows.Forms.ComboBox cmbProductGroup;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnOk;
|
||||
internal System.Windows.Forms.TextBox txtFullPrice;
|
||||
internal System.Windows.Forms.ComboBox cmbServiceTax;
|
||||
internal System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.CheckBox chkIsScTaxable;
|
||||
private System.Windows.Forms.BindingSource bsVat;
|
||||
private System.Windows.Forms.CheckBox chkIsNotAvailable;
|
||||
internal System.Windows.Forms.Label label1;
|
||||
internal System.Windows.Forms.TextBox txtFullPrice;
|
||||
internal System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
@ -17,6 +18,9 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
private void Products_Load(object sender, EventArgs e)
|
||||
{
|
||||
FillCombos();
|
||||
using (var bis = new SettingBI())
|
||||
ShowServiceChargeControls(bis.Get(x => x.Name == "Service Charge Enabled").Details == "yes");
|
||||
|
||||
if (_productID.HasValue)
|
||||
{
|
||||
Product product;
|
||||
@ -40,6 +44,12 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowServiceChargeControls(bool enabled)
|
||||
{
|
||||
lblServiceCharge.Visible = enabled;
|
||||
txtServiceCharge.Visible = enabled;
|
||||
chkIsScTaxable.Visible = enabled;
|
||||
}
|
||||
private void FillCombos()
|
||||
{
|
||||
using (var bi = new ProductGroupBI())
|
||||
@ -59,68 +69,77 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
cmbProductGroup.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private Product IsFormValid()
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
var product = new Product();
|
||||
|
||||
if (_productID.HasValue)
|
||||
product.ProductID = _productID.Value;
|
||||
|
||||
if (string.IsNullOrEmpty(txtName.Text.Trim()))
|
||||
return null;
|
||||
{
|
||||
MessageBox.Show("Product name cannot be blank.");
|
||||
txtName.Focus();
|
||||
return;
|
||||
}
|
||||
product.Name = txtName.Text.Trim();
|
||||
product.Units = txtUnits.Text.Trim();
|
||||
|
||||
decimal price;
|
||||
if (string.IsNullOrEmpty(txtPrice.Text.Trim()))
|
||||
txtPrice.Text = "0";
|
||||
if (!Regex.IsMatch(txtPrice.Text, @"^\d*([.]\d{1,5})?$"))
|
||||
{
|
||||
price = 0;
|
||||
MessageBox.Show("Price is not valid, it must be a decimal >= 0");
|
||||
txtPrice.Focus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!decimal.TryParse(txtPrice.Text.Trim(), out price))
|
||||
return null;
|
||||
}
|
||||
if (price < 0)
|
||||
return null;
|
||||
product.Price = price;
|
||||
product.Price = decimal.Parse(txtPrice.Text.Trim());
|
||||
|
||||
if (string.IsNullOrEmpty(txtFullPrice.Text.Trim()))
|
||||
txtFullPrice.Text = "0";
|
||||
if (!Regex.IsMatch(txtFullPrice.Text, @"^\d*([.]\d{1,5})?$"))
|
||||
{
|
||||
price = 0;
|
||||
MessageBox.Show("Full Price is not valid, it must be a decimal >= 0");
|
||||
txtFullPrice.Focus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
product.FullPrice = decimal.Parse(txtFullPrice.Text.Trim());
|
||||
|
||||
if (product.FullPrice < product.Price)
|
||||
{
|
||||
if (!decimal.TryParse(txtFullPrice.Text.Trim(), out price))
|
||||
return null;
|
||||
MessageBox.Show("Full Price cannot be less than the actual price.");
|
||||
txtFullPrice.Focus();
|
||||
return;
|
||||
}
|
||||
if (price < 0 || price < product.Price)
|
||||
return null;
|
||||
product.FullPrice = price;
|
||||
|
||||
// Tax
|
||||
if (cmbVat.SelectedItem == null)
|
||||
return null;
|
||||
{
|
||||
MessageBox.Show("Please choose VAT");
|
||||
cmbVat.Focus();
|
||||
return;
|
||||
}
|
||||
product.Vat = (Tax)cmbVat.SelectedItem;
|
||||
|
||||
if (cmbServiceTax.SelectedItem == null)
|
||||
return null;
|
||||
{
|
||||
MessageBox.Show("Please choose Service Tax");
|
||||
cmbServiceTax.Focus();
|
||||
return;
|
||||
}
|
||||
product.ServiceTax = (Tax)cmbServiceTax.SelectedItem;
|
||||
|
||||
decimal serviceCharge;
|
||||
if (string.IsNullOrEmpty(txtServiceCharge.Text.Trim()))
|
||||
txtServiceCharge.Text = "0";
|
||||
if (!Regex.IsMatch(txtServiceCharge.Text, @"^0*([.]\d{1,5})?$"))
|
||||
{
|
||||
serviceCharge = 0;
|
||||
MessageBox.Show("Service Charge is not valid, it must be a decimal >= 0 and < 1");
|
||||
txtServiceCharge.Focus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!decimal.TryParse(txtServiceCharge.Text.Trim(), out serviceCharge))
|
||||
return null;
|
||||
}
|
||||
|
||||
if (serviceCharge < 0 || serviceCharge > 1)
|
||||
return null;
|
||||
product.ServiceCharge = serviceCharge;
|
||||
product.ServiceCharge = decimal.Parse(txtServiceCharge.Text.Trim());
|
||||
|
||||
product.IsScTaxable = chkIsScTaxable.Checked;
|
||||
product.IsActive = chkIsActive.Checked;
|
||||
@ -128,29 +147,23 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
//Group
|
||||
if (cmbProductGroup.SelectedItem == null)
|
||||
return null;
|
||||
product.ProductGroup = (ProductGroup)cmbProductGroup.SelectedItem;
|
||||
return product;
|
||||
}
|
||||
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
var product = IsFormValid();
|
||||
if (product != null)
|
||||
{
|
||||
using (var bi = new ProductBI())
|
||||
{
|
||||
if (_productID.HasValue)
|
||||
bi.Update(product);
|
||||
else
|
||||
bi.Insert(product);
|
||||
bi.SaveChanges();
|
||||
}
|
||||
MessageBox.Show("Update / Save Successful");
|
||||
this.Close();
|
||||
MessageBox.Show("Please choose Product Group");
|
||||
cmbProductGroup.Focus();
|
||||
return;
|
||||
}
|
||||
product.ProductGroup = (ProductGroup)cmbProductGroup.SelectedItem;
|
||||
|
||||
using (var bi = new ProductBI())
|
||||
{
|
||||
if (_productID.HasValue)
|
||||
bi.Update(product);
|
||||
else
|
||||
bi.Insert(product);
|
||||
bi.SaveChanges();
|
||||
}
|
||||
else
|
||||
MessageBox.Show("The form is not valid");
|
||||
MessageBox.Show("Update / Save Successful");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
|
@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.5485
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@ -19,7 +19,7 @@ namespace Tanshu.Accounts.PointOfSale.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
@ -57,7 +57,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnDiscount = new System.Windows.Forms.Button();
|
||||
this.btnModifier = new System.Windows.Forms.Button();
|
||||
this.btnWaiter = new System.Windows.Forms.Button();
|
||||
this.btnPrintKot = new System.Windows.Forms.Button();
|
||||
this.btnMoveTable = new System.Windows.Forms.Button();
|
||||
this.btnPrintBill = new System.Windows.Forms.Button();
|
||||
@ -67,7 +66,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.btnMore = new System.Windows.Forms.Button();
|
||||
this.btnMoveKot = new System.Windows.Forms.Button();
|
||||
this.btnSplitBill = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.lblServiceCharge = new System.Windows.Forms.Label();
|
||||
this.txtServiceCharge = new System.Windows.Forms.TextBox();
|
||||
this.txtTableID = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
@ -82,12 +81,10 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.txtBillID = new System.Windows.Forms.TextBox();
|
||||
this.txtKotID = new System.Windows.Forms.TextBox();
|
||||
this.btnCustomer = new System.Windows.Forms.Button();
|
||||
this.bsWaiter = new System.Windows.Forms.BindingSource(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
|
||||
this.pnlBilling.SuspendLayout();
|
||||
this.flpActions.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsWaiter)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label7
|
||||
@ -244,7 +241,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.pnlBilling.Controls.Add(this.flpMain);
|
||||
this.pnlBilling.Controls.Add(this.flpGroup);
|
||||
this.pnlBilling.Controls.Add(this.flpActions);
|
||||
this.pnlBilling.Controls.Add(this.label1);
|
||||
this.pnlBilling.Controls.Add(this.lblServiceCharge);
|
||||
this.pnlBilling.Controls.Add(this.txtServiceCharge);
|
||||
this.pnlBilling.Controls.Add(this.txtTableID);
|
||||
this.pnlBilling.Controls.Add(this.label11);
|
||||
@ -316,7 +313,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.flpActions.Controls.Add(this.btnDelete);
|
||||
this.flpActions.Controls.Add(this.btnDiscount);
|
||||
this.flpActions.Controls.Add(this.btnModifier);
|
||||
this.flpActions.Controls.Add(this.btnWaiter);
|
||||
this.flpActions.Controls.Add(this.btnPrintKot);
|
||||
this.flpActions.Controls.Add(this.btnMoveTable);
|
||||
this.flpActions.Controls.Add(this.btnPrintBill);
|
||||
@ -382,19 +378,9 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.btnModifier.UseVisualStyleBackColor = true;
|
||||
this.btnModifier.Click += new System.EventHandler(this.btnModifier_Click);
|
||||
//
|
||||
// btnWaiter
|
||||
//
|
||||
this.btnWaiter.Location = new System.Drawing.Point(408, 3);
|
||||
this.btnWaiter.Name = "btnWaiter";
|
||||
this.btnWaiter.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnWaiter.TabIndex = 150;
|
||||
this.btnWaiter.Text = "Select Waiter - F5";
|
||||
this.btnWaiter.UseVisualStyleBackColor = true;
|
||||
this.btnWaiter.Click += new System.EventHandler(this.btnWaiter_Click);
|
||||
//
|
||||
// btnPrintKot
|
||||
//
|
||||
this.btnPrintKot.Location = new System.Drawing.Point(489, 3);
|
||||
this.btnPrintKot.Location = new System.Drawing.Point(408, 3);
|
||||
this.btnPrintKot.Name = "btnPrintKot";
|
||||
this.btnPrintKot.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnPrintKot.TabIndex = 145;
|
||||
@ -404,7 +390,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnMoveTable
|
||||
//
|
||||
this.btnMoveTable.Location = new System.Drawing.Point(570, 3);
|
||||
this.btnMoveTable.Location = new System.Drawing.Point(489, 3);
|
||||
this.btnMoveTable.Name = "btnMoveTable";
|
||||
this.btnMoveTable.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMoveTable.TabIndex = 158;
|
||||
@ -414,7 +400,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnPrintBill
|
||||
//
|
||||
this.btnPrintBill.Location = new System.Drawing.Point(651, 3);
|
||||
this.btnPrintBill.Location = new System.Drawing.Point(570, 3);
|
||||
this.btnPrintBill.Name = "btnPrintBill";
|
||||
this.btnPrintBill.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnPrintBill.TabIndex = 144;
|
||||
@ -424,7 +410,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnClear
|
||||
//
|
||||
this.btnClear.Location = new System.Drawing.Point(732, 3);
|
||||
this.btnClear.Location = new System.Drawing.Point(651, 3);
|
||||
this.btnClear.Name = "btnClear";
|
||||
this.btnClear.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnClear.TabIndex = 148;
|
||||
@ -434,7 +420,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnVoid
|
||||
//
|
||||
this.btnVoid.Location = new System.Drawing.Point(813, 3);
|
||||
this.btnVoid.Location = new System.Drawing.Point(732, 3);
|
||||
this.btnVoid.Name = "btnVoid";
|
||||
this.btnVoid.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnVoid.TabIndex = 143;
|
||||
@ -444,7 +430,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnSettle
|
||||
//
|
||||
this.btnSettle.Location = new System.Drawing.Point(894, 3);
|
||||
this.btnSettle.Location = new System.Drawing.Point(813, 3);
|
||||
this.btnSettle.Name = "btnSettle";
|
||||
this.btnSettle.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnSettle.TabIndex = 155;
|
||||
@ -454,7 +440,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnMore
|
||||
//
|
||||
this.btnMore.Location = new System.Drawing.Point(3, 84);
|
||||
this.btnMore.Location = new System.Drawing.Point(894, 3);
|
||||
this.btnMore.Name = "btnMore";
|
||||
this.btnMore.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMore.TabIndex = 159;
|
||||
@ -464,7 +450,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnMoveKot
|
||||
//
|
||||
this.btnMoveKot.Location = new System.Drawing.Point(84, 84);
|
||||
this.btnMoveKot.Location = new System.Drawing.Point(3, 84);
|
||||
this.btnMoveKot.Name = "btnMoveKot";
|
||||
this.btnMoveKot.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnMoveKot.TabIndex = 160;
|
||||
@ -474,7 +460,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
//
|
||||
// btnSplitBill
|
||||
//
|
||||
this.btnSplitBill.Location = new System.Drawing.Point(165, 84);
|
||||
this.btnSplitBill.Location = new System.Drawing.Point(84, 84);
|
||||
this.btnSplitBill.Name = "btnSplitBill";
|
||||
this.btnSplitBill.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnSplitBill.TabIndex = 161;
|
||||
@ -482,16 +468,16 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.btnSplitBill.UseVisualStyleBackColor = true;
|
||||
this.btnSplitBill.Click += new System.EventHandler(this.btnSplitBill_Click);
|
||||
//
|
||||
// label1
|
||||
// lblServiceCharge
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(235, 511);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(21, 13);
|
||||
this.label1.TabIndex = 154;
|
||||
this.label1.Text = "SC";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
this.lblServiceCharge.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lblServiceCharge.AutoSize = true;
|
||||
this.lblServiceCharge.Location = new System.Drawing.Point(235, 511);
|
||||
this.lblServiceCharge.Name = "lblServiceCharge";
|
||||
this.lblServiceCharge.Size = new System.Drawing.Size(21, 13);
|
||||
this.lblServiceCharge.TabIndex = 154;
|
||||
this.lblServiceCharge.Text = "SC";
|
||||
this.lblServiceCharge.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// txtServiceCharge
|
||||
//
|
||||
@ -616,10 +602,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.btnCustomer.UseVisualStyleBackColor = true;
|
||||
this.btnCustomer.Click += new System.EventHandler(this.btnCustomer_Click);
|
||||
//
|
||||
// bsWaiter
|
||||
//
|
||||
this.bsWaiter.DataSource = typeof(Tanshu.Accounts.Entities.Waiter);
|
||||
//
|
||||
// SalesForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -630,8 +612,8 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "SalesForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "F2-Qty., F3-Discount, F4-Customer, F5-Waiter, F7-Product, F8-LoadBill, F9-Set Amo" +
|
||||
"unt, F11-Print Bill, F12-Print KOT, ESC-Cancel";
|
||||
this.Text = "F2-Qty., F3-Discount, F4-Customer, F7-Product, F8-LoadBill, F9-Set Amount, F11-Pr" +
|
||||
"int Bill, F12-Print KOT, ESC-Cancel";
|
||||
this.Load += new System.EventHandler(this.SalesForm_Load);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SalesForm_KeyDown);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).EndInit();
|
||||
@ -639,7 +621,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
this.pnlBilling.ResumeLayout(false);
|
||||
this.pnlBilling.PerformLayout();
|
||||
this.flpActions.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsWaiter)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -648,7 +629,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.BindingSource bindingSource;
|
||||
private System.Windows.Forms.BindingSource bsWaiter;
|
||||
internal System.Windows.Forms.Label label7;
|
||||
internal System.Windows.Forms.TextBox txtDiscount;
|
||||
internal System.Windows.Forms.Label Label12;
|
||||
@ -679,8 +659,7 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
private System.Windows.Forms.Button btnVoid;
|
||||
private System.Windows.Forms.Button btnRate;
|
||||
private System.Windows.Forms.Button btnClear;
|
||||
private System.Windows.Forms.Button btnWaiter;
|
||||
internal System.Windows.Forms.Label label1;
|
||||
internal System.Windows.Forms.Label lblServiceCharge;
|
||||
internal System.Windows.Forms.TextBox txtServiceCharge;
|
||||
private System.Windows.Forms.Button btnSettle;
|
||||
private System.Windows.Forms.FlowLayoutPanel flpActions;
|
||||
|
@ -31,11 +31,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
btnCustomer.Text = name;
|
||||
}
|
||||
|
||||
public void SetWaiterDisplay(string name)
|
||||
{
|
||||
btnWaiter.Text = string.Format("{0} - F5", name);
|
||||
}
|
||||
|
||||
public void ShowInfo(Voucher voucher)
|
||||
{
|
||||
if (voucher.VoucherID == Guid.Empty)
|
||||
@ -53,7 +48,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
btnCustomer.Text = voucher.Customer.Name;
|
||||
txtTableID.Text = voucher.Table.Name;
|
||||
txtPax.Text = voucher.Pax.ToString();
|
||||
btnWaiter.Text = string.Format("{0} - F5", voucher.Waiter.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +83,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
_billController.ShowCustomers(false);
|
||||
break;
|
||||
}
|
||||
case Keys.F5:
|
||||
{
|
||||
btnWaiter_Click(sender, new EventArgs());
|
||||
break;
|
||||
}
|
||||
case Keys.F7:
|
||||
{
|
||||
//using (var selectProduct = new SelectProduct(ProductBI.GetFilteredProducts, true))
|
||||
@ -157,6 +146,12 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
|
||||
private void SalesForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
using (var bis = new SettingBI())
|
||||
{
|
||||
var showSC = bis.Get(x => x.Name == "Service Charge Enabled").Details == "yes";
|
||||
txtServiceCharge.Visible = showSC;
|
||||
lblServiceCharge.Visible = showSC;
|
||||
}
|
||||
_billController.FormLoad();
|
||||
FormState = SaleFormState.Waiting;
|
||||
}
|
||||
@ -218,11 +213,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
}
|
||||
}
|
||||
|
||||
private void btnWaiter_Click(object sender, EventArgs e)
|
||||
{
|
||||
_billController.ShowWaiters(false);
|
||||
}
|
||||
|
||||
private void btnSettle_Click(object sender, EventArgs e)
|
||||
{
|
||||
_billController.SettleBill();
|
||||
@ -290,7 +280,6 @@ namespace Tanshu.Accounts.PointOfSale.Sales
|
||||
txtLastEditDate.Text = "";
|
||||
txtTableID.Text = "";
|
||||
txtPax.Text = "";
|
||||
btnWaiter.Text = "Waiter - F5";
|
||||
txtGrossTax.Text = "0.00";
|
||||
txtDiscount.Text = "0.00";
|
||||
txtServiceCharge.Text = "0.00";
|
||||
|
@ -123,9 +123,6 @@
|
||||
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsWaiter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>148, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>81</value>
|
||||
</metadata>
|
||||
|
@ -280,6 +280,12 @@
|
||||
<Compile Include="User Management\AssignRoleGroups.Designer.cs">
|
||||
<DependentUpon>AssignRoleGroups.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="User Management\UserListForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="User Management\UserListForm.Designer.cs">
|
||||
<DependentUpon>UserListForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="User Management\UserForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -415,6 +421,10 @@
|
||||
<DependentUpon>AssignRoleGroups.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="User Management\UserListForm.resx">
|
||||
<DependentUpon>UserListForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="User Management\UserForm.resx">
|
||||
<DependentUpon>UserForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -36,15 +36,17 @@
|
||||
this.btnDelete = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.txtRetype = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 13);
|
||||
this.label1.Location = new System.Drawing.Point(12, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.TabIndex = 7;
|
||||
this.label1.Text = "User Name";
|
||||
//
|
||||
// txtUsername
|
||||
@ -58,63 +60,83 @@
|
||||
//
|
||||
this.txtPassword.Location = new System.Drawing.Point(78, 38);
|
||||
this.txtPassword.Name = "txtPassword";
|
||||
this.txtPassword.PasswordChar = '/';
|
||||
this.txtPassword.Size = new System.Drawing.Size(188, 20);
|
||||
this.txtPassword.TabIndex = 1;
|
||||
this.txtPassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 39);
|
||||
this.label2.Location = new System.Drawing.Point(19, 38);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 13);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "Password";
|
||||
//
|
||||
// chkLocked
|
||||
//
|
||||
this.chkLocked.AutoSize = true;
|
||||
this.chkLocked.Location = new System.Drawing.Point(78, 65);
|
||||
this.chkLocked.Location = new System.Drawing.Point(78, 90);
|
||||
this.chkLocked.Name = "chkLocked";
|
||||
this.chkLocked.Size = new System.Drawing.Size(82, 17);
|
||||
this.chkLocked.TabIndex = 2;
|
||||
this.chkLocked.TabIndex = 3;
|
||||
this.chkLocked.Text = "Locked Out";
|
||||
this.chkLocked.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
this.btnDelete.Location = new System.Drawing.Point(96, 88);
|
||||
this.btnDelete.Location = new System.Drawing.Point(96, 113);
|
||||
this.btnDelete.Name = "btnDelete";
|
||||
this.btnDelete.Size = new System.Drawing.Size(78, 23);
|
||||
this.btnDelete.TabIndex = 9;
|
||||
this.btnDelete.TabIndex = 5;
|
||||
this.btnDelete.Text = "&Delete";
|
||||
this.btnDelete.UseVisualStyleBackColor = true;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(180, 88);
|
||||
this.btnCancel.Location = new System.Drawing.Point(180, 113);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(85, 23);
|
||||
this.btnCancel.TabIndex = 10;
|
||||
this.btnCancel.TabIndex = 6;
|
||||
this.btnCancel.Text = "&Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Location = new System.Drawing.Point(12, 88);
|
||||
this.btnSave.Location = new System.Drawing.Point(12, 113);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(78, 23);
|
||||
this.btnSave.TabIndex = 11;
|
||||
this.btnSave.TabIndex = 4;
|
||||
this.btnSave.Text = "&Save";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// txtRetype
|
||||
//
|
||||
this.txtRetype.Location = new System.Drawing.Point(78, 65);
|
||||
this.txtRetype.Name = "txtRetype";
|
||||
this.txtRetype.Size = new System.Drawing.Size(188, 20);
|
||||
this.txtRetype.TabIndex = 2;
|
||||
this.txtRetype.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(31, 65);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(41, 13);
|
||||
this.label3.TabIndex = 9;
|
||||
this.label3.Text = "Retype";
|
||||
//
|
||||
// UserForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(300, 136);
|
||||
this.ClientSize = new System.Drawing.Size(300, 148);
|
||||
this.Controls.Add(this.txtRetype);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnDelete);
|
||||
@ -126,8 +148,8 @@
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "UserForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "User Form";
|
||||
this.Load += new System.EventHandler(this.NewUser_Load);
|
||||
this.Text = "User";
|
||||
this.Load += new System.EventHandler(this.UserForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -143,5 +165,7 @@
|
||||
private System.Windows.Forms.Button btnDelete;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
private System.Windows.Forms.TextBox txtRetype;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
@ -31,60 +31,60 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
btnCancel_Click(sender, e);
|
||||
}
|
||||
|
||||
private void NewUser_Load(object sender, EventArgs e)
|
||||
private void UserForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_user == null)
|
||||
return;
|
||||
txtUsername.Text = _user.Name;
|
||||
txtPassword.Text = _user.Password;
|
||||
txtRetype.Text = _user.Password;
|
||||
chkLocked.Checked = _user.LockedOut;
|
||||
}
|
||||
|
||||
private bool Save()
|
||||
private void Save()
|
||||
{
|
||||
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 == Guid.Empty)
|
||||
using (var bi = new UserBI())
|
||||
{
|
||||
using (var bi = new UserBI())
|
||||
{
|
||||
if (_user == null)
|
||||
_user = new User();
|
||||
else
|
||||
_user = bi.Get(x => x.UserID == _user.UserID);
|
||||
|
||||
_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 == Guid.Empty)
|
||||
bi.Insert(_user);
|
||||
bi.SaveChanges();
|
||||
}
|
||||
else
|
||||
using (var bi = new UserBI())
|
||||
{
|
||||
else
|
||||
bi.Update(_user);
|
||||
bi.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
bi.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!ValidateValues())
|
||||
if (txtUsername.Text.Trim() == "")
|
||||
{
|
||||
MessageBox.Show("Missing Information: Please check the form.");
|
||||
MessageBox.Show("Username cannot be blank.");
|
||||
txtUsername.Focus();
|
||||
}
|
||||
else if (txtPassword.Text.Trim() != txtRetype.Text.Trim())
|
||||
{
|
||||
MessageBox.Show("Passwords do not match.");
|
||||
txtPassword.Focus();
|
||||
}
|
||||
else if (string.IsNullOrEmpty(txtPassword.Text.Trim()))
|
||||
{
|
||||
MessageBox.Show("Password cannot be empty.");
|
||||
txtPassword.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Save();
|
||||
btnCancel_Click(sender, e);
|
||||
}
|
||||
}
|
||||
private bool ValidateValues()
|
||||
{
|
||||
if (txtUsername.Text.Trim() == "")
|
||||
return false;
|
||||
if (txtPassword.Text.Trim() == "")
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
187
Tanshu.Accounts.PointOfSale/User Management/UserListForm.Designer.cs
generated
Normal file
187
Tanshu.Accounts.PointOfSale/User Management/UserListForm.Designer.cs
generated
Normal file
@ -0,0 +1,187 @@
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
partial class UserListForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.btnAdd = new System.Windows.Forms.Button();
|
||||
this.btnEdit = new System.Windows.Forms.Button();
|
||||
this.btnExit = new System.Windows.Forms.Button();
|
||||
this.dgvUsers = new System.Windows.Forms.DataGridView();
|
||||
this.bsList = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Password = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.MsrString = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.LockedOut = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.UserGroups = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvUsers)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsList)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnAdd.Location = new System.Drawing.Point(12, 255);
|
||||
this.btnAdd.Name = "btnAdd";
|
||||
this.btnAdd.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnAdd.TabIndex = 68;
|
||||
this.btnAdd.Text = "&Add";
|
||||
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
|
||||
//
|
||||
// btnEdit
|
||||
//
|
||||
this.btnEdit.AccessibleName = "Done";
|
||||
this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnEdit.Location = new System.Drawing.Point(93, 255);
|
||||
this.btnEdit.Name = "btnEdit";
|
||||
this.btnEdit.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnEdit.TabIndex = 62;
|
||||
this.btnEdit.Text = "&Edit";
|
||||
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.AccessibleName = "Done";
|
||||
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnExit.Location = new System.Drawing.Point(575, 255);
|
||||
this.btnExit.Name = "btnExit";
|
||||
this.btnExit.Size = new System.Drawing.Size(75, 75);
|
||||
this.btnExit.TabIndex = 61;
|
||||
this.btnExit.Text = "E&xit";
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// dgvUsers
|
||||
//
|
||||
this.dgvUsers.AllowUserToAddRows = false;
|
||||
this.dgvUsers.AllowUserToDeleteRows = false;
|
||||
this.dgvUsers.AllowUserToResizeRows = false;
|
||||
this.dgvUsers.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dgvUsers.AutoGenerateColumns = false;
|
||||
this.dgvUsers.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dgvUsers.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvUsers.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.nameDataGridViewTextBoxColumn,
|
||||
this.Password,
|
||||
this.MsrString,
|
||||
this.LockedOut,
|
||||
this.UserGroups});
|
||||
this.dgvUsers.DataSource = this.bsList;
|
||||
this.dgvUsers.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
|
||||
this.dgvUsers.Location = new System.Drawing.Point(12, 12);
|
||||
this.dgvUsers.MultiSelect = false;
|
||||
this.dgvUsers.Name = "dgvUsers";
|
||||
this.dgvUsers.ReadOnly = true;
|
||||
this.dgvUsers.RowHeadersVisible = false;
|
||||
this.dgvUsers.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||
this.dgvUsers.RowTemplate.Height = 24;
|
||||
this.dgvUsers.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgvUsers.Size = new System.Drawing.Size(638, 237);
|
||||
this.dgvUsers.TabIndex = 74;
|
||||
this.dgvUsers.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvUsers_CellFormatting);
|
||||
//
|
||||
// bsList
|
||||
//
|
||||
this.bsList.DataSource = typeof(Tanshu.Accounts.Entities.Auth.User);
|
||||
//
|
||||
// nameDataGridViewTextBoxColumn
|
||||
//
|
||||
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
|
||||
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
|
||||
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
|
||||
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
this.nameDataGridViewTextBoxColumn.Width = 60;
|
||||
//
|
||||
// unitsDataGridViewTextBoxColumn
|
||||
//
|
||||
this.Password.DataPropertyName = "Password";
|
||||
this.Password.HeaderText = "Password";
|
||||
this.Password.Name = "Password";
|
||||
this.Password.ReadOnly = true;
|
||||
this.Password.Width = 78;
|
||||
//
|
||||
// MsrString
|
||||
//
|
||||
this.MsrString.DataPropertyName = "MsrString";
|
||||
this.MsrString.HeaderText = "Msr";
|
||||
this.MsrString.Name = "MsrString";
|
||||
this.MsrString.ReadOnly = true;
|
||||
this.MsrString.Width = 30;
|
||||
//
|
||||
// LockedOut
|
||||
//
|
||||
this.LockedOut.DataPropertyName = "LockedOut";
|
||||
this.LockedOut.HeaderText = "Locked";
|
||||
this.LockedOut.Name = "LockedOut";
|
||||
this.LockedOut.ReadOnly = true;
|
||||
this.LockedOut.Width = 49;
|
||||
//
|
||||
// UserGroups
|
||||
//
|
||||
this.UserGroups.DataPropertyName = "UserGroups";
|
||||
this.UserGroups.HeaderText = "Groups";
|
||||
this.UserGroups.Name = "UserGroups";
|
||||
this.UserGroups.ReadOnly = true;
|
||||
this.UserGroups.Width = 66;
|
||||
//
|
||||
// UserListForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(662, 342);
|
||||
this.Controls.Add(this.dgvUsers);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
this.Controls.Add(this.btnEdit);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "UserListForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Users";
|
||||
this.Load += new System.EventHandler(this.UserListForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvUsers)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsList)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
internal System.Windows.Forms.Button btnAdd;
|
||||
internal System.Windows.Forms.Button btnEdit;
|
||||
internal System.Windows.Forms.Button btnExit;
|
||||
private System.Windows.Forms.DataGridView dgvUsers;
|
||||
private System.Windows.Forms.BindingSource bsList;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Password;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn MsrString;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn LockedOut;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn UserGroups;
|
||||
}
|
||||
}
|
91
Tanshu.Accounts.PointOfSale/User Management/UserListForm.cs
Normal file
91
Tanshu.Accounts.PointOfSale/User Management/UserListForm.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public partial class UserListForm : Form
|
||||
{
|
||||
private IList<User> _list;
|
||||
public UserListForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var frm = new UserForm(null))
|
||||
frm.ShowDialog();
|
||||
using (var bi = new UserBI())
|
||||
_list = bi.List();
|
||||
bsList.DataSource = _list;
|
||||
}
|
||||
|
||||
private void UserListForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
ShowGrid();
|
||||
}
|
||||
private void ShowGrid()
|
||||
{
|
||||
using (var bi = new UserBI())
|
||||
_list = bi.List();
|
||||
bsList.DataSource = _list;
|
||||
}
|
||||
|
||||
private void btnEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
var id = ((User)bsList.Current).UserID;
|
||||
using (var frm = new UserForm(id))
|
||||
frm.ShowDialog();
|
||||
using (var bi = new UserBI())
|
||||
_list = bi.List();
|
||||
bsList.DataSource = _list;
|
||||
}
|
||||
|
||||
private void btnExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void dgvUsers_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
var data = dgvUsers.Rows[e.RowIndex].DataBoundItem as User;
|
||||
if (data == null)
|
||||
return;
|
||||
if (e.ColumnIndex == dgvUsers.Columns["Password"].Index)
|
||||
{
|
||||
e.Value = "******";
|
||||
}
|
||||
|
||||
if (e.ColumnIndex == dgvUsers.Columns["MsrString"].Index)
|
||||
{
|
||||
e.Value = !string.IsNullOrEmpty(data.MsrString);
|
||||
}
|
||||
|
||||
if (e.ColumnIndex == dgvUsers.Columns["UserGroups"].Index)
|
||||
{
|
||||
e.Value = string.Join(", ", data.UserGroups.Select(x => x.Group.Name).ToArray());
|
||||
}
|
||||
|
||||
var tax = e.Value as Tax;
|
||||
if (tax != null)
|
||||
{
|
||||
e.Value = string.Format("{1:P} - {0}", tax.Name, tax.Rate); ;
|
||||
return;
|
||||
}
|
||||
var productGroup = e.Value as ProductGroup;
|
||||
if (productGroup != null)
|
||||
{
|
||||
e.Value = productGroup.Name;
|
||||
}
|
||||
}
|
||||
private void chkIsActive_CheckStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
ShowGrid();
|
||||
}
|
||||
}
|
||||
}
|
132
Tanshu.Accounts.PointOfSale/User Management/UserListForm.resx
Normal file
132
Tanshu.Accounts.PointOfSale/User Management/UserListForm.resx
Normal file
@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="MsrString.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="LockedOut.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="UserGroups.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="bsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
@ -18,12 +18,11 @@ namespace Tanshu.Accounts.Print
|
||||
|
||||
private static string DesignKot(Voucher voucher, Kot kot, IEnumerable<Inventory> billItems, int copyNumber)
|
||||
{
|
||||
var waiter = voucher.Waiter;
|
||||
var billText = "\n\r" + "KOT / BOT".Center42();
|
||||
billText += "\n\r" + string.Format("Copy No. {0}", copyNumber).Center42();
|
||||
billText += DrawLine;
|
||||
billText += string.Format("\n\rKOT ID : K-{0,-5}/S-{1,-5} {2:dd-MMM-yyyy HH:mm}", voucher.KotID, kot.Code, kot.Date);
|
||||
billText += string.Format("\n\rTable No.: {0} / {1}", voucher.Table.Name, waiter.Name);
|
||||
billText += string.Format("\n\rTable No.: {0}", voucher.Table.Name);
|
||||
billText += DrawLine;
|
||||
billText += "\n\r Qty. x Name ";
|
||||
billText += DrawLine;
|
||||
|
@ -103,7 +103,7 @@ namespace Tanshu.Accounts.Print
|
||||
billText += string.Format("\n\r{0}\n\r{1}", voucher.Customer.Phone, voucher.Customer.Address);
|
||||
billText += DrawLine;
|
||||
}
|
||||
billText += "\n\r" + "Cashier : " + voucher.User.Name + " / " + voucher.Waiter.Name;
|
||||
billText += "\n\r" + "Cashier : " + voucher.User.Name;
|
||||
using (var bis = new SettingBI())
|
||||
billText += "\n\r" + bis.Get(x => x.Name == "Footer").Details;
|
||||
return billText;
|
||||
|
@ -102,7 +102,6 @@ namespace Tanshu.Accounts.Repository
|
||||
var entities = new Type[] {
|
||||
typeof(VoucherMap),
|
||||
typeof(UserMap),
|
||||
typeof(WaiterMap),
|
||||
typeof(CustomerMap),
|
||||
typeof(UserGroupMap),
|
||||
typeof(KotMap),
|
||||
|
@ -91,7 +91,6 @@
|
||||
<Compile Include="VoucherBI.cs" />
|
||||
<Compile Include="VoucherDirtyInterceptor.cs" />
|
||||
<Compile Include="VoucherSettlementBI.cs" />
|
||||
<Compile Include="WaiterBI.cs" />
|
||||
<Compile Include="Session.cs" />
|
||||
<Compile Include="SetupStore.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
@ -82,7 +82,6 @@ namespace Tanshu.Accounts.Repository
|
||||
if (voucher == null)
|
||||
return voucher;
|
||||
NHibernateUtil.Initialize(voucher.Customer);
|
||||
NHibernateUtil.Initialize(voucher.Waiter);
|
||||
NHibernateUtil.Initialize(voucher.User);
|
||||
NHibernateUtil.Initialize(voucher.Table);
|
||||
foreach (var kot in voucher.Kots)
|
||||
@ -203,7 +202,7 @@ namespace Tanshu.Accounts.Repository
|
||||
var kot = _session.Get<Kot>(kotID);
|
||||
var oldVoucher = _session.Get<Voucher>(kot.Voucher.VoucherID);
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == tableID).SingleOrDefault();
|
||||
var newVoucher = new Voucher(Session.User, oldVoucher.Customer, table, oldVoucher.Waiter, false, false, "");
|
||||
var newVoucher = new Voucher(Session.User, oldVoucher.Customer, table, false, false, "");
|
||||
Insert(newVoucher);
|
||||
|
||||
oldVoucher.Kots.Remove(kot);
|
||||
|
@ -1,24 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using NHibernate;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using NHibernate.Criterion;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class WaiterBI : UnitOfWork<Waiter>
|
||||
{
|
||||
public IList<Waiter> List(Dictionary<string, string> filter)
|
||||
{
|
||||
return _session.QueryOver<Waiter>()
|
||||
.WhereRestrictionOn(x => x.Name).IsLike(string.Format("%{0}%", filter["Name"]))
|
||||
.List();
|
||||
}
|
||||
public static IList<Waiter> StaticList(Dictionary<string, string> filter)
|
||||
{
|
||||
using (var bi = new WaiterBI())
|
||||
{
|
||||
return bi.List(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user