Пример #1
0
        private void volver_Click(object sender, EventArgs e)
        {
            VentanaInicio v1 = new VentanaInicio(); //Crear ventana

            this.Hide();                            //Ocultar ventana actual
            v1.Show();                              // Mostrar ventana
        }
Пример #2
0
        private void Regresar_Click(object sender, EventArgs e)
        {
            this.Hide();                            //Ocultar ventana actual
            VentanaInicio v4 = new VentanaInicio(); //Crear ventana

            v4.Show();                              // Mostrar ventana
        }
Пример #3
0
        private void guardar_Click(object sender, EventArgs e)
        {
            if (Username.Text == "") //Validar
            {
                MessageBox.Show("Debe ingresar un usuario válido");
            }
            else
            {
                //--------------------------------- VALIDACIONES DE ESCRITURA EN CAMPOS ---------------------------------
                int a = 0;
                while (a == 0)
                {
                    //------------- VALIDACIONES DE COMILLAS -------------
                    string p = "'";
                    int    validación_comilla = 0;
                    foreach (char c in Username.Text)
                    {
                        if (c == p[0])//Validar
                        {
                            validación_comilla++;
                        }
                    }
                    foreach (char c in txtUbicacion.Text)
                    {
                        if (c == p[0])//Validar
                        {
                            validación_comilla++;
                        }
                    }
                    if (validación_comilla > 0)                                                //Validar
                    {
                        MessageBox.Show("¡Error! Los campos no deben tener comillas simples"); //Mensaje
                        break;
                    }


                    //------------- REGISTRO EN LA BASE DE DATOS -------------
                    dt.Rows.Add(txtUbicacion.Text, txtLatitud.Text, txtLongitud.Text);
                    cn.Registrar_GMap(Username.Text, txtUbicacion.Text, txtLatitud.Text, txtLongitud.Text); //Registrar

                    MessageBox.Show("Se realizó el registro");                                              //Mensaje

                    this.Hide();                                                                            //Ocultar ventana actual
                    VentanaInicio v2 = new VentanaInicio();                                                 //Crear ventana
                    v2.Show();                                                                              // Mostrar ventana

                    a++;
                }
            }
        }
Пример #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     try  //Intentar realizar lo siguiente
     {
         validar_foto++;
         OpenFileDialog fotografia = new OpenFileDialog();    // Abrir para seleccionar fotografía
         DialogResult   rs         = fotografia.ShowDialog(); // Mostrar
         if (rs == DialogResult.OK)
         {
             picPokemon.Image = Image.FromFile(fotografia.FileName); //Guardar la fotografía
         }
     }
     catch (Exception ex)                                            //En caso de errores
     {
         MessageBox.Show("¡Error! Vuelva a intentar " + ex.Message); //Mostrar mensaje de error
         VentanaInicio m3 = new VentanaInicio();                     //Crear ventana
         m3.Show();                                                  //Mostrar ventana
     }
 }
Пример #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (validar_foto > 0)
            {
                try
                {
                    //--------------------------------- VALIDACIONES DE ESCRITURA EN CAMPOS ---------------------------------
                    int a = 0;
                    while (a == 0)
                    {
                        //------------- VALIDACIONES DE COMILLAS -------------
                        string p = "'";
                        int    validación_comilla = 0;
                        foreach (char c in ID_Tipo.Text)
                        {
                            if (c == p[0])                    //Validar
                            {
                                validación_comilla++;
                            }
                        }
                        foreach (char c in Codigo_Tipo.Text)
                        {
                            if (c == p[0])                       //Validar
                            {
                                validación_comilla++;
                            }
                        }
                        foreach (char c in Nombre_Pokemon.Text)
                        {
                            if (c == p[0])                          //Validar
                            {
                                validación_comilla++;
                            }
                        }
                        if (validación_comilla > 0)                                                       //Validar
                        {
                            MessageBox.Show("¡Error! No debe ingresar información con comillas simples"); //Mensaje de error
                            break;
                        }

                        //------------- REGISTRO EN LA BASE DE DATOS -------------
                        System.IO.MemoryStream ms = new System.IO.MemoryStream();
                        picPokemon.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                        cn.InsertarPokemonAdministrador(Nombre_Pokemon.Text, ID_Tipo.Text, Codigo_Tipo.Text, Total.Text,
                                                        Salud.Text, Ataque.Text, Defensa.Text, Ataque_Especial.Text, Defensa_Especial.Text,
                                                        Velocidad.Text, Generacion.Text, comboBox1.Text, ms.GetBuffer()); //Insertar datos

                        MessageBox.Show("Pokemon creado correctamente");                                                  //Mensaje

                        this.Hide();                                                                                      //Ocultar ventana catual
                        ConsultaPokEnt m2 = new ConsultaPokEnt();                                                         //Crear ventana
                        m2.Show();                                                                                        // Mostrar ventana

                        a++;
                    }
                }
                catch (Exception ex)                                           //Validar errores
                {
                    MessageBox.Show("¡Error! Vuelva a intentar" + ex.Message); //Mostrar mensaje de errores
                    VentanaInicio m3 = new VentanaInicio();                    //Crear ventana
                    m3.Show();                                                 //Mostrar ventana
                }
            }

            else
            {
                MessageBox.Show("Ingrese una foto");
            }
        }