<%	bool USING_ADAPTER = _executingGenerator.TemplateGroupToUse=="Adapter";
	string adapterTypeTwo = (USING_ADAPTER)
						  ? "2"
						  : string.Empty;
%>using System;
using System.Web.UI;
using SD.LLBLGen.Pro.ORMSupportClasses;

public abstract class CustomAction
{
	/// <summary>
	/// Action for data object (Entity, TypedList or TypedView)
	/// </summary>
	/// <param name="key">Lookup key</param>
	/// <param name="ctrActionSel">Control (eg. Button) to activate the action</param>
	protected CustomAction(string key, Control ctrActionSel)
	{
		Key = key;
		CustomActionControl = ctrActionSel;
	}


	/// <summary>
	/// Name of the Action
	/// </summary>
	public string Key { get; private set; }

	/// <summary>
	/// Control to invoque CustomAction (usually a Button)
	/// </summary>
	public Control CustomActionControl { get; set; }

	/// <summary>
	/// Is a inline (not multiselect) action
	/// </summary>
	public bool IsInline { get { return CustomActionControl == null; } }

	/// <summary>
	/// Request a DataSource Refetch after FinalizeAll
	/// </summary>
	public bool Refetch { get; protected set; }

	/// <summary>
	/// FinalizeAll finished with error
	/// </summary>
	public bool FinalizeAllOk { get; protected set; }

	/// <summary>
	/// Error message after FinalizeAll
	/// </summary>
	public string ErrorMsg { get; protected set; }

	/// <summary>
	/// Actions to execute on Page Controls (Edit or List)
	/// </summary>
	public Action<object> ActionOnControls { get; set; }

	/// <summary>
	/// Action execution method
	/// </summary>
	/// <param name="uow">Unit of work to modify</param>
	/// <param name="selectedObject">Entity, TypedListRow or TypedViewRow object</param>
	/// <returns>Error message</returns>
	abstract public string Execute(UnitOfWork<%=adapterTypeTwo%> uow, object selectedObject);

	/// <summary>
	/// Actions to do once finished each individual action
	/// </summary>
	/// <param name="allSuccessful">If all executions where successful</param>
	/// <returns>Something left to do (Refetch or ErrorMsg)</returns>
	virtual public bool FinalizeAll(bool allSuccessful) { return false; }
}
