Exemplo n.º 1
0
        private void CusList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string FirstName = (string)CusList.Rows[e.RowIndex].Cells[0].Value;

            foreach (Customer cus in CustomerArray)
            {
                if (cus.FirstName == FirstName)
                {
                    ShowDetails(cus);
                    break;
                }
            }
            CusDetailPanel.Show();
            CusNewPanel.Hide();
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            CusListPanel.Dock   = DockStyle.Fill;
            CusDetailPanel.Dock = DockStyle.Right;
            CusNewPanel.Hide();

            Customer cus = new Customer("Ian", "Na", new DateTime(2000, 1, 2));
            Cat      cat = new Cat(1, "NaCho", "White", "Male");

            cus.Adopt(cat);
            Cat cat2 = new Cat(3, "Ruby", "Brown", "female");

            cus.Adopt(cat2);

            Dog dog = new Dog(2, "Happy", "White", "Male", DogBreed.Jindo);

            cus.Adopt(dog);

            Customers.Add(cus);
            CusList.Rows.Add(cus.FirstName, cus.Age, cus.IsQualified);
        }