Fix: Products edit form vat and st were mixed in combobox.

Fix: Removed MinimumLevel and MaximumLevel from products.
This commit is contained in:
Amritanshu
2013-11-30 16:42:08 +05:30
parent c36240398f
commit 82f3b6b3e7
9 changed files with 166 additions and 370 deletions

View File

@ -13,12 +13,13 @@ namespace Tanshu.Accounts.Helpers
{
public class SelectProduct : Tanshu.Data.BaseSelector<ProductDisplaySmallBO>
{
public event ProductEventHandler productEvent;
public SelectProduct(GetData<ProductDisplaySmallBO> getData, bool autoClose)
: base(getData, true, "List of Products")
: base(getData, autoClose, "List of Products")
{
List<string> filters = new List<string>();
filters.Add("Name");
filters.Add("Type");
filters.Add("ProductGroup");
SetFilterColumns(filters);
grid.Columns["ProductID"].Visible = false;
}
@ -38,8 +39,24 @@ namespace Tanshu.Accounts.Helpers
}
protected override ProductDisplaySmallBO HandleKeydown(object sender, ExtendedKeyEventArgs e)
{
e.Handled = false;
return null;
var product = bindingSource.Current as ProductDisplaySmallBO;
if (productEvent == null)
{
e.Handled = false;
return null;
}
Guid? id = null;
if ((product != null) && (e.KeyCode == Keys.F2))
id = product.ProductID;
if ((e.KeyCode == Keys.F1) || (e.KeyCode == Keys.F2))
{
var updatedProduct = productEvent(sender, new ProductEventArgs(id));
if (updatedProduct != null)
product = new ProductDisplaySmallBO() { ProductID = updatedProduct.ProductID, Code = product.Code };
e.Handled = product != null;
}
return product;
}
#region Designer Code
/// <summary>
@ -74,4 +91,17 @@ namespace Tanshu.Accounts.Helpers
#endregion
#endregion
}
public delegate ProductBO ProductEventHandler(object sender, ProductEventArgs e);
public class ProductEventArgs : EventArgs
{
public ProductEventArgs(Guid? productID)
{
ProductID = productID;
}
public Guid? ProductID
{
get;
private set;
}
}
}