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

Different sleeping positions, different personalities? How do you sleep?

It is unreliable to judge a child's personali...

How to write the Double 12 event plan? This universal solution is for you!

It feels like everyone is busy and exhausted from...

How to learn to write promotion planning proposals?

Before making a planning proposal, let us first t...

To prevent obesity, should you eat like a pig?

You may not believe it, but some scientists sugge...

How to build corporate brand awareness through the Internet?

Today is the Internet age. Everyone is using mobi...

Would you like to know the 10 tips for Weibo operation and promotion?

Would you like to know about the ten tips for Wei...

How to do data analysis for information flow promotion? Avoid these 4 pitfalls!

If you work in bidding, how can you grow into a p...

Did Lenovo make money by selling 50 million mobile phones?

Yesterday, Lenovo announced its 2013-2014 fiscal y...

Why do dogs sniff each other's butts when they meet?

This article was reviewed by Zhao Xumao, a young ...

What is the TAG tag? How to use the TAG tag correctly?

For many staff who have just engaged in network p...