Пример #1
0
        public DataSet GetFlightByAirportANDAirline(string airport, string airline)
        {
            SqlDataAdapter Adapt = new SqlDataAdapter();

            Adapt.TableMappings.Add("Table", "Vuelo");
            SqlCommand comnd = new SqlCommand();

            comnd.Connection    = ConnectionClass.Connect();
            comnd.CommandText   = $"dbo.STP_VuelosPorAeropuertoPorAerolinea_SLT '{airport}', '{airline}'";
            comnd.CommandType   = CommandType.Text;
            Adapt.SelectCommand = comnd;
            DataSet dts = new DataSet("vuelo");

            Adapt.Fill(dts);
            return(dts);
        }
Пример #2
0
        public DataSet GetOneFlight(int ID)
        {
            SqlDataAdapter Adapt = new SqlDataAdapter();

            Adapt.TableMappings.Add("Table", "Vuelo");
            SqlCommand comnd = new SqlCommand();

            comnd.Connection    = ConnectionClass.Connect();
            comnd.CommandText   = "EXEC dbo.STP_Vuelo_SLTONE " + ID;
            comnd.CommandType   = CommandType.Text;
            Adapt.SelectCommand = comnd;
            DataSet dts = new DataSet("vuelo");

            Adapt.Fill(dts);
            return(dts);
        }
        public DataSet SeachPersonByName(string name, string lastname)
        {
            SqlDataAdapter Adapt = new SqlDataAdapter();

            Adapt.TableMappings.Add("Table", "personal");
            SqlCommand comnd = new SqlCommand();

            comnd.Connection    = ConnectionClass.Connect();
            comnd.CommandText   = $"dbo.STP_Personal_Vuelo_SLTONE '{name}', '{lastname}'";
            comnd.CommandType   = CommandType.Text;
            Adapt.SelectCommand = comnd;
            DataSet dts = new DataSet("personal");

            Adapt.Fill(dts);
            return(dts);
        }
        public DataSet GetPersonal()
        {
            SqlDataAdapter Adapt = new SqlDataAdapter();

            Adapt.TableMappings.Add("Table", "Personal");
            SqlCommand comnd = new SqlCommand();

            comnd.Connection    = ConnectionClass.Connect();
            comnd.CommandText   = "EXEC dbo.STP_Personal_Vuelo_SLTALL";
            comnd.CommandType   = CommandType.Text;
            Adapt.SelectCommand = comnd;
            DataSet dts = new DataSet("persona");

            Adapt.Fill(dts);
            return(dts);
        }
        private void btn_RemoverVuelo_Click(object sender, EventArgs e)
        {
            SqlConnection sql = ConnectionClass.Connect();
            SqlCommand    cmd = new SqlCommand("dbo.STP_Vuelo_DLT", sql);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@varIDVuelo", int.Parse(tbx_NumVuelo.Text));

            int i = cmd.ExecuteNonQuery();

            sql.Close();

            if (i != 0)
            {
                MessageBox.Show(i + "Data Removed");
            }
        }
        private void btn_AgregarAerolinea_Click(object sender, EventArgs e)
        {
            SqlConnection sql = ConnectionClass.Connect();
            SqlCommand    cmd = new SqlCommand("dbo.STP_Aerolinea_INS", sql);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@varNombre", textBox1.Text);
            cmd.Parameters.AddWithValue("@varIDPais", int.Parse(textBox2.Text));

            int i = cmd.ExecuteNonQuery();

            sql.Close();

            if (i != 0)
            {
                MessageBox.Show(i + " Data Saved");
            }
        }
        private void btn_Modificar_Click(object sender, EventArgs e)
        {
            SqlConnection sql = ConnectionClass.Connect();
            SqlCommand    cmd = new SqlCommand("dbo.STP_Vuelo_UPD", sql);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@varCodigo", Tbx_CodigoVuelo.Text);
            cmd.Parameters.AddWithValue("@varIDAvionNuevo", int.Parse(Tbx_Avion.Text));
            cmd.Parameters.AddWithValue("@varIDAerolineaNueva", int.Parse(Tbx_Aerolinea.Text));
            cmd.Parameters.AddWithValue("@varIDAeropuertoSalidaNuevo", int.Parse(Tbx_AeropuertoSalida.Text));
            cmd.Parameters.AddWithValue("@varIDAeropuertoLlegadaNuevo", int.Parse(Tbx_AeropuertoLlegada.Text));
            cmd.Parameters.AddWithValue("@varFechaSalidaNueva", Tbx_FechaSalida.Text);
            cmd.Parameters.AddWithValue("@varFechaLlegadaNueva", Tbx_FechaEntrada.Text);
            cmd.Parameters.AddWithValue("@varEstadoNuevo", Tbx_Estado.Text);

            int i = cmd.ExecuteNonQuery();

            sql.Close();

            if (i != 0)
            {
                MessageBox.Show(i + " Data Saved");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection sql = ConnectionClass.Connect();
            SqlCommand    cmd = new SqlCommand("dbo.STP_Vuelo_INS", sql);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@varCodigo", tbx_Codigo.Text);
            cmd.Parameters.AddWithValue("@varID_Avion", int.Parse(Tbox_Avion.Text));
            cmd.Parameters.AddWithValue("@varID_Aerolinea", int.Parse(Tbox_Aerolinea.Text));
            cmd.Parameters.AddWithValue("@varIDAeropuertoSalida", int.Parse(Tbox_AeropuertoS.Text));
            cmd.Parameters.AddWithValue("@varIDAeropuertoLlegada", int.Parse(Tbox_AeropuertoE.Text));
            cmd.Parameters.AddWithValue("@FechaSalida", Tbox_HoraSalida.Text);
            cmd.Parameters.AddWithValue("@FechaLlegada", Tbox_HoraLlegada.Text);
            cmd.Parameters.AddWithValue("@Estado", tbx_Estado.Text);

            int i = cmd.ExecuteNonQuery();

            sql.Close();

            if (i != 0)
            {
                MessageBox.Show(i + " Data Saved");
            }
        }