protected void BtnBuscar_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(TxtBuscar.Text)) { RptJugador.DataSource = LogicaJugador.FindByNombreOApellido(TxtBuscar.Text); RptJugador.DataBind(); } }
protected void CargarDDLPartidos() { var partidos = LogicaPartido.FindByJugadorCalificar(LogicaJugador.FindAll().FirstOrDefault().JugadorId); foreach (Partido p in partidos) { var jugador = p.JugadorDesafiado.Email == LogicaJugador.FindAll().FirstOrDefault().Email ? p.JugadorDesafiante : p.JugadorDesafiado; DDLPartidos.Items.Add(new ListItem(jugador.NombreCompleto() + " - " + p.Fecha, p.PartidoId.ToString())); } DDLPartidos.DataBind(); }
private void GuardarFoto(HttpPostedFile foto) { if (foto != null && foto.ContentLength > 0) { var ext = Path.GetExtension(foto.FileName); var path = "~\\Content\\Images"; var full = Path.Combine(path, "foto.jpg"); //cambiar nombre var tmp = Path.GetTempFileName() + "." + ext; try { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (File.Exists(full)) { File.Move(full, full.Replace(".jpg", DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".jpg")); } foto.SaveAs(tmp); foto.SaveAs(full); Stream stream = foto.InputStream; System.Drawing.Image image = System.Drawing.Image.FromStream(stream); var k = image.Height / image.Width; var height = image.Height > 500 ? 500 : image.Height; var width = image.Height > 500 ? 500 / k : image.Width;; var job = new ImageResizer.ImageJob(tmp, full, new ImageResizer.Instructions("width=" + width + ";height=" + height + ";format=jpg")); job.Build(); } catch (Exception ex) { } finally { Imagen imagen = new Imagen(); imagen.JugadorId = LogicaJugador.FindAll().FirstOrDefault().JugadorId; imagen.RutaImagen = full; LogicaImagen.Add(imagen); File.Delete(tmp); } } }
// Start is called before the first frame update void Start() { target = GameObject.Find("Jugador"); vidaJugador = target.GetComponent <Vida>(); if (vidaJugador == null) { throw new System.Exception("El objeto jugador no tiene componente vida"); } logicaJugador = target.GetComponent <LogicaJugador>(); if (logicaJugador == null) { throw new System.Exception("El objeto jugador no tiene componente LogicaJugador"); } agente = GetComponent <NavMeshAgent>(); vida = GetComponent <Vida>(); animator = GetComponent <Animator>(); collider = GetComponent <Collider>(); }
protected void BtnLogin_Click(object sender, EventArgs e) { try { if (Validar()) { Jugador J = LogicaJugador.Logueo(TxtEmail.Text, TxtContrasena.Text); if (J != null) { Session["Logueado"] = J; LblMensaje.Text = "Logueado"; } } } catch (Exception ex) { LblMensaje.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Jugador"] != null) { try { int IdJugador = int.Parse(Request.QueryString["Jugador"].ToString()); Jugador J = LogicaJugador.FindbyId(IdJugador); if (J != null) { UdpPerfilTop.DataSource = J; UdpPerfilTop.DataBind(); } } catch { } } }
protected void BtnRegistro_Click(object sender, EventArgs e) { try { if (Validar()) { Jugador J = new Jugador { Nombre = TxtNombre.Text, Apellido = TxtApellido.Text, Email = TxtEmail.Text, Password = TxtContrasena.Text, Sexo = RadioBSexo.SelectedValue }; LogicaJugador.Add(J); LabelMensaje.Text = "Registrado."; } } catch (Exception ex) { LabelMensaje.Text = ex.Message; } }
// Start is called before the first frame update void Start() { can.enabled = false; target = GameObject.Find("personaje"); vidaJugador = target.GetComponent <Vida>(); if (vidaJugador == null) { throw new System.Exception("El objeto Jugador no tiene componente Vida"); } logicaJugador = target.GetComponent <LogicaJugador>(); if (logicaJugador == null) { throw new System.Exception("El objeto Jugador no tiene componente LogicaJugador"); } agente = GetComponent <NavMeshAgent>(); currentstate = States.IDLE; anim = GetComponent <Animator>(); vida = GetComponent <Vida>(); animator = GetComponent <Animator>(); collider = GetComponent <Collider>(); }
protected void Page_Load(object sender, EventArgs e) { RepeaterFotos.DataSource = LogicaImagen.GetImagesByJugador(LogicaJugador.FindAll().FirstOrDefault().JugadorId); RepeaterFotos.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Session["Logueado"] = LogicaJugador.FindAll().FirstOrDefault(); }
void Start() { jugador = GetComponent <LogicaJugador>(); }
protected static void Main(string[] args) { List <DevolverUsuario> tDevolverUsuarios = new List <DevolverUsuario>(); string op; do { Console.Clear(); op = mostrarMenu(); switch (op) { case "1": try { Console.WriteLine("(E) entrenador, (J) jugador"); String tipo = Console.ReadLine(); if (tipo.Equals("E")) { Entrenador entrenador = new Entrenador(); Console.WriteLine("Into nombre:"); entrenador.Nombre = Console.ReadLine(); Console.WriteLine("Intro edad"); entrenador.EDAD = Convert.ToInt32(Console.ReadLine()); LogicaUsuario.ejecutarInsert(entrenador); Console.WriteLine("usuario Nº {0} insetado corectamente", entrenador.Nombre); } else if (tipo.Equals("J")) { Jugador jugador = new Jugador(); Console.WriteLine("Into nombre:"); jugador.Nombre = Console.ReadLine(); Console.WriteLine("Intro posición"); jugador.POS = Console.ReadLine(); LogicaUsuario.ejecutarInsert(jugador); Console.WriteLine("usuario Nº {0} insertado corectamente", jugador.Nombre); } Console.WriteLine("Pulsa tecla para continuar"); Console.ReadKey(); }catch { Console.WriteLine("ERROR"); } break; case "2": Usuario usuario = new Usuario(); do { Console.WriteLine("Intro id:"); usuario.ID = Convert.ToInt32(Console.ReadLine()); } while (!LogicaUsuario.existeUsuario(usuario)); LogicaUsuario.ejecutarDelete(usuario); Console.WriteLine(String.Format("usuario Nº {0} borrado corectamente", usuario.ID)); Console.WriteLine("Pulsa tecla para continuar"); Console.ReadKey(); break; case "3": Usuario usu = new Usuario(); do { Console.WriteLine("Intro id:"); usu.ID = Convert.ToInt32(Console.ReadLine()); } while (!LogicaUsuario.existeUsuario(usu)); Console.WriteLine("Intro nombre"); usu.Nombre = Console.ReadLine(); LogicaUsuario.ejecutarUpdate(usu); Console.WriteLine(String.Format("usuario Nº {0} actualizado corectamente", usu.ID)); Console.WriteLine("Pulsa tecla para continuar"); Console.ReadKey(); break; case "4": LogicaDevolverUsuario logicaDevolverUsuario = new LogicaDevolverUsuario(); logicaDevolverUsuario.ejecutarselect(); foreach (DevolverUsuario value in logicaDevolverUsuario.Usuarios) { if (value.Edad != 0) { LogicaEntrenador logicaEntrenador = new LogicaEntrenador(); logicaEntrenador.ejecutarSelect(); foreach (Entrenador value1 in logicaEntrenador.Entrenadores) { Console.WriteLine("----------------------------"); Console.WriteLine("-Entrenador nº{0}: -", value1.ID); Console.WriteLine("----------------------------"); Console.WriteLine("Nombre: {0}", value1.Nombre); Console.WriteLine("La Edad del Entrenador: {0}", value1.EDAD); } } else { LogicaJugador logicaJugador = new LogicaJugador(); logicaJugador.ejecutarSelect(); foreach (Jugador value2 in logicaJugador.Jugadores) { Console.WriteLine("----------------------------"); Console.WriteLine("-Jugador nº{0}: -", value2.ID); Console.WriteLine("----------------------------"); Console.WriteLine("Nombre: {0}", value2.Nombre); Console.WriteLine("La Posición del Jugador es: {0}", value2.POS); } } } Console.WriteLine("Pulsa tecla para continuar"); Console.ReadKey(); break; case "5": Console.WriteLine("Saliendo ..."); break; default: Console.WriteLine("Opción Incorrecta"); break; } } while(!op.Equals("5")); }
// Start is called before the first frame update void Start() { logicaJugador = GetComponent <LogicaJugador>(); balasRestantes = logicaJugador.getBalas(); destruidos = logicaJugador.getDestruidos();; }