da929ad036
Breaking Change: Renamed Discontinued to IsActive and added NA field to products. Cleanup: Removed not used attributes Change: RoleConstants changed to simple string Feature: Table Create/Edit/Reorder and Modifier Create/Edit Form Feature: Bills now show the Tax name from the database and not a hack
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using Tanshu.Accounts.Entities;
|
|
using Tanshu.Accounts.Helpers;
|
|
using System.Diagnostics;
|
|
|
|
namespace Tanshu.Accounts.PointOfSale
|
|
{
|
|
public partial class MoveTableForm : Form
|
|
{
|
|
private readonly IList<FoodTable> _tableList;
|
|
private readonly bool _allowMerge;
|
|
public MoveTableForm(IList<FoodTable> tableList, bool allowMerge)
|
|
{
|
|
InitializeComponent();
|
|
_tableList = tableList;
|
|
Selection = null;
|
|
_allowMerge = allowMerge;
|
|
}
|
|
public FoodTable Selection { get; private set; }
|
|
|
|
private void MoveTableForm_Load(object sender, EventArgs e)
|
|
{
|
|
ControlFactory.GenerateTables(ref flpTables, new Point(75, 75), 0, _tableList, new ButtonClickDelegate(tableButton_Click), new ButtonClickDelegate(tablePage_Click));
|
|
}
|
|
private void tableButton_Click(object sender, EventArgs e)
|
|
{
|
|
var button = sender as Button;
|
|
if (button == null)
|
|
return;
|
|
var item = button.Tag as FoodTable;
|
|
if (!string.IsNullOrEmpty(item.Status) && !_allowMerge)
|
|
MessageBox.Show("Cannot move to a running table", "Cannot Move", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
else if (MessageBox.Show(string.Format("Move selected table to table {0}", item.Name), "Move", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
{
|
|
Selection = item;
|
|
this.Close();
|
|
}
|
|
}
|
|
private void tablePage_Click(object sender, EventArgs e)
|
|
{
|
|
var button = sender as Button;
|
|
if (button == null)
|
|
return;
|
|
var start = (int)button.Tag;
|
|
if (start < 0)
|
|
start = 0;
|
|
ControlFactory.GenerateTables(ref flpTables, new Point(75, 75), start, _tableList, new ButtonClickDelegate(tableButton_Click), new ButtonClickDelegate(tablePage_Click));
|
|
}
|
|
}
|
|
}
|