示例#1
0
        public void AddHuskyInList(Husky husky)
        {
            HuskyList.Add(husky);

            if (HuskyAdded != null)
            {
                HuskyAdded(husky);
            }
            Console.WriteLine("Husky added!");
        }
示例#2
0
        private void addAnimalToList_Click(object sender, EventArgs e)
        {
            string   breed         = comboBoxBreedSelection.SelectedItem.ToString();
            DateTime arrivalDate   = ArrivalDateTime.Value;
            string   name          = nameTextBox.Text;
            string   c             = chipTextBox.Text;
            long     chip          = Convert.ToInt64(c);
            Boolean  adoptedStatus = false;
            string   tabby         = "Tabby";
            string   siamese       = "Siamese";
            string   husky         = "Husky";


            if (breed.Contains(tabby))
            {
                Console.WriteLine(" tabby  ");
                Tabby newTabby = new Tabby(name, chip, arrivalDate, adoptedStatus);
                m_model.AddTabbyInList(newTabby);
                this.Hide();
                Form1 aForm1 = new Form1(m_model);
                aForm1.Closed += (s, args) => this.Close();
                aForm1.Show();
            }
            else if (breed.Contains(siamese))
            {
                Console.WriteLine(" siamese  ");
                Siamese newSiamese = new Siamese(name, chip, arrivalDate, adoptedStatus);
                m_model.AddSiameseInList(newSiamese);
                this.Hide();
                Form1 aForm1 = new Form1(m_model);
                aForm1.Closed += (s, args) => this.Close();
                aForm1.Show();
            }
            else if (breed.Contains(husky))
            {
                Console.WriteLine(" husky  ");
                Husky newHusky = new Husky(name, chip, arrivalDate, adoptedStatus);
                m_model.AddHuskyInList(newHusky);
                this.Hide();
                Form1 aForm1 = new Form1(m_model);
                aForm1.Closed += (s, args) => this.Close();
                aForm1.Show();
            }
            else
            {
                Console.WriteLine(" chiwawa  ");
                Chiwawa newChiwawa = new Chiwawa(name, chip, arrivalDate, adoptedStatus);
                m_model.AddChiwawaInList(newChiwawa);
                this.Hide();
                Form1 aForm1 = new Form1(m_model);
                aForm1.Closed += (s, args) => this.Close();
                aForm1.Show();
            }
        }
示例#3
0
        public void defaultPets()
        {
            Tabby tabby = new Tabby("sunshine", 22222222222222222, new DateTime(2016, 2, 24), false);

            AddTabbyInList(tabby);
            Tabby tabby2 = new Tabby("Dolly", 22222222222222222, new DateTime(2016, 2, 24), false);

            AddTabbyInList(tabby2);

            Chiwawa chiwawa = new Chiwawa("tony", 33333333333333333, new DateTime(2016, 2, 24), false);

            AddChiwawaInList(chiwawa);

            Siamese siamese = new Siamese("felix", 44444444444444444, new DateTime(2016, 3, 11), false);

            AddSiameseInList(siamese);

            Husky husky = new Husky("fluffs", 55555555555555555, new DateTime(2016, 2, 24), false);

            AddHuskyInList(husky);
        }