public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } TipoJuego otroJuego = obj as TipoJuego; return(this.Id == otroJuego.Id); }
private void DeleteFromDataBase(List <TipoJuego> juegosAEliminar) { ControladorJuego controlador = new ControladorJuego(); foreach (var d in db.Dias.Where(d => d.Dia == this.Numero)) { d.JuegoReference.Load(); TipoJuego juego = controlador.CrearJuegoEspecifico(d.Juego); if (juegosAEliminar.Any(j => j.Id == juego.Id)) { db.DeleteObject(d); } } db.SaveChanges(); }
private void MostrarControl(TipoJuego juego) { Point posicion = new Point(210, 12); switch (juego.Tipo) { case 1: this.juegoTipo2Control.Visible = false; this.juegoTipo1Control.Visible = true; this.juegoTipo1Control.Location = posicion; this.juegoTipo1Control.LoadData((JuegoTipo1)juego); break; case 2: this.juegoTipo1Control.Visible = false; this.juegoTipo2Control.Visible = true; this.juegoTipo2Control.Location = posicion; this.juegoTipo2Control.LoadData((JuegoTipo2)juego); break; } }
private void lista_juegos_SelectedIndexChanged(object sender, EventArgs e) { TipoJuego juego = (TipoJuego)this.lista_juegos.SelectedItem; this.MostrarControl(juego); }