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");
        }
    }
コード例 #2
0
    /// <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);
        }
    }
コード例 #3
0
    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.";
        }
    }
コード例 #4
0
    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;
        }
    }
コード例 #5
0
    /// <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";
        }
    }
コード例 #6
0
    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.";
        }
    }
コード例 #7
0
    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.";
        }
    }
コード例 #8
0
        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.";
                }
            }
        }
コード例 #9
0
    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);
    }