Chore: Added full name property to product
Chore: Removed GetButton Function in ControlFactory.
This commit is contained in:
@ -24,6 +24,13 @@ namespace Tanshu.Accounts.Entities
|
|||||||
public virtual decimal Quantity { get; set; }
|
public virtual decimal Quantity { get; set; }
|
||||||
public virtual IList<Inventory> Inventories { get; set; }
|
public virtual IList<Inventory> Inventories { get; set; }
|
||||||
|
|
||||||
|
public virtual string FullName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Units == string.Empty ? Name : string.Format("{0} ({1})", Name, Units);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class ProductMap : ClassMapping<Product>
|
public class ProductMap : ClassMapping<Product>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,13 +34,29 @@ namespace Tanshu.Accounts.Helpers
|
|||||||
if (item.FoodTableID == Guid.Empty)
|
if (item.FoodTableID == Guid.Empty)
|
||||||
{
|
{
|
||||||
var pageLocation = item.Name == "Previous" ? start - pageLength : stop;
|
var pageLocation = item.Name == "Previous" ? start - pageLength : stop;
|
||||||
control = GetButton(string.Format("p{0}", i), item.Name, size, pageLocation, pageDelegate);
|
control = new Button()
|
||||||
|
{
|
||||||
|
Name = string.Format("p{0}", i),
|
||||||
|
Text = item.Name,
|
||||||
|
Width = size.X,
|
||||||
|
Height = size.Y,
|
||||||
|
Tag = pageLocation,
|
||||||
|
};
|
||||||
|
control.Click += new EventHandler(pageDelegate);
|
||||||
status = "paging";
|
status = "paging";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = item.Status;
|
status = item.Status;
|
||||||
control = GetButton(string.Format("g{0}", i), item.Name, size, item, bcDelegate);
|
control = new Button()
|
||||||
|
{
|
||||||
|
Name = string.Format("g{0}", i),
|
||||||
|
Text = item.Name,
|
||||||
|
Width = size.X,
|
||||||
|
Height = size.Y,
|
||||||
|
Tag = item,
|
||||||
|
};
|
||||||
|
control.Click += new EventHandler(bcDelegate);
|
||||||
}
|
}
|
||||||
if (status == "printed")
|
if (status == "printed")
|
||||||
control.BackColor = Color.Green;
|
control.BackColor = Color.Green;
|
||||||
@ -70,11 +86,27 @@ namespace Tanshu.Accounts.Helpers
|
|||||||
if (item.ProductID == Guid.Empty)
|
if (item.ProductID == Guid.Empty)
|
||||||
{
|
{
|
||||||
var pageLocation = item.Name == "Previous" ? start - pageLength : stop;
|
var pageLocation = item.Name == "Previous" ? start - pageLength : stop;
|
||||||
control = GetButton(string.Format("p{0}", i), item.Name, size, pageLocation, pageDelegate);
|
control = new Button()
|
||||||
|
{
|
||||||
|
Name = string.Format("p{0}", i),
|
||||||
|
Text = item.Name,
|
||||||
|
Width = size.X,
|
||||||
|
Height = size.Y,
|
||||||
|
Tag = pageLocation,
|
||||||
|
};
|
||||||
|
control.Click += new EventHandler(pageDelegate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
control = GetButton(string.Format("p{0}", i), item.Units == string.Empty ? item.Name : string.Format("{0} ({1})", item.Name, item.Units), size, item, bcDelegate);
|
control = new Button()
|
||||||
|
{
|
||||||
|
Name = string.Format("p{0}", i),
|
||||||
|
Text = item.FullName,
|
||||||
|
Width = size.X,
|
||||||
|
Height = size.Y,
|
||||||
|
Tag = item,
|
||||||
|
};
|
||||||
|
control.Click += new EventHandler(bcDelegate);
|
||||||
if (item.Price == 0)
|
if (item.Price == 0)
|
||||||
control.BackColor = Color.Yellow;
|
control.BackColor = Color.Yellow;
|
||||||
if (item.IsNotAvailable)
|
if (item.IsNotAvailable)
|
||||||
@ -116,11 +148,27 @@ namespace Tanshu.Accounts.Helpers
|
|||||||
if (item.ProductGroupID == Guid.Empty)
|
if (item.ProductGroupID == Guid.Empty)
|
||||||
{
|
{
|
||||||
var pageLocation = item.Name == "Previous" ? start - pageLength : stop;
|
var pageLocation = item.Name == "Previous" ? start - pageLength : stop;
|
||||||
control = GetButton(string.Format("p{0}", i), item.Name, size, pageLocation, pageDelegate);
|
control = new Button()
|
||||||
|
{
|
||||||
|
Name = string.Format("p{0}", i),
|
||||||
|
Text = item.Name,
|
||||||
|
Width = size.X,
|
||||||
|
Height = size.Y,
|
||||||
|
Tag = pageLocation,
|
||||||
|
};
|
||||||
|
control.Click += new EventHandler(pageDelegate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
control = GetButton(string.Format("g{0}", i), item.Name, size, item, bcDelegate);
|
control = new Button()
|
||||||
|
{
|
||||||
|
Name = string.Format("g{0}", i),
|
||||||
|
Text = item.Name,
|
||||||
|
Width = size.X,
|
||||||
|
Height = size.Y,
|
||||||
|
Tag = item,
|
||||||
|
};
|
||||||
|
control.Click += new EventHandler(bcDelegate);
|
||||||
}
|
}
|
||||||
panel.Controls.Add(control);
|
panel.Controls.Add(control);
|
||||||
}
|
}
|
||||||
@ -169,20 +217,6 @@ namespace Tanshu.Accounts.Helpers
|
|||||||
stop = inList.Count;
|
stop = inList.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static Button GetButton(string name, string text, Point size, object tag, ButtonClickDelegate bcDelegate)
|
|
||||||
{
|
|
||||||
var control = new Button()
|
|
||||||
{
|
|
||||||
Name = name,
|
|
||||||
Text = text,
|
|
||||||
Width = size.X,
|
|
||||||
Height = size.Y,
|
|
||||||
Tag = tag,
|
|
||||||
};
|
|
||||||
if (bcDelegate != null)
|
|
||||||
control.Click += new EventHandler(bcDelegate);
|
|
||||||
return control;
|
|
||||||
}
|
|
||||||
private static UnselectableCheckbox GetUnselectableCheckbox(string name, string text, Point size, object tag, ButtonClickDelegate bcDelegate)
|
private static UnselectableCheckbox GetUnselectableCheckbox(string name, string text, Point size, object tag, ButtonClickDelegate bcDelegate)
|
||||||
{
|
{
|
||||||
var control = new UnselectableCheckbox()
|
var control = new UnselectableCheckbox()
|
||||||
|
|||||||
Reference in New Issue
Block a user