Moved to fluent. Added support for Modifiers. Fixtures to load intial test data
This commit is contained in:
@ -5,12 +5,112 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.Entities;
|
||||
using System.Collections;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public delegate void ButtonClickDelegate(object sender, EventArgs e);
|
||||
|
||||
public static class ControlFactory
|
||||
{
|
||||
public static void GenerateButtons(ref Panel panel, ref List<Button> buttonList, Rectangle clientArea, int x, int y, int border, List<ProductDisplaySmallBO> list, ButtonClickDelegate bcDelegate)
|
||||
public static void GenerateTables(ref FlowLayoutPanel panel, ref List<Button> buttonList, Point size, int start, IList<FoodTable> inList, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
IList<FoodTable> list = new List<FoodTable>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, ref buttonList, start, inList as IList, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new FoodTable() { FoodTableID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
list.Add(inList[i]);
|
||||
}
|
||||
if (stop < inList.Count)
|
||||
list.Add(new FoodTable() { FoodTableID = stop, Name = "Next" });
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
//var control = GetButton(string.Format("g{0}", i), string.Format("{0} {1}", item.ProductGroupID, item.Name), size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
buttonList.Add(control);
|
||||
}
|
||||
}
|
||||
public static void GenerateProducts(ref FlowLayoutPanel panel, ref List<Button> buttonList, Point size, int start, IList<Product> inList, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
IList<Product> list = new List<Product>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, ref buttonList, start, inList as IList, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new Product() { ProductID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
list.Add(inList[i]);
|
||||
}
|
||||
if (stop < inList.Count)
|
||||
list.Add(new Product() { ProductID = stop, Name = "Next" });
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("p{0}", i), string.Format("{0} ({1})", item.Name, item.Units), size.X, size.Y, item, bcDelegate);
|
||||
//var control = GetButton(string.Format("g{0}", i), string.Format("{0} {1}", item.ProductGroupID, item.Name), size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
buttonList.Add(control);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public static void GenerateGroups(ref FlowLayoutPanel panel, ref List<Button> buttonList, Point size, int start, IList<ProductGroup> inList, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
IList<ProductGroup> list = new List<ProductGroup>();
|
||||
int pageLength, stop;
|
||||
PageSetup(ref panel, ref buttonList, start, inList as IList, out pageLength, out stop);
|
||||
if (start != 0)
|
||||
list.Add(new ProductGroup() { ProductGroupID = start - pageLength, Name = "Previous" });
|
||||
for (int i = start; i < stop; i++)
|
||||
{
|
||||
list.Add(inList[i]);
|
||||
}
|
||||
if (stop < inList.Count)
|
||||
list.Add(new ProductGroup() { ProductGroupID = stop, Name = "Next" });
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetButton(string.Format("g{0}", i), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
//var control = GetButton(string.Format("g{0}", i), string.Format("{0} {1}", item.ProductGroupID, item.Name), size.X, size.Y, item, bcDelegate);
|
||||
panel.Controls.Add(control);
|
||||
buttonList.Add(control);
|
||||
}
|
||||
}
|
||||
public static void GenerateModifiers(ref FlowLayoutPanel panel, ref IList<CheckBox> controlList, IList<Modifier> selection, Point size, int count, IList<Modifier> list, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
if (controlList.Count != 0)
|
||||
{
|
||||
for (int i = controlList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
controlList[i].Dispose();
|
||||
}
|
||||
controlList = new List<CheckBox>();
|
||||
}
|
||||
if (count > list.Count)
|
||||
count = list.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var control = GetCheckbox(i.ToString(), item.Name, size.X, size.Y, item, bcDelegate);
|
||||
control.Checked = selection.Contains(item);
|
||||
panel.Controls.Add(control);
|
||||
controlList.Add(control);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PageSetup(ref FlowLayoutPanel panel, ref List<Button> buttonList, int start, IList inList, out int pageLength, out int stop)
|
||||
{
|
||||
if (buttonList.Count != 0)
|
||||
{
|
||||
@ -20,202 +120,47 @@ namespace Tanshu.Accounts.Helpers
|
||||
}
|
||||
buttonList = new List<Button>();
|
||||
}
|
||||
int width = (clientArea.Width - (border * (x - 1))) / x;
|
||||
int height = (clientArea.Height - (border * (y - 1))) / y;
|
||||
int left = 0, top = 0, count = 0;
|
||||
for (int j = 0; j < y; j++)
|
||||
{
|
||||
top = clientArea.Top + (j * (height + border));
|
||||
for (int i = 0; i < x; i++)
|
||||
{
|
||||
count++;
|
||||
if (list.Count < count)
|
||||
break;
|
||||
left = clientArea.Left + (i * (width + border));
|
||||
ProductDisplaySmallBO item = list[(j * x) + i];
|
||||
Button btn = GetButton(string.Format("{0}-{1}", i, j), item.Name, width, height, left, top, item.ProductID, bcDelegate);
|
||||
panel.Controls.Add(btn);
|
||||
buttonList.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
pageLength = (panel.Height / (3 + 75 + 3));
|
||||
pageLength *= (panel.Width / (3 + 75 + 3));
|
||||
pageLength -= 2;
|
||||
if (inList.Count <= pageLength)
|
||||
start = 0;
|
||||
if (start == 0)
|
||||
pageLength += 1;
|
||||
stop = start + pageLength;
|
||||
if (stop > inList.Count)
|
||||
stop = inList.Count;
|
||||
|
||||
public static void GenerateButtons(ref Panel panel, ref List<Button> buttonList, Rectangle clientArea, int x, int y, int border, int page, List<ProductGroupBO> list, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
if (buttonList.Count != 0)
|
||||
{
|
||||
for (int i = buttonList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
buttonList[i].Dispose();
|
||||
}
|
||||
buttonList = new List<Button>();
|
||||
}
|
||||
int width = (clientArea.Width - (border * (x - 1))) / x;
|
||||
int height = (clientArea.Height - (border * (y - 1))) / y;
|
||||
int left = 0, top = 0, count = 0;
|
||||
if (list.Count > x * y)
|
||||
{
|
||||
if (page != 0)
|
||||
list.RemoveRange(0, y * page);
|
||||
if (list.Count > y)
|
||||
list.RemoveRange(y, list.Count - y);
|
||||
//int pages = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(list.Count / (x * y)))) - 1;
|
||||
//if (page > 0)
|
||||
// startButton = true;
|
||||
//if (page != pages)
|
||||
// finishButton = true;
|
||||
//if (startButton)
|
||||
//{
|
||||
// list.RemoveRange(0, start);
|
||||
// list.Insert(0, new ProductGroupBO() { Name = "Previous", ProductGroupID = new Guid() });
|
||||
//}
|
||||
//if (finishButton)
|
||||
//{
|
||||
// list.RemoveRange((x * y) - 1, list.Count - (x * y) + 1);
|
||||
// list.Insert(x * y - 1, new ProductGroupBO() { Name = "Next", ProductGroupID = new Guid() });
|
||||
//}
|
||||
// the list is long
|
||||
|
||||
}
|
||||
int sJ = 0;
|
||||
int sI = 0;
|
||||
//Math.DivRem(start, x, out sI);
|
||||
//sJ = (start - sI) / y;
|
||||
//count = start - 1;
|
||||
for (int j = sJ; j < y; j++)
|
||||
{
|
||||
top = clientArea.Top + (j * (height + border));
|
||||
for (int i = sI; i < x; i++)
|
||||
{
|
||||
count++;
|
||||
if (list.Count < count)
|
||||
break;
|
||||
left = clientArea.Left + (i * (width + border));
|
||||
//ProductGroupBO item = list[(j * x) + i];
|
||||
ProductGroupBO item = list[count - 1];
|
||||
Button btn = GetButton(string.Format("{0}-{1}", i, j), item.Name, width, height, left, top, item.ProductGroupID, bcDelegate);
|
||||
panel.Controls.Add(btn);
|
||||
buttonList.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateModifiers(ref Panel panel, ref List<Button> buttonList, Rectangle clientArea, int x, int y, int border, List<ProductGroupModifierBO> list, ButtonClickDelegate bcDelegate)
|
||||
private static Button GetButton(string name, string text, int width, int height, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
if (buttonList.Count != 0)
|
||||
Button control = new Button()
|
||||
{
|
||||
for (int i = buttonList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
buttonList[i].Dispose();
|
||||
}
|
||||
buttonList = new List<Button>();
|
||||
}
|
||||
int width = (clientArea.Width - (border * (x - 1))) / x;
|
||||
int height = (clientArea.Height - (border * (y - 1))) / y;
|
||||
int left = 0, top = 0, count = 0;
|
||||
for (int j = 0; j < y; j++)
|
||||
{
|
||||
top = clientArea.Top + (j * (height + border));
|
||||
for (int i = 0; i < x; i++)
|
||||
{
|
||||
count++;
|
||||
if (list.Count < count)
|
||||
break;
|
||||
left = clientArea.Left + (i * (width + border));
|
||||
var item = list[count - 1];
|
||||
Button btn = GetButton(string.Format("{0}-{1}", i, j), item.ModifierID, width, height, left, top, item.ModifierID, bcDelegate);
|
||||
panel.Controls.Add(btn);
|
||||
buttonList.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateTables(ref Panel panel, ref List<Button> buttonList, Rectangle clientArea, int x, int y, int border, List<FoodTableBO> list, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
if (buttonList.Count != 0)
|
||||
{
|
||||
for (int i = buttonList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
buttonList[i].Dispose();
|
||||
}
|
||||
buttonList = new List<Button>();
|
||||
}
|
||||
int width = (clientArea.Width - (border * (x - 1))) / x;
|
||||
int height = (clientArea.Height - (border * (y - 1))) / y;
|
||||
int left = 0, top = 0, count = 0;
|
||||
for (int j = 0; j < y; j++)
|
||||
{
|
||||
top = clientArea.Top + (j * (height + border));
|
||||
for (int i = 0; i < x; i++)
|
||||
{
|
||||
count++;
|
||||
if (list.Count < count)
|
||||
break;
|
||||
left = clientArea.Left + (i * (width + border));
|
||||
FoodTableBO item = list[count - 1];
|
||||
Button btn = GetButton(string.Format("{0}-{1}", i, j), item.Name, width, height, left, top, item.TableID, bcDelegate);
|
||||
panel.Controls.Add(btn);
|
||||
buttonList.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static TextBox GetTextBox(string name, string text, int width, int height, int x, int y, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
TextBox textBox = CreateControl(ControlType.TextBox, name, text, width, height, x, y) as TextBox;
|
||||
textBox.Tag = tag;
|
||||
Name = name,
|
||||
Text = text,
|
||||
Width = width,
|
||||
Height = height,
|
||||
Tag = tag,
|
||||
};
|
||||
if (bcDelegate != null)
|
||||
textBox.Click += new EventHandler(bcDelegate);
|
||||
return textBox;
|
||||
control.Click += new EventHandler(bcDelegate);
|
||||
return control;
|
||||
}
|
||||
private static Button GetButton(string name, string text, int width, int height, int x, int y, object tag, ButtonClickDelegate bcDelegate)
|
||||
private static CheckBox GetCheckbox(string name, string text, int width, int height, object tag, ButtonClickDelegate bcDelegate)
|
||||
{
|
||||
Button button = CreateControl(ControlType.Button, name, text, width, height, x, y) as Button;
|
||||
button.Tag = tag;
|
||||
if (bcDelegate != null)
|
||||
button.Click += new EventHandler(bcDelegate);
|
||||
return button;
|
||||
}
|
||||
private static Control CreateControl(ControlType controlType, string name, string text, int width, int height, int x, int y)
|
||||
{
|
||||
switch (controlType)
|
||||
CheckBox control = new CheckBox()
|
||||
{
|
||||
case ControlType.TextBox:
|
||||
{
|
||||
TextBox textBox = new TextBox();
|
||||
textBox.Name = name;
|
||||
textBox.Text = text;
|
||||
textBox.Width = width;
|
||||
textBox.Height = height;
|
||||
textBox.Left = x;
|
||||
textBox.Top = y;
|
||||
return textBox;
|
||||
}
|
||||
case ControlType.Button:
|
||||
{
|
||||
Button button = new Button();
|
||||
button.Name = name;
|
||||
button.Text = text;
|
||||
button.Width = width;
|
||||
button.Height = height;
|
||||
button.Left = x;
|
||||
button.Top = y;
|
||||
return button;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
Name = name,
|
||||
Text = text,
|
||||
Width = width,
|
||||
Height = height,
|
||||
Tag = tag,
|
||||
Appearance = Appearance.Button,
|
||||
|
||||
};
|
||||
if (bcDelegate != null)
|
||||
control.Click += new EventHandler(bcDelegate);
|
||||
return control;
|
||||
}
|
||||
}
|
||||
public enum ControlType
|
||||
{
|
||||
TextBox = 1,
|
||||
Button = 2
|
||||
}
|
||||
public delegate void ButtonClickDelegate(object sender, EventArgs e);
|
||||
}
|
||||
@ -11,9 +11,9 @@ using Tanshu.Data;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectBill : Tanshu.Data.BaseSelector<PendingBillsBO>
|
||||
public class SelectBill : Tanshu.Data.BaseSelector<PendingBills>
|
||||
{
|
||||
public SelectBill(GetData<PendingBillsBO> getData, bool autoClose)
|
||||
public SelectBill(GetData<PendingBills> getData, bool autoClose)
|
||||
: base(getData, true, "List of Bills")
|
||||
{
|
||||
//grid.Columns["CustomerID"].Visible = false;
|
||||
@ -25,14 +25,14 @@ namespace Tanshu.Accounts.Helpers
|
||||
//data = CustomerProxy.GetCustomers(filter["Universal"].Split(' ')).ToList();
|
||||
//bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(PendingBillsBO item)
|
||||
protected override void UpdateDisplay(PendingBills item)
|
||||
{
|
||||
//if (item == null)
|
||||
// DisplayLabel = "";
|
||||
//else
|
||||
// DisplayLabel = string.Format("Chosen Customer is {0} with phone number {1}", item.Name, item.Phone);
|
||||
}
|
||||
protected override PendingBillsBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
protected override PendingBills HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
e.Handled = false;
|
||||
return null;
|
||||
|
||||
@ -7,15 +7,16 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Accounts.BI;
|
||||
using Tanshu.Accounts.Repository;
|
||||
using Tanshu.Data;
|
||||
using Tanshu.Accounts.Entities;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectCustomer : Tanshu.Data.BaseSelector<CustomerBO>
|
||||
public class SelectCustomer : Tanshu.Data.BaseSelector<Customer>
|
||||
{
|
||||
public event CustomerEventHandler customerEvent;
|
||||
public SelectCustomer(GetData<CustomerBO> getData, bool autoClose) : base(getData, true, "List of Products")
|
||||
public SelectCustomer(GetData<Customer> getData, bool autoClose) : base(getData, true, "List of Products")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Universal");
|
||||
@ -30,23 +31,23 @@ namespace Tanshu.Accounts.Helpers
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(CustomerBO item)
|
||||
protected override void UpdateDisplay(Customer item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Chosen Customer is {0} with phone number {1}", item.Name, item.Phone);
|
||||
}
|
||||
protected override CustomerBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
protected override Customer HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
CustomerBO customer = bindingSource.Current as CustomerBO;
|
||||
Customer customer = bindingSource.Current as Customer;
|
||||
|
||||
if (customerEvent == null)
|
||||
{
|
||||
e.Handled = false;
|
||||
return customer;
|
||||
}
|
||||
Guid? id = null;
|
||||
int? id = null;
|
||||
if ((customer != null) && (e.KeyCode == Keys.F2))
|
||||
id = customer.CustomerID;
|
||||
|
||||
@ -90,15 +91,15 @@ namespace Tanshu.Accounts.Helpers
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
public delegate CustomerBO CustomerEventHandler(object sender, CustomerEventArgs e);
|
||||
public delegate Customer CustomerEventHandler(object sender, CustomerEventArgs e);
|
||||
public class CustomerEventArgs : EventArgs
|
||||
{
|
||||
public CustomerEventArgs(Guid? customerID, string phone)
|
||||
public CustomerEventArgs(int? customerID, string phone)
|
||||
{
|
||||
CustomerID = customerID;
|
||||
Phone = phone;
|
||||
}
|
||||
public Guid? CustomerID
|
||||
public int? CustomerID
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
|
||||
@ -11,9 +11,9 @@ using Tanshu.Data;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectProduct : Tanshu.Data.BaseSelector<ProductDisplaySmallBO>
|
||||
public class SelectProduct : Tanshu.Data.BaseSelector<ProductDisplaySmall>
|
||||
{
|
||||
public SelectProduct(GetData<ProductDisplaySmallBO> getData, bool autoClose)
|
||||
public SelectProduct(GetData<ProductDisplaySmall> getData, bool autoClose)
|
||||
: base(getData, true, "List of Products")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
@ -29,14 +29,14 @@ namespace Tanshu.Accounts.Helpers
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
|
||||
protected override void UpdateDisplay(ProductDisplaySmallBO item)
|
||||
protected override void UpdateDisplay(ProductDisplaySmall item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Chosen Product {0} with rate Rs. {1}", item.Name, item.Price);
|
||||
}
|
||||
protected override ProductDisplaySmallBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
protected override ProductDisplaySmall HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
e.Handled = false;
|
||||
return null;
|
||||
|
||||
@ -8,15 +8,16 @@ using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
using Tanshu.Accounts.Contracts;
|
||||
using Tanshu.Data;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
|
||||
namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
public class SelectUser : Tanshu.Data.BaseSelector<UserBO>
|
||||
public class SelectUser : Tanshu.Data.BaseSelector<User>
|
||||
{
|
||||
public event UserEventHandler userEvent;
|
||||
public SelectUser(GetData<UserBO> getData, bool autoClose) : base (getData, true, "Select a User")
|
||||
public SelectUser(GetData<User> getData, bool autoClose) : base (getData, true, "Select a User")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
IList<string> filters = new List<string>();
|
||||
filters.Add("Name");
|
||||
SetFilterColumns(filters);
|
||||
grid.Columns["UserID"].Visible = false;
|
||||
@ -29,16 +30,16 @@ namespace Tanshu.Accounts.Helpers
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(UserBO item)
|
||||
protected override void UpdateDisplay(User item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("User Name: {0}", item.Name);
|
||||
}
|
||||
protected override UserBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
protected override User HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
UserBO user = bindingSource.Current as UserBO;
|
||||
User user = bindingSource.Current as User;
|
||||
|
||||
if (userEvent == null)
|
||||
{
|
||||
@ -57,7 +58,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
}
|
||||
|
||||
if (e.KeyCode == Keys.F1)
|
||||
user = new UserBO();
|
||||
user = new User();
|
||||
UserEventArgs userEventArgs = new UserEventArgs(user);
|
||||
user = userEvent(sender, userEventArgs);
|
||||
|
||||
@ -97,16 +98,16 @@ namespace Tanshu.Accounts.Helpers
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
public delegate UserBO UserEventHandler(object sender, UserEventArgs e);
|
||||
public delegate User UserEventHandler(object sender, UserEventArgs e);
|
||||
public class UserEventArgs : EventArgs
|
||||
{
|
||||
public UserEventArgs(UserBO user)
|
||||
public UserEventArgs(User user)
|
||||
{
|
||||
User = user;
|
||||
Handled = false;
|
||||
}
|
||||
|
||||
public UserBO User
|
||||
public User User
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
|
||||
@ -8,13 +8,14 @@ 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<WaiterBO>
|
||||
public class SelectWaiter : Tanshu.Data.BaseSelector<Waiter>
|
||||
{
|
||||
public event WaiterEventHandler waiterEvent;
|
||||
public SelectWaiter(GetData<WaiterBO> getData, bool autoClose) : base(getData, true, "Select a Waiter")
|
||||
public SelectWaiter(GetData<Waiter> getData, bool autoClose) : base(getData, true, "Select a Waiter")
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
filters.Add("Name");
|
||||
@ -29,16 +30,16 @@ namespace Tanshu.Accounts.Helpers
|
||||
data = getData(filter);
|
||||
bindingSource.DataSource = data;
|
||||
}
|
||||
protected override void UpdateDisplay(WaiterBO item)
|
||||
protected override void UpdateDisplay(Waiter item)
|
||||
{
|
||||
if (item == null)
|
||||
DisplayLabel = "";
|
||||
else
|
||||
DisplayLabel = string.Format("Waiter Name: {0}", item.Name);
|
||||
}
|
||||
protected override WaiterBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
protected override Waiter HandleKeydown(object sender, ExtendedKeyEventArgs e)
|
||||
{
|
||||
WaiterBO waiter = bindingSource.Current as WaiterBO;
|
||||
Waiter waiter = bindingSource.Current as Waiter;
|
||||
|
||||
if (waiterEvent == null)
|
||||
{
|
||||
@ -51,7 +52,7 @@ namespace Tanshu.Accounts.Helpers
|
||||
{
|
||||
case Keys.F1:
|
||||
{
|
||||
waiter = new WaiterBO { Name = base.filterColumns["Name"].Trim() };
|
||||
waiter = new Waiter { Name = base.filterColumns["Name"].Trim() };
|
||||
eventArgs = new WaiterEventArgs(waiter, 1);
|
||||
break;
|
||||
}
|
||||
@ -108,17 +109,17 @@ namespace Tanshu.Accounts.Helpers
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
public delegate WaiterBO WaiterEventHandler(object sender, WaiterEventArgs e);
|
||||
public delegate Waiter WaiterEventHandler(object sender, WaiterEventArgs e);
|
||||
public class WaiterEventArgs : EventArgs
|
||||
{
|
||||
public WaiterEventArgs(WaiterBO waiter, int action)
|
||||
public WaiterEventArgs(Waiter waiter, int action)
|
||||
{
|
||||
Waiter = waiter;
|
||||
Action = action;
|
||||
Handled = false;
|
||||
}
|
||||
|
||||
public WaiterBO Waiter
|
||||
public Waiter Waiter
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
|
||||
@ -94,9 +94,9 @@
|
||||
<Project>{59A6F8B8-12EE-4D8E-BEBB-61CB665A2C17}</Project>
|
||||
<Name>Tanshu.Accounts.Contracts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.BI\Tanshu.Accounts.BI.csproj">
|
||||
<Project>{0B43ECD4-3701-4CD3-82EC-617D7D590BBB}</Project>
|
||||
<Name>Tanshu.Accounts.BI</Name>
|
||||
<ProjectReference Include="..\Tanshu.Accounts.SqlDAO\Tanshu.Accounts.Repository.csproj">
|
||||
<Project>{B755D152-37C3-47D6-A721-3AD17A8EF316}</Project>
|
||||
<Name>Tanshu.Accounts.Repository</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
Reference in New Issue
Block a user