Exemplo n.º 1
0
        private void generarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form f = new Generar_Modificar_Reserva.AltaReserva(this);

            f.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                string        ConnStr = ConfigurationManager.AppSettings["stringConexion"];
                SqlConnection conn    = new SqlConnection(ConnStr);
                string        sSel    = string.Format(@"SELECT * FROM [GD2C2014].[CONTROL_ZETA].[RESERVA] res, 
                    [GD2C2014].[CONTROL_ZETA].[HOTEL] hotel,
                    [GD2C2014].[CONTROL_ZETA].[REGIMEN] reg, 
                    [GD2C2014].[CONTROL_ZETA].[LOCALIDAD] loc
                    where res.RESERVA_ID = '{0}'
                    and res.RESERVA_ID_HOTEL = hotel.HOTEL_ID
                    and res.RESERVA_ID_REGIMEN = reg.REG_ID
                    and loc.LOC_ID = hotel.HOTEL_ID_LOC", textBox1.Text);
                SqlCommand    cmd     = new SqlCommand(sSel, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    if (reader["RES_PRECIO_TOTAL"].ToString() == "")
                    {
                        SqlConnection con = new SqlConnection(ConnStr);
                        con.Open();
                        SqlCommand scCommand = new SqlCommand("CONTROL_ZETA.SP_ACT_PRECIO_RES", con);
                        scCommand.CommandType = CommandType.StoredProcedure;
                        scCommand.Parameters.Add("@id_reserva", SqlDbType.Int).Value = int.Parse(textBox1.Text);
                        if (scCommand.Connection.State == ConnectionState.Closed)
                        {
                            scCommand.Connection.Open();
                        }
                        scCommand.ExecuteNonQuery();
                        con.Close();
                    }
                    AltaReserva f = new AltaReserva(this, reader, conn);
                    f.Show();
                    if (!f.tieneError())
                    {
                        this.Hide();
                    }
                }


                else
                {
                    MessageBox.Show("No existe la reserva especificada", "Error de ingreso de datos", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }