using System;
using System.Collections;
using System.Web.UI.WebControls;
using Nexus.Core.Helpers;
using Nexus.Web;
using PhoneBook.Core;
namespace PhoneBook.Web.Controls
{
///
/// Present matching directory entries.
///
///
public class Lister : ViewControl
{
///
/// Populate the DataGrid with directory entries matching the filter settings.
///
/// Filter settings
///
public void Open(IDictionary criteria)
{
IViewHelper helper = ReadExecute(App.ENTRY_LIST, criteria);
bool ok = helper.IsNominal;
if (!ok) Page_Alert = helper;
else
{
IList result = helper.Outcome;
list.DataSource = result;
list.DataBind();
}
}
///
/// Provide reference to datagrid instance.
///
///
protected DataGrid list;
///
/// Handle page's load event.
///
/// Event source
/// Runtime parameters
///
private void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
Open(null);
}
#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
}
}