Item Modifier added

This commit is contained in:
unknown
2011-01-22 18:08:30 +05:30
parent 3ea5fc75ab
commit 98e1e1df30
42 changed files with 674 additions and 284 deletions

View File

@ -40,7 +40,7 @@ namespace Tanshu.Accounts.Helpers
}
}
public static void GenerateButtons(ref Panel panel, ref List<Button> buttonList, Rectangle clientArea, int x, int y, int border, int page, List<ProductTypeBO> list, ButtonClickDelegate bcDelegate)
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)
{
@ -67,12 +67,12 @@ namespace Tanshu.Accounts.Helpers
//if (startButton)
//{
// list.RemoveRange(0, start);
// list.Insert(0, new ProductTypeBO() { Name = "Previous", ProductTypeID = new Guid() });
// 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 ProductTypeBO() { Name = "Next", ProductTypeID = new Guid() });
// list.Insert(x * y - 1, new ProductGroupBO() { Name = "Next", ProductGroupID = new Guid() });
//}
// the list is long
@ -91,14 +91,45 @@ namespace Tanshu.Accounts.Helpers
if (list.Count < count)
break;
left = clientArea.Left + (i * (width + border));
//ProductTypeBO item = list[(j * x) + i];
ProductTypeBO item = list[count - 1];
Button btn = GetButton(string.Format("{0}-{1}", i, j), item.Name, width, height, left, top, item.ProductTypeID, bcDelegate);
//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)
{
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));
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)
@ -128,6 +159,11 @@ namespace Tanshu.Accounts.Helpers
}
}
}
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;