Changed to use Authenticate asp.net event instead of Authorize
[castle.git] / MonoRail / TestSite / views / binding / EmployeeControl.ascx.cs
blob71a0bcfbddd8e75d7c39a356f27595655005ce47
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace AspnetSample.views
17 using System;
19 public class EmployeeControl : System.Web.UI.UserControl
21 protected System.Web.UI.WebControls.TextBox txtID;
22 protected System.Web.UI.WebControls.TextBox txtName;
23 protected System.Web.UI.WebControls.TextBox txtCountry;
25 public event EventHandler<AddEmployeeEventArgs> AddEmployee;
26 public event EventHandler<DeleteEmployeeEventArgs> RemoveEmployee;
28 protected void btnAdd_Click(object sender, EventArgs e)
30 if (AddEmployee != null)
32 AddEmployee(this, new AddEmployeeEventArgs(txtName.Text, txtCountry.Text));
36 protected void btnRemove_Click(object sender, EventArgs e)
38 if (RemoveEmployee != null)
40 RemoveEmployee(this, new DeleteEmployeeEventArgs(txtID.Text));
44 public class AddEmployeeEventArgs : EventArgs
46 private string name;
47 private string country;
49 public AddEmployeeEventArgs(string name, string country)
51 this.name = name;
52 this.country = country;
55 public string Name
57 get { return name; }
60 public string Country
62 get { return country; }
66 public class DeleteEmployeeEventArgs : EventArgs
68 private string id;
70 public DeleteEmployeeEventArgs(string id)
72 this.id = id;
75 public string Id
77 get { return id; }