public static String doReserve(String id, String uid, String reserveDate) {
    //		String sqlString = "select * from reservation where model_id='"+id+"' and user_id='"+ uid +
    // "';";
    SQLConnection conn = new SQLConnection();
    //		if(conn.checkExist(sqlString)){
    //			return "2";
    //		}
    User user = new User();
    user.setId(uid);
    user = new UserHandle(user).getUserInfo();

    String sqlString2 =
        "insert into reservation(user_id,user_name,mobile,model_id,salesman_id,create_time,reserve_time,state) values ('"
            + user.getId()
            + "','"
            + user.getName()
            + "','"
            + user.getMobile()
            + "','"
            + id
            + "','"
            + user.getSalesman()
            + "','"
            + MyHandle.getDate()
            + "','"
            + reserveDate
            + "','"
            + "0');";
    System.out.print(sqlString2);
    int rst = conn.executeUpdate(sqlString2);
    if (rst > 0) {
      HouseHandle.addReservation(id);
      return "0";
    } else return "1";
  }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.tea_video_grid);

    context = TeaVideoActivity.this;
    myHandle = new MyHandle();

    SqliteHelper sqliteHelper = new SqliteHelper(context);
    DatabaseManager.initializeInstance(sqliteHelper);

    teaVideoGV = (GridView) super.findViewById(R.id.tea_video_gv);

    /*new Thread(new Runnable() {

    @Override
    public void run() {*/

    myHandle.sendEmptyMessage(1);
    /*
    	}
    }).start();*/

    teaVideoGV.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // TODO Auto-generated method stub
            // TODO Auto-generated method stub
            Intent intent = new Intent();
            intent.putExtra(
                "url", serverUrl + dataList.get(dataList.size() - position - 1).getVideourl());
            intent.setClass(TeaVideoActivity.this, VideoPlayer.class);
            startActivity(intent);
          }
        });
  }