protected void btnSearch_Click(object sender, EventArgs e) { Jersey temp = new Jersey(); DataSet ds = temp.SearchJersey(txtSearch.Text); gvJersey.DataSource = ds; gvJersey.DataMember = ds.Tables[0].TableName; gvJersey.DataBind(); }
static void Main(string[] args) { // // OLD MACDONALD // Cow sleepy = new Cow("Sleepy"); sleepy.Sleep(); Cat cat = new Cat("Cosmic Creepers"); cat.Sleep(); Jersey jersey = new Jersey(); Cat felix = new Cat("Felix"); Console.WriteLine(sleepy.Eat()); Console.WriteLine(cat.Eat()); ISingable[] singables = new ISingable[] { new Cow("Henry"), new Chicken(), new Pig(), new Tractor(), new Cow("Earl"), sleepy, cat, jersey, felix }; ((FarmAnimal)singables[2]).Sleep(); foreach (ISingable singable in singables) { Console.WriteLine("Old MacDonald had a farm, ee ay ee ay oh!"); Console.WriteLine("And on his farm he had a " + singable.Name + ", ee ay ee ay oh!"); Console.WriteLine("With a " + singable.Sound + " " + singable.Sound + " here"); Console.WriteLine("And a " + singable.Sound + " " + singable.Sound + " there"); Console.WriteLine("Here a " + singable.Sound + " there a " + singable.Sound + " everywhere a " + singable.Sound + " " + singable.Sound); Console.WriteLine(); } ISellable[] sellables = new ISellable[] { new Cow("Henry"), new Pig(), new Egg() }; foreach (ISellable sellable in sellables) { Console.WriteLine("Step right up and get your " + sellable.Name); Console.WriteLine("Only $" + sellable.Price); } }
static void Main(string[] args) { // // OLD MACDONALD // Cow Bessie = new Cow(); Chicken RhodeIsland = new Chicken(); // George is only a FarmAnimal unless cast FarmAnimal George = new Sheep("George", "Baa"); Jersey Jeff = new Jersey(); Console.WriteLine(((Sheep)George).Shear()); RhodeIsland.LayEgg(); List <FarmAnimal> farmAnimals = new List <FarmAnimal>(); farmAnimals.Add(Bessie); farmAnimals.Add(RhodeIsland); farmAnimals.Add(George); farmAnimals.Add(Jeff); foreach (FarmAnimal critter in farmAnimals) { // checks to see if the current critter is of type Chicken // then cast critter to Chicken and LayEgg if (critter.GetType() == typeof(Chicken)) { ((Chicken)critter).LayEgg(); } Console.WriteLine("Old MacDonald had a farm, ee ay ee ay oh!"); Console.WriteLine("And on his farm he had a " + critter.Name + ", ee ay ee ay oh!"); Console.WriteLine("With a " + critter.Sound + " " + critter.Sound + " here"); Console.WriteLine("And a " + critter.Sound + " " + critter.Sound + " there"); Console.WriteLine("Here a " + critter.Sound + " there a " + critter.Sound + " everywhere a " + critter.Sound + " " + critter.Sound); Console.WriteLine(); } ///// Using Interfaces Console.WriteLine("Using Interfaces"); Tractor JD = new Tractor(); List <ISingable> singables = new List <ISingable>(); singables.Add(JD); singables.AddRange(farmAnimals); foreach (ISingable singable in singables) { Console.WriteLine("Old MacDonald had a farm, ee ay ee ay oh!"); Console.WriteLine("And on his farm he had a " + singable.Name + ", ee ay ee ay oh!"); Console.WriteLine("With a " + singable.MakeSoundTwice() + " here"); Console.WriteLine("And a " + singable.MakeSoundTwice() + " there"); Console.WriteLine("Here a " + singable.Sound + " there a " + singable.Sound + " everywhere a " + singable.Sound + " " + singable.Sound); Console.WriteLine(); } Apple apple = new Apple(); List <ISellable> sellables = new List <ISellable>(); sellables.Add(apple); sellables.Add(RhodeIsland); foreach (ISellable sellable in sellables) { Console.WriteLine(sellable); } string cowMinimum = Jeff.MinimumOffer(); }
public JerseyViewModel(Jersey jersey) : this(jersey.Name, jersey.Team.Name, jersey.Photos?.FirstOrDefault()?.Data) { }