Beispiel #1
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            char idSexo        = ' ';
            int  idTipoUsuario = 2;

            if (rdoHombre.Checked == true)
            {
                idSexo = 'H';
            }
            else if (rdoMujer.Checked == true)
            {
                idSexo = 'M';
            }

            BorrarMensajes();
            if (ValidarCampos())
            {
                dcTiendaDataContext dc = new dcTiendaDataContext();
                dc.agregarUsuarios(
                    txtNombreUsuario.Text,
                    txtContraseña.Text,
                    txtContraseña2.Text,
                    txtNombre.Text,
                    txtApellidoPaterno.Text,
                    txtApellidoMaterno.Text,
                    idSexo,
                    txtTelefono.Text,
                    txtCorreo.Text,
                    txtDireccion.Text,
                    txtcodigop.Text,
                    byte.Parse(cboCiudad.SelectedValue.ToString()),
                    byte.Parse(idTipoUsuario.ToString())

                    );

                player.SoundLocation = "C:\\Users\\julii\\Desktop\\AUDIOS\\registro_correcto.wav";
                player.Play();
                MessageBox.Show("Se ha registrado correctamente");

                txtNombreUsuario.Text   = "";
                txtContraseña.Text      = "";
                txtContraseña2.Text     = "";
                txtNombre.Text          = "";
                txtApellidoPaterno.Text = "";
                txtApellidoMaterno.Text = "";
                txtTelefono.Text        = "";
                txtCorreo.Text          = "";
                txtDireccion.Text       = "";
                txtCp.Text = "";
            }
            else
            {
                player.SoundLocation = "C:\\Users\\julii\\Desktop\\AUDIOS\\faltan_campos.wav";
                player.Play();
            }
        }
Beispiel #2
0
        private void RegistrarUsuarios_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                char idSexo        = ' ';
                int  idTipoUsuario = 2;

                if (rdoHombre.Checked == true)
                {
                    idSexo = 'H';
                }
                else if (rdoMujer.Checked == true)
                {
                    idSexo = 'M';
                }

                BorrarMensajes();
                if (ValidarCampos())
                {
                    dcTiendaDataContext dc = new dcTiendaDataContext();
                    dc.agregarUsuarios(
                        txtNombreUsuario.Text,
                        txtContraseña.Text,
                        txtContraseña2.Text,
                        txtNombre.Text,
                        txtApellidoPaterno.Text,
                        txtApellidoMaterno.Text,
                        idSexo,
                        txtTelefono.Text,
                        txtCorreo.Text,
                        txtDireccion.Text,
                        txtcodigop.Text,
                        byte.Parse(cboCiudad.SelectedValue.ToString()),
                        byte.Parse(idTipoUsuario.ToString())

                        );

                    player.SoundLocation = "C:\\Users\\julii\\Desktop\\AUDIOS\\registro_correcto.wav";
                    player.Play();
                    MessageBox.Show("Se ha registrado Correctamente");

                    txtNombreUsuario.Text   = "";
                    txtContraseña.Text      = "";
                    txtContraseña2.Text     = "";
                    txtNombre.Text          = "";
                    txtApellidoPaterno.Text = "";
                    txtApellidoMaterno.Text = "";
                    txtTelefono.Text        = "";
                    txtCorreo.Text          = "";
                    txtDireccion.Text       = "";
                    txtCp.Text = "";
                }
                else
                {
                    player.SoundLocation = "C:\\Users\\julii\\Desktop\\AUDIOS\\faltan_campos.wav";
                    player.Play();
                }
            }


            if (e.KeyCode == Keys.Escape)
            {
                player.SoundLocation = "C:\\Users\\julii\\Desktop\\AUDIOS\\salir_sin_guardar.wav";
                player.Play();
                string            message = "Deseas Salir Sin Guardar?";
                string            caption = "Salir";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult      result;

                // Displays the MessageBox.

                result = MessageBox.Show(message, caption, buttons);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    MenuIniciarSesion volver = new MenuIniciarSesion();
                    volver.Show();
                    this.Hide();
                }
            }
        }