示例#1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            Elegir ToRegistro = new Elegir();

            this.Hide();
            ToRegistro.Show();
        }
示例#2
0
        private void Back_button_Click(object sender, EventArgs e)
        {
            Elegir ToElegir = new Elegir();

            this.Hide();
            ToElegir.Show();
        }
示例#3
0
        private void button2_Click(object sender, EventArgs e)
        {
            Elegir ToMenu = new Elegir();

            this.Hide();
            ToMenu.Show();
        }
示例#4
0
        private void Label2_Click(object sender, EventArgs e)
        {
            Elegir ToElegir = new Elegir();

            this.Hide();
            ToElegir.Show();
        }
示例#5
0
        private void Button1_Click(object sender, EventArgs e)
        {
            providerAccount newProviderAccount = new providerAccount();

            newProviderAccount.name_prov     = name_textbox.Text.Trim();
            newProviderAccount.email_prov    = textBox2.Text.Trim();
            newProviderAccount.tel_prov      = textBox1.Text.Trim();
            newProviderAccount.location_prov = textBox3.Text.Trim();

            if (string.IsNullOrEmpty(name_textbox.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox3.Text))
            {
                MessageBox.Show("Los campos no pueden quedar vacios", "Registro Proveedor", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MySqlConnection conexion = Connection.GetConnection();

                MySqlCommand newProvider = new MySqlCommand();
                newProvider.CommandText = "SELECT * FROM provider WHERE name_prov   ";
                newProvider.Parameters.AddWithValue("@newProviderAccount.name_prov", newProviderAccount.name_prov);
                newProvider.Parameters.AddWithValue("@newProviderAccount.email_prov", newProviderAccount.email_prov);
                newProvider.Parameters.AddWithValue("@newProvideraAccount.tel_prov", newProviderAccount.tel_prov);
                newProvider.Parameters.AddWithValue("@newProviderAccount.location_prov", newProviderAccount.location_prov);
                newProvider.Connection = conexion;

                MySqlDataReader leer = newProvider.ExecuteReader();
                if (leer.Read())
                {
                    MessageBox.Show("El usuario ya existe", "Registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conexion.Close();
                }
                else
                {
                    int resultado = RegisterNewProvider.agregar(newProviderAccount);
                    if (resultado > 0)
                    {
                        MessageBox.Show("Proveedor Registrado con Exito!", "Registro", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Elegir ToElegir = new Elegir();
                        this.Hide();
                        ToElegir.Show();
                    }
                    else
                    {
                        MessageBox.Show("No se pudo guardar a el Proveedor", "Registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
示例#6
0
        private void login_button_Click(object sender, EventArgs e)
        {
            string user     = user_textbox.Text;
            string password = password_textbox.Text;

            MySqlConnection conexion = Connection.GetConnection();

            MySqlCommand login = new MySqlCommand();

            login.CommandText = "SELECT * FROM user WHERE account_user = @user AND password_user = @password";
            login.Parameters.AddWithValue("@user", user);
            login.Parameters.AddWithValue("@password", password);
            login.Connection = conexion;

            if (string.IsNullOrEmpty(user_textbox.Text) || string.IsNullOrEmpty(password_textbox.Text))
            {
                MessageBox.Show("Los campos no pueden quedar vacios", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MySqlDataReader leer = login.ExecuteReader();
                if (leer.Read())
                {
                    Login.idUsuario     = leer.GetInt32(0);
                    Login.nombreUsuario = leer.GetString(1);
                    Console.WriteLine(Login.idUsuario);
                    MessageBox.Show("Bienvenido", "Log In", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Elegir ToMenu = new Elegir();

                    this.Hide();
                    ToMenu.Show();
                    conexion.Close();
                }
                else
                {
                    MessageBox.Show("Usuario o Contraseña incorrectos", "Log In", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    conexion.Close();
                }
            }
        }