Example #1
0
        private void volverALaPaginaAnterior_Click(object sender, EventArgs e)
        {
            Form formularioSiguiente = new AbmSucursal.Form1();

            formularioSiguiente.Visible = true;
            this.Visible = false;
        }
Example #2
0
        private void DarAltaSucursal_Click(object sender, EventArgs e)
        {
            if (!todosLosCamposLLenos() && !validarTipos())
            {
                try
                {
                    var cmd = new SqlCommand(
                        "EXEC [SERVOMOTOR].insertOUpdateEnSucursales @TIPOOPERACION,@COD_POSTAL,@NOMBRE,@DIRECCION,@ESTADO_HABILITACION",
                        Program.conexion()
                        );
                    cmd.Parameters.AddWithValue("@TIPOOPERACION", 1);
                    cmd.Parameters.AddWithValue("@COD_POSTAL", txtCodPostalSucursal.Text);
                    cmd.Parameters.AddWithValue("@NOMBRE", txtNombreSucursal.Text);
                    cmd.Parameters.AddWithValue("@DIRECCION", txtDireccionSucursal.Text);
                    cmd.Parameters.AddWithValue("@ESTADO_HABILITACION", 1);

                    var dataReaderFactura = cmd.ExecuteReader();
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    MessageBox.Show("Codigo postal o nombre de sucursal duplicado, vuelva a ingresar otro", "", MessageBoxButtons.OK);
                    return;
                }
                MessageBox.Show("Se ha dado de alta correctamente", "Todo bien", MessageBoxButtons.OK);
                Form formularioSiguiente = new AbmSucursal.Form1();

                formularioSiguiente.Visible = true;
                this.Visible = false;
            }
        }