|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using SadasSof.Aspects;
using EnterpriseDemo;
using SadasSof.Aspects.Attributes;
namespace WebTestAspects
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.CheckBox ckbFilter;
protected System.Web.UI.WebControls.RadioButtonList rdDelegaton;
protected System.Web.UI.WebControls.Label Label1;
protected void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
ListItem lI1=new ListItem(BussinesLogicEmployees.Delegation.Madrid.ToString());
lI1.Selected=true;
rdDelegaton.Items.Add(lI1);
rdDelegaton.Items.Add(new ListItem(BussinesLogicEmployees.Delegation.Paris.ToString()) );
rdDelegaton.Items.Add(new ListItem(BussinesLogicEmployees.Delegation.London.ToString()) );
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
}
#endregion
protected void Button1_Click(object sender, System.EventArgs e)
{
IBussinesLogicEmployees iBLExternal=null;
if(ckbFilter.Checked)
iBLExternal=(IBussinesLogicEmployees)CodeInjection.Create(
new BussinesLogicEmployees(),
typeof(IBussinesLogicEmployeesExternalFilter));
else
iBLExternal=(IBussinesLogicEmployees)CodeInjection.Create(
new BussinesLogicEmployees(),
typeof(IBussinesLogicEmployeesAll));
Employees dsE=null;
switch(rdDelegaton.SelectedValue)
{
case "Madrid":
dsE = iBLExternal.GetEmployees(BussinesLogicEmployees.Delegation.Madrid);
break;
case "Paris":
dsE = iBLExternal.GetEmployees(BussinesLogicEmployees.Delegation.Paris);
break;
case "London":
dsE = iBLExternal.GetEmployees(BussinesLogicEmployees.Delegation.London);
break;
}
TextBox1.Text = CountingCalls.Calls("GetEmployees").ToString();
DataGrid1.DataSource=dsE;
DataGrid1.DataBind();
}
public interface IBussinesLogicEmployees
{
EnterpriseDemo.Employees GetEmployees(EnterpriseDemo.BussinesLogicEmployees.Delegation delegation);
}
public interface IBussinesLogicEmployeesAll:IBussinesLogicEmployees
{
[CountingCalls]
[LoggerExceptionToFile(@"C:\Inetpub\wwwroot\WebTestAspects\logExceptions.txt")]
new EnterpriseDemo.Employees GetEmployees(EnterpriseDemo.BussinesLogicEmployees.Delegation delegation);
}
public interface IBussinesLogicEmployeesExternalFilter:IBussinesLogicEmployees
{
[CountingCalls]
[ExternalFilter]
[LoggerToFile(@"C:\Inetpub\wwwroot\WebTestAspects\log.txt")]
[LoggerExceptionToFile(@"C:\Inetpub\wwwroot\WebTestAspects\logExceptions.txt")]
new EnterpriseDemo.Employees GetEmployees(EnterpriseDemo.BussinesLogicEmployees.Delegation delegation);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.