protected void Page_Load(object sender, EventArgs e) { if (Application["SharedCustomerList"] == null) { Application["SharedCustomerList"] = new AllCustomersList(); } thelist = (AllCustomersList)Application["SharedCustomerList"]; //UpdateCustomerList(); }
// When the button is clicked a new Customer will be created. protected void ButtonCreate_Click(object sender, EventArgs e) { // Creates a new object which is our new Customer. Customer c = new Customer(TextBoxFirstname.Text, TextBoxLastname.Text, Int32.Parse(TextBoxAge.Text), Int32.Parse(TextBoxZipcode.Text), TextBoxRegion.Text, TextBoxPassword.Text); thelist = (AllCustomersList)Application["SharedCustomerList"]; // Calls the AddCustomer method. thelist.AddCustomer(c); Application["SharedCustomerList"] = thelist; Application.UnLock(); // Calls the method UpdateCustomerList. UpdateCustomerList(); }