Chore: Rename _billController to _controller as it is shorter
Removed: Unused SelectorEvent Helper Refactor: Removed references to SaleForm from BillController as it is not needed.
This commit is contained in:
@ -15,8 +15,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public readonly BillDict _bill;
|
||||
public Voucher _voucher;
|
||||
private Guid? _editVoucherID;
|
||||
private ISaleForm _saleForm;
|
||||
public Guid? _editVoucherID;
|
||||
|
||||
public BillController(Guid? editVoucherID)
|
||||
{
|
||||
@ -26,11 +25,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
_voucher = new Voucher(Session.User, bi.Get(x => x.CustomerID == Constants.CASH_CUSTOMER));
|
||||
}
|
||||
|
||||
public void InitGui(ISaleForm saleForm)
|
||||
{
|
||||
this._saleForm = saleForm;
|
||||
this._saleForm.SetUserName(Session.User.Name);
|
||||
}
|
||||
public void AddProduct(Product product)
|
||||
{
|
||||
var newKey = new BillItemKey(product.ProductID, Guid.Empty);
|
||||
@ -148,7 +142,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
using (var bi = new VoucherBI())
|
||||
{
|
||||
_voucher = bi.Get(x => x.VoucherID == voucherID);
|
||||
_bill.Clear();
|
||||
_bill.Load(_voucher);
|
||||
var newKotKey = new BillItemKey(Guid.Empty);
|
||||
var newKotItem = new BillItemValue();
|
||||
@ -184,7 +177,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
ClearBill();
|
||||
return true;
|
||||
}
|
||||
public void ClearBill()
|
||||
private void ClearBill()
|
||||
{
|
||||
using (var bi = new CustomerBI())
|
||||
_voucher = new Voucher(Session.User, bi.Get(x => x.CustomerID == Constants.CASH_CUSTOMER));
|
||||
@ -195,18 +188,15 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
public SaleFormState FormLoad()
|
||||
{
|
||||
ClearBill();
|
||||
if (_editVoucherID.HasValue)
|
||||
{
|
||||
FoodTable ft = new FoodTableBI().Get(x => x.VoucherID == _editVoucherID.Value);
|
||||
if (ft == null)
|
||||
{
|
||||
LoadBill(_editVoucherID.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_editVoucherID = null;
|
||||
LoadBill(ft.Name);
|
||||
}
|
||||
LoadBill(_editVoucherID.Value);
|
||||
return SaleFormState.Billing;
|
||||
}
|
||||
return SaleFormState.Waiting;
|
||||
@ -387,12 +377,7 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
Thermal.PrintKot(_voucher.VoucherID, saved.Value);
|
||||
|
||||
//Cleanup
|
||||
if (_editVoucherID.HasValue)
|
||||
_saleForm.CloseWindow();
|
||||
else
|
||||
{
|
||||
ClearBill();
|
||||
}
|
||||
ClearBill();
|
||||
return true;
|
||||
}
|
||||
public bool SaveAndPrintBill()
|
||||
@ -440,8 +425,6 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
UpdateVoucher(true, !_editVoucherID.HasValue);
|
||||
}
|
||||
Thermal.PrintBill(_voucher.VoucherID);
|
||||
if (_editVoucherID.HasValue)
|
||||
_saleForm.CloseWindow();
|
||||
ClearBill();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using System.Windows.Forms;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using Tanshu.Common;
|
||||
|
||||
namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
public interface ISaleForm
|
||||
{
|
||||
void CloseWindow();
|
||||
void SetUserName(string name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user