Пример #1
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;
 }
Пример #2
0
        private List <Customer> MakeCustomerList(Customer c, int count)
        {
            List <Customer> customerList = new List <Customer>();

            for (int i = 0; i < count; i++)
            {
                Customer cust = (Customer)c.Clone();
                customerList.Add(cust);
            }
            return(customerList);
        }
Пример #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);
        }
Пример #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++;
         }
     }
 }
Пример #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());

            //}
            //}
        }