示例#1
0
        private void BunifuFlatButton3_Click(object sender, EventArgs e)
        {
            Alta_Donante Form7 = new Alta_Donante();

            this.Hide();
            Form7.Show();
        }
示例#2
0
        private void Alta_Donante_Button_Click(object sender, EventArgs e)
        {
            Alta_Donante Form6 = new Alta_Donante();

            this.Hide();
            Form6.Show();
        }
示例#3
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            Alta_Donante Form6 = new Alta_Donante();

            this.Hide();
            Form6.Show();
        }
示例#4
0
        private void bunifuThinButton22_Click(object sender, EventArgs e)
        {
            string Nombre = Nombre_TextBox.Text;
            string Sexo   = ""; //Radio Button If

            if (Hombre_RadioButton.Checked)
            {
                Sexo = "H";
            }
            else
            {
            }
            if (Mujer_RadioButton.Checked)
            {
                Sexo = "M";
            }
            else
            {
            }
            if (Otro_RadioButton.Checked)
            {
                Sexo = "O";
            }
            else
            {
            }
            string Edad     = Edad_TextBox.Text;
            string Teléfono = Teléfono_TextBox.Text;
            string Sangre   = "";

            if (TipoSangre_ComboBox.SelectedItem == null)
            {
                MessageBox.Show("Los campos no pueden quedar vacios", "Registrar Donante", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                Sangre = TipoSangre_ComboBox.SelectedItem.ToString();
            }

            /*
             * string Fecha = Fecha_TimePicker.Text;
             * Fecha_TimePicker.Format = DateTimePickerFormat.Custom;
             */

            string Fecha = Fecha_TimePicker.Value.ToString("yyyy-MM-dd");

            //MessageBox.Show("Bienvenido" + Fecha, "Log In", MessageBoxButtons.OK, MessageBoxIcon.Information);

            string Dirección = Dirección_TextBox.Text;
            string Correo    = Correo_TextBox.Text;

            if (string.IsNullOrEmpty(Nombre_TextBox.Text) || string.IsNullOrEmpty(Sexo) || string.IsNullOrEmpty(Edad_TextBox.Text) || string.IsNullOrEmpty(Teléfono_TextBox.Text) || string.IsNullOrEmpty(Fecha) || string.IsNullOrEmpty(Dirección_TextBox.Text) || string.IsNullOrEmpty(Correo_TextBox.Text))
            {
                MessageBox.Show("Los campos no pueden quedar vacios", "Registro del Donante", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            /*else
             * {
             *  MySqlConnection conexion = new MySqlConnection("server = 127.0.0.1; database = sistemabloodabase; Uid = root; pwd = 2000;");
             *  conexion.Open();
             * }
             */
            else
            {
                MySqlConnection conexion = new MySqlConnection("server = 127.0.0.1; database = sistemabloodabase; Uid = root; pwd = 2000;");
                conexion.Open();

                string query = @"insert into donador(nom_don, sexo_don, edad_don, tel_don, tiposangre_don, fechanac_don, dir_don, correo_don) values(@Nombre, @Sexo, @Edad, @Teléfono, @Sangre, @Fecha, @Dirección, @Correo)";

                MySqlCommand registrodonante = new MySqlCommand(query, conexion);
                registrodonante.Parameters.AddWithValue("@Nombre", Nombre);
                registrodonante.Parameters.AddWithValue("@Sexo", Sexo);
                registrodonante.Parameters.AddWithValue("@Edad", Edad);
                registrodonante.Parameters.AddWithValue("@Teléfono", Teléfono);
                registrodonante.Parameters.AddWithValue("@Sangre", Sangre);
                registrodonante.Parameters.AddWithValue("@Fecha", Fecha);
                registrodonante.Parameters.AddWithValue("@Dirección", Dirección);
                registrodonante.Parameters.AddWithValue("@Correo", Correo);

                registrodonante.ExecuteNonQuery();
                MessageBox.Show("Donante Registrado con Exito!", "Registro del Donante", MessageBoxButtons.OK, MessageBoxIcon.Information);
                conexion.Close();

                /*int resultado = RegistrarDonante.agregar(nuevaCuentaDon);
                 * if (resultado > 0)
                 * {
                 *  MessageBox.Show("Donante Registrado con Exito!", "Registro del Donante", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *  Alta_Donante Form6 = new Alta_Donante();
                 *  this.Hide();
                 *  Form6.Show();
                 * }
                 * else
                 * {
                 *  MessageBox.Show("No se pudo guardar el Usuario", "Registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 * }
                 */
            }


            /*CuentaDon nuevaCuentaDon = new CuentaDon();
             * nuevaCuentaDon.nom_don = Nombre;
             * nuevaCuentaDon.sexo_don = Sexo;
             * nuevaCuentaDon.edad_don = Edad;
             * nuevaCuentaDon.tel_don = Teléfono;
             * nuevaCuentaDon.fechanac_don = Fecha;
             * nuevaCuentaDon.dir_don = Dirección;
             * nuevaCuentaDon.estado_don = Estado;
             * nuevaCuentaDon.ciudad_don = Ciudad;
             * nuevaCuentaDon.correo_don = Correo;
             */
            Alta_Donante Form6 = new Alta_Donante();

            this.Hide();
            Form6.Show();
        }