Beispiel #1
0
        private void btnClone_Click(object sender, EventArgs e)
        {
            //Check Copies Button - there and integer
            if (
                (Validator.IsPresent(txtCopies)) &&
                (Validator.IsInt32(txtCopies))
                )
            {
                int i;
                int.TryParse(txtCopies.Text, out i);
                do
                {
                    customers.Add((Customer)this.customer.Clone());
                    // customers.Add((Customer) this.customer.Clone());
                    i--;
                } while (i > 0);

                // Put it in the list 15-1
                //lstCustomers.DataSource = customers;

                //15-2
                Changed(customers);
                //lstCustomers.DataSource = customers.getCustomers();
            }
        }
Beispiel #2
0
 private CustomerList MakeCustomerList(Customer c, int count)
 {
     CustomerList customerList = new CustomerList();
     for (int i = 0; i < count; i++)
     {
         Customer cust = (Customer)c.Clone();
         customerList.Add(cust);
     }
     return customerList;
 }
Beispiel #3
0
        private CustomerList MakeCustomerList(Customer c, int count)
        {
            CustomerList customerList = new CustomerList();

            for (int i = 0; i < count; i++)
            {
                Customer cust = (Customer)c.Clone();
                customerList.Add(cust);
            }
            return(customerList);
        }
Beispiel #4
0
 private void btnClone_Click(object sender, EventArgs e)
 {
     if (Validator.IsPresent(txtCopies) & Validator.IsInt32(txtCopies))
     {
         for (int i = 0; i < Convert.ToInt32(txtCopies.Text); i++)
         {
             Customer c = (Customer)customer.Clone();
             customers.Add(c);
         }
         int x = 0;
         foreach (Customer c in customers)
         {
             lstCustomers.Items.Add(customers.ElementAt(x).GetDisplayText() + "\n");
             x++;
         }
     }
 }
Beispiel #5
0
        /// <summary>
        /// This method creats an object of Customerlist, checks the text box
        /// info through two validators and if they both, creats a clone of
        /// the Customer object a number of times depending on how many the
        /// user asks for, stores them the Customerlist object, then displays.
        /// </summary>
        /// <param name="sender"> see the System.Object api </param>
        /// <param name="e"> see the System.EventArgs api </param>
        private void btnClone_Click(object sender, EventArgs e)
        {
            CustomerList cloneList = new CustomerList();

            if (Validator.IsPresent(txtCopies) == true & Validator.IsInt32(txtCopies) == true)
            {
                for (int i = 0; i < Convert.ToInt32(txtCopies.Text); i++)
                {
                    Customer clone = (Customer)customer.Clone();
                    cloneList.Add(clone);
                }

                foreach (Customer cloned in cloneList)
                {
                    lstCustomers.Items.Add(cloned.GetDisplayText());
                }
            }

            // This code is for the 15-1 portion. To test,
            // comment out the above code and un-comment this code


            //customers = new List<Customer>();

            //if (Validator.IsPresent(txtCopies) == true & Validator.IsInt32(txtCopies) == true)
            //{
            //   for (int i = 0; i < Convert.ToInt32(txtCopies.Text); i++)
            //{
            //Customer test = (Customer)customer.Clone();
            //customers.Add(test);
            //}

            //foreach (Customer test in customers)
            //{
            //lstCustomers.Items.Add(test.GetDisplayText());

            //}
            //}
        }