コード例 #1
0
        private void ingresoEgresoEstadia()
        {
            try
            {
                // Se utilizan las variables grobales definidas en Variables.cs
                using (SqlConnection con = new SqlConnection(Variables.connectionStr))
                {
                    using (SqlCommand cmd = new SqlCommand("GITAR_HEROES.ingresoEgresoEstadia", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        // Se pasa el hotel logueado y la reserva como primeros parametros
                        cmd.Parameters.Add("@codigo_hotel", SqlDbType.Int).Value   = Variables.hotel_id;
                        cmd.Parameters.Add("@codigo_reserva", SqlDbType.Int).Value = Convert.ToInt32(textBoxCodReserva.Text);
                        cmd.Parameters.Add("@fecha", SqlDbType.Date).Value         = Convert.ToDateTime(Variables.fecha_sistema);
                        cmd.Parameters.Add("@username", SqlDbType.Char).Value      = Variables.usuario;

                        var returnParameter = cmd.Parameters.Add("@estado_registro", SqlDbType.Int);
                        returnParameter.Direction = ParameterDirection.Output;

                        con.Open();
                        cmd.ExecuteNonQuery();

                        estado_registro = (int)returnParameter.Value;
                        //estado_registro = estado_registro.ToString();
                    }
                }
                if (estado_registro == 1)
                {
                    MessageBox.Show("Check in de estadia realizado correctamente.");

                    // Se activa la funcion para reservar nuevamente en el caso de haberse perdido la estadia
                    linkLabelClientes.Enabled = true;
                }
                else if (estado_registro == 0)
                {
                    MessageBox.Show("Check out de estadia realizado correctamente.");

                    // Cerramos la funcionalidad actual y procedemos a facturar directamente la estadia
                    this.Hide();
                    FacturarEstadia facturar_estadia = new FacturarEstadia();
                    facturar_estadia.StartPosition = FormStartPosition.CenterScreen;
                    facturar_estadia.Show();
                }
                else if (estado_registro == -1)
                {
                    MessageBox.Show("Check in NO realizado correctamente. Genere una nueva reserva.");

                    // Se activa la funcion para reservar nuevamente en el caso de haberse perdido la estadia
                    linkLabelReservar.Enabled = true;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error");
            }
        }
コード例 #2
0
ファイル: Funcionalidades.cs プロジェクト: Ale1391/GH2014
 private void button1_Click(object sender, EventArgs e)
 {
     //CONTINUAR
     if (codigo_funcionalidad == 9)
     {
         //CANCELAR RESERVA
         this.Hide();
         CancelarReserva cancelar_reserva = new CancelarReserva();
         cancelar_reserva.StartPosition = FormStartPosition.CenterScreen;
         cancelar_reserva.ShowDialog();
     }
     else if (codigo_funcionalidad == 3)
     {
         //ABM USUARIO
         this.Hide();
         Usuario abm_usuario = new Usuario();
         abm_usuario.StartPosition = FormStartPosition.CenterScreen;
         abm_usuario.ShowDialog();
     }
     else if (codigo_funcionalidad == 1)
     {
         //ABM ROL
         this.Hide();
         Rol abm_rol = new Rol();
         abm_rol.StartPosition = FormStartPosition.CenterScreen;
         abm_rol.ShowDialog();
     }
     else if (codigo_funcionalidad == 4)
     {
         //ABM CLIENTE
         this.Hide();
         Cliente abm_cliente = new Cliente();
         abm_cliente.StartPosition = FormStartPosition.CenterScreen;
         abm_cliente.ShowDialog();
     }
     else if (codigo_funcionalidad == 5)
     {
         //ABM HOTEL
         this.Hide();
         Hotel abm_hotel = new Hotel();
         abm_hotel.StartPosition = FormStartPosition.CenterScreen;
         abm_hotel.ShowDialog();
     }
     else if (codigo_funcionalidad == 6)
     {
         //ABM HABITACION
         this.Hide();
         Habitacion abm_habitacion = new Habitacion();
         abm_habitacion.StartPosition = FormStartPosition.CenterScreen;
         abm_habitacion.ShowDialog();
     }
     else if (codigo_funcionalidad == 8)
     {
         //GENERAR O MODIFICAR RESERVA
         this.Hide();
         Reserva abm_reserva = new Reserva();
         abm_reserva.StartPosition = FormStartPosition.CenterScreen;
         abm_reserva.ShowDialog();
     }
     else if (codigo_funcionalidad == 11)
     {
         //REGISTRAR CONSUMIBLE
         this.Hide();
         Consumible registrarConsumible = new Consumible();
         registrarConsumible.StartPosition = FormStartPosition.CenterScreen;
         registrarConsumible.ShowDialog();
     }
     else if (codigo_funcionalidad == 10)
     {
         //REGISTRAR ESTADIA
         this.Hide();
         RegistrarEstadia registrar_estadia = new RegistrarEstadia();
         registrar_estadia.StartPosition = FormStartPosition.CenterScreen;
         registrar_estadia.ShowDialog();
     }
     else if (codigo_funcionalidad == 12)
     {
         //FACTURAR ESTADIA
         this.Hide();
         FacturarEstadia facturar_estadia = new FacturarEstadia();
         facturar_estadia.StartPosition = FormStartPosition.CenterScreen;
         facturar_estadia.ShowDialog();
     }
     else if (codigo_funcionalidad == 13)
     {
         //LISTADO ESTADISTICO
         this.Hide();
         ListadoEstadistico listado_estadistico = new ListadoEstadistico();
         listado_estadistico.StartPosition = FormStartPosition.CenterScreen;
         listado_estadistico.ShowDialog();
     }
 }