using System; using System.Collections; using Nexus.Core.Helpers; using WQD.Core.Controls; namespace Nexus.Web { /// /// Base class for find controls. /// ///

/// Typically, a FindControl will collect input /// to filter a list of entries displayed by a GridControl. ///

public class FindControl : ViewControl { /// /// Provide a field for the FindCommand property. /// private string _FindCommand; /// /// Provide the command that will populate the data-entry controls. /// public string FindCommand { get { return _FindCommand; } set { _FindCommand = value; } } /// /// Expose values input by client /// for use by another component. /// /// public virtual IDictionary Criteria { get { IViewHelper helper = Read(FindCommand); if (!helper.IsNominal) { Page_Alert = helper; } return helper.Criteria; } } /// /// Signal that input is ready to submit. /// /// public event EventHandler View_Find; /// /// Fire Click event when input is ready to submit. /// /// Source of event [find Button] /// Runtime parameters /// protected void find_Click(object sender, EventArgs e) { if (View_Find != null) { FindArgs a = new FindArgs(e, Criteria); View_Find(sender, a); } } /// /// Prepare controls for data entry. /// ///

/// Preparation includes obtaining lists from the /// databases. /// Any errors are reported /// through the standard page error handler. ///

/// public virtual bool Open() { IViewHelper helper = ExecuteBind(FindCommand); Bind(Profile.Criteria); bool okay = helper.IsNominal; if (!okay) Page_Alert = helper; return okay; } public virtual bool Open(IDictionary criteria) { IViewHelper helper = GetHelperFor(FindCommand); helper.Read(criteria, true); ExecuteBind(helper); bool okay = helper.IsNominal; if (!okay) Page_Alert = helper; return okay; } /// /// Handle the page Load event. /// /// Event source /// Runtime parameters /// private void Page_Load(object sender, EventArgs e) { // Put user code to initialize the page here } #region Web Form Designer generated code /// /// Initialize components. /// /// Runtime parameters /// protected override void OnInit(EventArgs e) { // // CODEGEN: This call is required by the ASP.NET Web Form Designer. // InitializeComponent(); base.OnInit(e); } /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// /// private void InitializeComponent() { this.Load += new EventHandler(this.Page_Load); } #endregion } }