protected void btnAddToContact_Click(object sender, EventArgs e) { //PostCondition:: Checks to see if the customer is in the list and if its not then adds the customer to the list bool isNew = true; if (Page.IsValid) { //get customer from session and selected item from ddl CustomerList clist = CustomerList.GetCustomerList(); if (this.getCustomer() != null) { //Loop through and checks if customer is already in contact list for (int i = 0; i < clist.Count; i++) { if (clist[i].CustomerID == this.getCustomer().CustomerID) { isNew = false; } } //if customer is not in list add to the list if (isNew) { clist.AddItem(this.getCustomer()); } } Response.Redirect("Contactlist.aspx"); } }
/// <summary> /// Handles the Click event of the btnAddContacts control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnAddContacts_Click(object sender, EventArgs e) { CustomerList custList = CustomerList.GetCustomers(); Customer cust = custList[this.selectedCustomer.CustomerId]; if (cust == null) { custList.AddItem(this.selectedCustomer); } }
protected void btnAddContact_Click(object sender, EventArgs e) { CustomerList contacts = CustomerList.GetCustomers(); Customer customer = contacts[getSelectedCustomer().name]; if (customer == null) { contacts.AddItem(getSelectedCustomer()); Response.Redirect("ContactList.aspx"); } else { lblError.Text = "This customer is already added to the contact list."; } }
protected void addButton_Click(object sender, EventArgs e) { CustomerList contacts = CustomerList.GetCustomers(); Customer customer = contacts[selectedCustomer.Name]; if (customer == null) { contacts.AddItem(selectedCustomer); Response.Redirect("ContactDisplay"); } else { ErrorMessage.Visible = true; } }
/// <summary> /// Handles the Click event of the btnAddContacts control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnAddContacts_Click(object sender, EventArgs e) { CustomerList custList = CustomerList.GetCustomers(); Customer cust = custList[this._selectedCustomer.CustomerId]; if (cust == null) { custList.AddItem(this._selectedCustomer); this.lblError.Text = ""; } else { this.lblError.Text = "Customer name already contained in contact list"; } }
protected void btnAdd_Click(object sender, EventArgs e) { CustomerList contacts = CustomerList.GetCustomers(); Customer customer = contacts[selectedCustomer.Name]; if (customer == null) { contacts.AddItem(selectedCustomer); Response.Redirect("ContactDisplay.aspx"); } else { lblErrorMessage.Text = "This customer is already in the contact list."; } }
protected void btnAdd_Click(object sender, EventArgs e) { selectedCustomer = this.GetselectedCustomer(); CustomerList contacts = CustomerList.GetCustomers(); string temp = GridView1.Rows[0].Cells[1].Text.ToString(); Customer customer = contacts[selectedCustomer.Name]; if (customer == null) { contacts.AddItem(selectedCustomer); Response.Redirect("ContactDisplay"); } else { lblErrorMessage.Text = "This customer is already in the contact list."; } }
protected void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { //get cart from session and selected item from cart CustomerList customers = CustomerList.GetCustomers(); Customer customer = customers[selectedCustomer.Name]; //if customer isn’t in contact list, add it; else display error message if (customer == null) { customers.AddItem(selectedCustomer); Response.Redirect("~/Administration/ContactDisplay"); } else { lblMessage.Text = selectedCustomer.Name + " has already been added to the Contact List."; } } }
protected void add_Click(object sender, EventArgs e) { if (Page.IsValid) { //get cart from session and selected item from cart CustomerList cust = CustomerList.GetCustomer(); CustomerItem custom = cust[customer.name]; if (custom == null) { cust.AddItem(customer); Response.Redirect("~/ContactDisplay", false); } // if(custom.Equals(customer.ToSt)) { Label1.Text = "Customer Already Exist"; } } // Response.Redirect("~/ContactDisplay.aspx", false); }