Android source code warehouse management

Android source code warehouse management


Source code introduction

A simple warehouse management system, suitable for beginners to learn.
Source code screenshot

Source code snippet

  1. rotated void onCreate(Bundle savedInstanceState) {
  2. // TODO Auto-generated method stub  
  3. super .onCreate(savedInstanceState);
  4. setContentView(R.layout.userregister);
  5. name = (EditText) findViewById(R.id.usename);
  6. pass = (EditText) findViewById(R.id.password);
  7. passsure = (EditText) findViewById(R.id.passwordsure);
  8. workid = (EditText) findViewById(R.id.useide);
  9. db = new SqlHelpdemo(getApplicationContext(), "store.db" , null , 1 );
  10. sDatabase = db.getWritableDatabase();
  11.   
  12. }
  13.   
  14. public   void sure(View v) {
  15. db = new SqlHelpdemo(getApplicationContext(), "store.db" , null , 1 );
  16. sDatabase = db.getWritableDatabase();
  17. if (name.getText().toString().equals( "" )
  18. || pass.getText().toString().equals( "" )
  19. || passsure.getText().toString().equals( "" )
  20. || workid.getText().toString().equals( "" )) {
  21.   
  22. DialogDemo.builder(UserRegister. this , "Error message" , "Please fill in the complete information!" );
  23.   
  24. } else   if (!pass.getText().toString()
  25. .equals(passsure.getText().toString())) {
  26. DialogDemo.builder(UserRegister. this , "Error message" , "The two passwords you entered are inconsistent!" );
  27. } else {
  28. String ename = name.getText().toString();
  29. String epass = pass.getText().toString();
  30. String eid = workid.getText().toString();
  31. // Query statement  
  32. String selectStr = "select username from user_info" ;
  33. Cursor select_cursor = sDatabase.rawQuery(selectStr, null );
  34. select_cursor.moveToFirst();
  35. String string = null ;
  36. do {
  37. try {
  38. string = select_cursor.getString( 0 );
  39. } catch (Exception e) {
  40. // TODO: handle exception  
  41. string = "" ;
  42. }
  43. if (string.equals(ename)) {
  44. DialogDemo.builder(UserRegister. this , "error message" ,
  45. "The username already exists, please create another username" );
  46. select_cursor.close();
  47. break ;
  48.   
  49. }
  50. } while (select_cursor.moveToNext());
  51. // Start without duplicate registration  
  52. if (!string.equals(ename)) {
  53. // Define ID  
  54. int id = 0 ;
  55. String select = "select max(_id) from user_info" ;
  56. Cursor seCursor = sDatabase.rawQuery(select, null );
  57. try {
  58. seCursor.moveToFirst();
  59. id = Integer.parseInt(seCursor.getString( 0 ));
  60. id += 1 ;
  61. } catch (Exception e) {
  62. // TODO: handle exception  
  63. id = 0 ;
  64. }
  65. sDatabase.execSQL( "insert into user_info values('" + id + "','"  
  66. + ename + "','" + epass + "','"  
  67. + eid + "')" );
  68. DialogDemo.builder(UserRegister. this , "Prompt" , "Registration successful, please return to the login interface to log in" );
  69.                   
  70. seCursor.close();
  71.               
  72.                   
  73. }
  74. }
  75.   
  76. }
  77.   
  78. }

Source code link: http://download..com/data/2009972

<<:  Star Rating

>>:  Verification code countdown

Recommend

An effective method for building an APP user system!

We must be clear that building a user growth syst...

As an excellent operator, how can you perform real-time analysis?

With the increasing number of operational methods...

How to get more customers smartly?

If we divide the company's customer base base...

Apple iPhone 5C price starts from $99, protective case is sold for $29

September 11 news: Apple's fall product launc...

iPhone 7 Launch Guide: Get it first

Apple has scheduled the much-anticipated iPhone 7 ...

Disliked by animals, it is the "nemesis" of sand

In the winter in the north, seeing some green is ...

2019 Spring Festival Information Flow Marketing Analysis Report!

The 2019 Spring Festival is approaching. As we al...