mercredi 23 mars 2016

How to check booking status (Free or booked like show in Bookmyshow app) in android

I'm new to android development. Right now I'm working on basic android application for Table booking in Restaurant.Please suggest me how to implement. Thank you so much

private void createTables() { 
//my database creation

    openDB();
    db.execSQL("CREATE TABLE IF NOT EXISTS customer(user_id VARCHAR UNIQUE,password VARCHAR,email VARCHAR, contact VARCHAR);");
    db.execSQL("CREATE TABLE IF NOT EXISTS booking(city VARCHAR,restro varchar,time VARCHAR,date VARCHAR,people varchar,table_number varchar);");
    closeDB();
} 

I thought to Implement using composite Primary key like primary key(city,restro,date,time,table) but seems my logic is not correct. Even as I run my application it get stop.when I use composite pk. please suggest.

    public void onClick(View v) {
try {
    if (v == book) {

        if (dbHelper.insertIntoBooking(city.getText().toString(), restro.getText().toString(),
                time.getText().toString(), date.getText().toString(),
                people.getText().toString(), table.getText().toString())) {
            showMessage("Booking", "Done");

        }
    }

}catch (SQLiteException e){
    e.printStackTrace();
    Toast.makeText(getApplicationContext(), "Alert. Sorry Table not Available", Toast.LENGTH_LONG).show();

}

Aucun commentaire:

Enregistrer un commentaire