narsil/Tanshu.Accounts.PointOfSale/Sales/MoveTableForm.cs
tanshu 69617949bd Important! : Need to update to new schema using SQL Scripts
Important! : This version will not work.  It is pre-alpha and saved in case of catastrophic failure
Refactor: Remove dependency on Fluent Nhibernate.
Refactor: All Primary keys are now Guids.
Refactor: Class Mappings changed from AutoMap to Explicit Mappings.
Breakage: All Cascading is now disabled and entities must be explicitly saved/updated/deleted
Breakage: Auto Commiting is now off and "SaveChanges()" needs to be called on all BIs.
Refactor: Changed the pattern where all relevant db code for an operation is basically in the same function.
Chore: Removed Advance and Payments options.
2014-10-12 15:11:45 +05:30

54 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Helpers;
namespace Tanshu.Accounts.PointOfSale
{
public partial class MoveTableForm : Form
{
private readonly IList<FoodTable> _source;
private readonly bool _allowMerge;
public MoveTableForm(IList<FoodTable> source, bool allowMerge)
{
InitializeComponent();
_source = source;
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, _source, 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, _source, new ButtonClickDelegate(tableButton_Click), new ButtonClickDelegate(tablePage_Click));
}
}
}