Professional Documents
Culture Documents
DEVICES APPLICATION
By
ASSOCIATE DEGREE
IN
COMPUTER SCIENCE
The work reported in this thesis was carried out by me under the supervision of Mr.
Hammad Habib Department of Computer Science Punjab College University Campus,
Faisalabad, Pakistan.
I hereby declare that the title of thesis E-COMMERCE FOR ELECTRONIC
DEVICES APPLICATION and the contents of thesis are the product of my own research and
no part has been copied from any published source (except the references, standard mathematical
or genetic models /equations /formulas/protocols etc). I further declare that this work has not
been submitted for award of any other degree /diploma. The University may take action if the
information provided is found inaccurate at any stage.
_____________________
Signature of the Student
Ahmad Raza
2020-GCUF-071632
_____________________
Signature of the Student
Faisal Ali
2020-GCUF-071626
_____________________
Signature of the Student
Muhammad Hashim Yasin
2020-GCUF-071636
I
CERTIFICATE BY SUPERVISORY COMMITTEE
We certify that the content and form of thesis submitted by MR. Ahmad Raza
Registration No: 2020-GCUF-071632, MR. Faisal Ali Registration No: 2020-GCUF-071626
and Mr. Muhammad Hashim Yasin Registration No: 2020-GCUF-071636 has been found
satisfactory and in accordance with the prescribed format. We recommend it to be proceed for
the evaluation by the external Examiner for the award of degree.
Signature of
Supervisor .................................
Name .............................................................
Designation with Stamp ................................
Chairperson
Signature .......................................................
Name .............................................................
Designation with Stamp ................................
II
DEDICATED
TO
My Graceful and Polite PARENTS
&
All Family Members
Who live in my mind and soul
Whose love is more precious
Then pearls and diamonds
Who are those whom I say my own
Whose love will never change
Whose prayers will never die
III
Acknowledgments
Firstly, we thankful to ALLAH ALMIGHTY who blessed us with knowledge to complete this
project with HIS mercy. In completing this undergraduate project. I have been fortunate to have
help, support and encouragement from others around me. I would like to acknowledge them for
their cooperation.
Firstly, I would like to thank my project supervisor Mr. Hammad Habib, Lecturer. Mr. Subhan
and Advisor, Government College University Faisalabad for guiding me through each step of the
process with knowledge and support. Thank you for your advice, guidance and assistance. He has
been a constant source of guidance throughout the course of this project. We are also thankful to
our families and friends whose silent support led us to complete our project.
Ahmad Raza
GCUF-2020-071632
Faisal Ali
GCUF-2020-071626
Muhammad Hashim Yasin
GCUF-2020-071636
IV
Table of Contents
V
2.3.2 Requirement Name: Customer Login .........................................................................
9
2.3.3 Requirement Name: Order Taker Login ....................................................................
9
2.3.4 Requirement Name: Transactions ............................................................................
10
2.3.5 Requirement Name: Track Order .............................................................................
10
2.3.6 Requirement Name: Complete Order .......................................................................
10
2.4 USE CASE MODELS .....................................................................................................
11
2.4.1 Admin ........................................................................................................................
11
2.4.2 Customer ..................................................................................................................
12
2.4.3 Order Taker ..............................................................................................................
13
2.5 DESCRIPTION OF ADMIN USE CASE IN FULLY DRESSED FORMAT ...............
14
2.6 NON-FUNCTIONAL REQUIREMENTS .....................................................................
17
2.6.1 User Interface ...........................................................................................................
17
2.6.2 Fast Response Time ..................................................................................................
17
2.6.3 Ease of Use ...............................................................................................................
17
2.6.4 Performance Requirements ......................................................................................
18
2.6.5 Safety Requirements .................................................................................................
18
VI
2.6.6 Security Requirements ...............................................................................................
18
2.6.7 Software Quality Attributes .......................................................................................
18
CHAPTER-3 DESIGN ...............................................................................................................
19
3.1 System Sequence Diagram of Admin Login ...................................................................
20
3.2 System Sequence Diagram of Registered Login ............................................................
21
3.3 CLASS DIAGRAM .......................................................................................................
22
3.4 ENTITY RELATIONSHIP DIAGRAM (ERD) ............................................................
23
3.4.1 ERD OF ADMIN ...................................................................................................
24
3.4.2 ERD OF CUSTOMER ...........................................................................................
25
CHAPTER-4 IMPLEMENTATION ........................................................................................
26
4.1 CODING ........................................................................................................................
27
4.1.1 Login Code ............................................................................................................
27
4.1.1.1 Java Code ........................................................................................................
27
4.1.1.2 XML Code ...................................................................................................... 33
4.1.1.3 PHP Code ........................................................................................................
36
4.1.2 Sign up Code ......................................................................................................... 38
4.1.2.1 Java Code ........................................................................................................
38
4.1.2.2 XML Code ...................................................................................................... 45
VII
4.1.2.3 PHP Code .......................................................................................................
49
4.1.3 Keep me login Code ..............................................................................................
51
4.1.3.1 Java Code ........................................................................................................
51
4.1.4 Products Display Code .......................................................................................... 53
4.1.4.1 Response model.java ......................................................................................
53
4.1.4.2 api Controller.java ..........................................................................................
55
4.1.4.3 adapter.java ....................................................................................................
57
4.1.4.4 apiset.java .......................................................................................................
59
4.1.4.5 singlerowdesigne.xml .....................................................................................
60
4.1.5 Take Order Code .................................................................................................. 62
4.1.5.1 CustomerInfo.java ..........................................................................................
62
4.1.6 Overall order summary Code ............................................................................... 67
4.1.6.1 OrderComplete.java ......................................................................................
67
VIII
5.1.3 Test Case: Customer Order ....................................................................................
71
5.1.4 Test Case: Complete Registration ..........................................................................
72
5.2 SCREENSHOTS ..........................................................................................................
74
5.2.1 Login Form .............................................................................................................
74
5.2.2 Device List Page .....................................................................................................
75
5.2.3 Order Form .............................................................................................................
76
5.2.4 Complete Order ......................................................................................................
77
GLOSSARY ................................................................................................................................
78
IX
LIST OF TABLES
Table 2.1: Admin Login .................................................................................................................
8
Table 2.2: Customer Login ............................................................................................................
9
Table 2.3: Order Taker Login ........................................................................................................
9
Table 2.4: Transactions ................................................................................................................
10
Table 2.5: Track Orders ...............................................................................................................
10
Table 2.6: Complete Order ..........................................................................................................
11
Table 2.7: Description of Admin Use Case in Fully Dressed Format ..........................................
15
Table 5.1: Test Case Login ..........................................................................................................
69
Table 5.2: Test Case Admin Change Order Status ......................................................................
70
Table 5.3: Test Case: Customer Order ........................................................................................ 71
Table 5.4: Test Case: Complete Registration ..............................................................................
72
X
LIST OF FIGURES
Figure 2.1: Use Case of Admin Login .........................................................................................
11
Figure 2.2: Use Case of Customer Login .....................................................................................
12
Figure 2.3: Use Case of Order Taker ...........................................................................................
13
Figure 2.4: Description of Admin Use Case in Fully Dressed Format ....................................... 16
Figure 3.1: System Sequence Diagram of Admin Login .............................................................
20
Figure 3.2: System Sequence Diagram of Registered Login .......................................................
21
Figure 3.3: Class Diagram ...........................................................................................................
22
Figure 3.4: Entity Relationship Diagram (ERD) .........................................................................
23
Figure 3.5: ERD of Admin ..........................................................................................................
24
Figure 3.6: ERD of Customer ..................................................................................................... 25
XI
Figure 5.1: Login Form ............................................................................................................... 74
Figure 5.2: Device List Page ....................................................................................................... 75
Figure 5.3: Order Form ................................................................................................................
76
Figure 5.3: Complete Order .........................................................................................................
77
XII
CHAPTER-1
SOFTWARE REQUIREMENT SPECIFICATION
1
1.1 INTRODUCTION
Today the world is totally moving on internet, everything is internet dependent. E-commerce
(electronic commerce) is the buying and selling of goods and services, or the transmitting of funds
or data, over an electronic network, primarily the internet. These business transactions occur either
as business-to-business (B2B), business-to-consumer (B2C), consumer-to-consumer or consumer-
to-business. The terms e-commerce and e-business are often used interchangeably. The term e-tail
is also sometimes used in reference to the transactional processes that make up online retail
shopping.
In the last decade, widespread use of e-commerce platforms such as Amazon and eBay have
contributed to substantial growth in online retail. In 2007, e-commerce accounted for 5.1% of total
retail sales; in 2019, e-commerce made up 16.0%.
E-commerce is powered by the internet, where customers can access an online store to browse
through, and place orders for products or services via their own devices.
1.2 BACKGROUD
Our project is designed to serve people. The customers from all over the region are allowed to
get anything related to mobile at their doorstep easily. Everything is just one click away from this
modern internet world. Our project is very useful for all type of people. We have a wide range of
electronics items and accessories for our customers to buy online and deliver the product to their
doorstep. In Pakistan infect in all over the world online stores are becoming successful day by day.
Our platform makes the transactions easier for the customers by offering COD (Cash on Delivery)
and Payment through Debit/Credit cards. This Mobile Application is basically providing all the
variety of electronic devices and their accessories to our customers and delivered at their doorstep.
2
sites that sells products. The benefits of online shopping with the increase of internet usage, the
internet has impacted and taken over our society today. We use the internet for almost everything
including; communication, shopping, world news, and even school. Booking a flight or a hotel via
the internet has become the way to go to save money and time.
a. Better prices
It’s a fact that you can get better prices and cheaper deals if you are shopping online. This is
because the product will come directly to you from the seller or manufacturer; there are no
middlemen involved. Yet another reason is the existing competition from other rival sites. If your
store does not stock what the customer wants, they will simply browse for another website that
offers a better competitive price and the electronic gadget or product they want.
3
b. Thorough product information
It is another significant benefit of buying electronics products online. When you shopping online,
you know an in-depth knowledge of the products. You can see instructions, manufacturer details,
demonstrations, quality evaluation, safety process, and much more.
Thus, with complete customers’ data, it becomes a lot easier to compare the items and choose
the right one. Moreover, customers and users can rate the items and comment on their experience
too. Such reviews are extremely helpful to first-time purchasers. They can come to a conclusion
before selecting a product and paying for it.
c. Better variety
Search for one thing and you would see a list of a number of an online store providing the same
items or similar items. The sea of the online market has innumerable products to provide you. Name
it and you would find it. You can select from most popular brands such as Apple, Samsung, Dell,
Panasonic, and Sony. Buy anything you want like cell phones, laptops, video games, lights, musical
instruments, digital cameras, headsets, monitors, and microphones. Shopping electronic online does
not just save your money but, here, you can find items that you might not at an offline store.
e. Better convenience
One of the main advantages of shopping electronics products online is convenience. For example,
if you drive to a retail store to buy a TV, you will end up in the hassle of lifting the TV to get it
placed in your car. Shopping online solves all these difficulties. You can purchase the television
online, relaxing in your home, and get it delivered to your doorsteps. Besides, an online store is
4
available 24x7x365 days a year, so you can shop for your favorite electronics products even in the
middle of the night.
g. Discount deals
In the era of a cut-throat competition of electronics stores, every business would want its best-
selling with various marketing strategies. Providing discount rates and promotional deals are some
of those marketing and selling strategies. so, never miss a chance to avail such discounted benefits.
1.7 OBJECTIVE
Mobile application development or mobile development is a boon in itself, as it makes our
daily life easy and fastens the time of delivery of work. There are numerous objectives, but here are
a few which I would like to highlight.
Mobile apps have been around for years now, but it seems like businesses are always finding
new ways to utilize and benefit from them. What does your company get out of having a mobile app
for your loyal customers? Brand awareness is always a big draw for people, but there’s a lot more
you can get out of your mobile app experience.
5
Whether you’re building enterprise apps, retail apps, or something just for fun, there’s always
some business objective or goal your app can help fulfil.
1.8 MISSION
Our mission is to provide best quality products to our valuable customers. We deal in various
kind of products like accessories, smartphones etc., Our customers should satisfy with our top-
quality products and spread quality to all over the world.
1.10 SUMMARY
Our project is based on mobile application for electronic items online store. We provide best-
selling products to our customers; we have two categories in our store one is for Accessories shop
and other is Electronic Devices shop. Choice is totally depended on customer which thing will be
suitable for them. Our main vision is to provide best quality products and reached to them safely
and easily.
6
CHAPTER-2
REQUIREMENT ANALYSIS & FEASIBILITY STUDY
7
2.1 STAKEHOLDERS
A Stakeholder is a person, or a group that has interest in an organization’s activity. There are
many different stakeholders in E-commerce. Some of the main stakeholders are the buyers,
designers, companies and competitors. They can affect or be affected by E-commerce.
8
2.3.2 Customer Login
Customer logins to the system by entering valid user id and password for the shopping.
9
Table 2.3 OREDER TAKER LOGIN
2.3.4 Transactions
Transaction is a payment method in which the transfer of money of buying products. This
process is secure and password protected. Three steps involved in the online transaction are
Registration, Placing an order, and, Payment.
Online Payments Payments through online wallets i.e., Jazz Cash, Easy Paisa
etc.
Card Payments Payments through debit card, credit card, master card etc.
Cash On Delivery (COD) Payments done by hand after delivering the product at door
step.
Tracking Number The number that is given to the customers after completing
their orders for tracking.
Track the Order Customer will track their order by using tracking number and
knows the latest location of their order.
Product Location The location of the order can be found through tracking order
with tracking number.
10
A confirmation message sent to the customers after delivering the product to their hands
and get the acknowledgement from the customer to our delivery department.
Complete Order The customers complete their order from the shop.
Verify Order The order takers verify the order from the customer.
Deliver Order After the verification order is proceeded for the delivery.
11
FIG 2.1 USE CASE OF ADMIN LOGIN
2.4.2 Customer
Customers log in to the store with valid email and password. Customers choose the
product from list if they want to buy any product, they will drop that product in the bucket and
continue their shopping to buy more products if they want to after completing their products
they will proceed to the billing and delivery option from the bucket menu and enter their
address. Payment option is also chosen by customers cash on delivery and card options are
available in our store.
12
FIG 2.2 USE CASE OF CUSTOMER LOGIN
13
FIG 2.3 USE CASE OF ORDER TAKER
14
specific IT support
Purpose Manage the stock of products, add new products, remove old
products, update the products
Priority High
Condition Login password of the admin register
CUSTOMER
15
ORDER TAKER
DIAGRAM
16
FIG 2.4 DESCRIPTION OF ADMIN USE CASE IN FULLY DRESSED
FORMAT
2.6 NON-FUNCTIONAL REQUIREMENTS
17
2.6.1 User Interface
Our mobile application has a menu button in the top left corner with Top searched and
latest devices trending displays on front page, in the menu button categories of electronic devices
and accessories are listed the customer select the required category and explore the products. Our
app has a very user-friendly display to make it easy to use for our customers.
18
iv. Availability of online shop
The mall is open on 365 x 24 x 7. So, time does not act as a barrier, wherever the vendor and
buyers are.
v. Online tracking
Online consumers can track the order status and delivery status tracking of shipping is also
available.
19
CHAPTER-3
DESIGN
20
FIG 3.1 SYSTEM SEQUENCE DIAGRAM OF ADMIN LOGIN
3.2 System Sequence Diagram of Registered Login
21
FIG 3.2 SYSTEM SEQUENCE DIAGRAM OF USER LOGIN
22
FIG 3.2 CLASS DIAGRAM
23
FIG 3.4 ENTITY RELATIONSHIP DIAGRAM (ERD)
24
FIG 3.5 ERD OF ADMIN
25
FIG 3.6 ERD OF CUSTOMER
26
CHAPTER-4
IMPLIMENTATION
4.1 CODING
27
4.1.1 Login Code
4.1.1.1 Java code
package com.example.retro4demo;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
28
import java.util.Map;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_final);
sharedPreferences = getSharedPreferences("UserInfo",
Context.MODE_PRIVATE);
email = findViewById(R.id.email);
password = findViewById(R.id.password);
loginstate = findViewById(R.id.checkbox);
login = findViewById(R.id.login);
register = findViewById(R.id.register);
register.setOnClickListener(new View.OnClickListener()
{
29
@Override
public void onClick(View view)
{
startActivity(new Intent(FinalActivity.this, RegisterActivity.class));
finish();
}
});
login.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
String txtEmail = email.getText().toString();
String txtPassword = password.getText().toString();
if(TextUtils.isEmpty(txtEmail) || TextUtils.isEmpty(txtPassword))
{
Toast.makeText(FinalActivity.this, "All Fields Required",
Toast.LENGTH_SHORT).show();
}
else
{
login(txtEmail,txtPassword);
}
}
});
String loginStatus =
sharedPreferences.getString(getResources().getString(R.string.prefLoginState),"");
30
if(loginStatus.equals("loggedin"))
{
startActivity(new Intent(FinalActivity.this, AppStartActivity.class));
}
31
editor.putString(getResources().getString(R.string.prefLoginState),"loggedin");
}
else
{
editor.putString(getResources().getString(R.string.prefLoginState),"loggedout");
}
editor.apply();
}
else
{
progressDialog.dismiss();
Toast.makeText(FinalActivity.this, response,
Toast.LENGTH_SHORT).show();
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
progressDialog.dismiss();
Toast.makeText(FinalActivity.this, error.toString(),
Toast.LENGTH_SHORT).show();
32
}
})
{
@Override
protected Map<String, String> getParams() throws AuthFailureError
{
param.put("email", email);
param.put("psw", password);
return param;
};
request.setRetryPolicy(new DefaultRetryPolicy(30000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACK
OFF_MULT));
MySingleton.getmInstance(FinalActivity.this).addToRequestQueue(request);
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
33
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
if (id == R.id.signup)
{
return super.onOptionsItemSelected(item);
}
34
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".FinalActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:gravity="center"
android:textSize="24dp"
android:textStyle="bold"
android:textColor="@color/colorPrimaryDark"
android:layout_marginTop="20dp" />
<ImageView
android:id="@+id/logo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:src="@drawable/fyp_logo_1" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
35
android:padding="5dp"
android:textColor="@color/colorPrimaryDark" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="5dp"
android:textColor="@color/colorPrimaryDark" />
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Keep me logged in"
android:textColor="@color/colorPrimaryDark"
android:buttonTint="@color/colorPrimaryDark"
android:layout_gravity="center"
android:layout_marginTop="10dp" />
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textAllCaps="false"
android:layout_gravity="center"
36
android:backgroundTint="@color/cardview_shadow_end_color"
android:textColor="@color/colorPrimaryDark"
android:layout_marginTop="20dp" />
<TextView
android:id="@+id/register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="You don't have an Account\nSignup here"
android:gravity="center"
android:textSize="14sp"
android:textColor="@color/colorPrimary"
android:layout_marginTop="5dp" />
</LinearLayout>
require "conn.php";
$email = $_POST["email"];
$password = $_POST["psw"];
$isValidEmail = filter_var($email,FILTER_VALIDATE_EMAIL);
if($conn)
{
37
{
echo "This Email is not valid";
}
else
{
if(mysqli_num_rows($usernameQuery)>0){
}
else
{
echo "Wrong Password";
}
}
else
{
38
}
}
else
{
echo "Connection Error";
}
?>
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
39
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
userName = findViewById(R.id.username);
email = findViewById(R.id.email);
password = findViewById(R.id.password);
mobile = findViewById(R.id.mobile);
radioGroup = findViewById(R.id.radiogp);
register = findViewById(R.id.register);
40
textlogin = findViewById(R.id.textlogin);
register.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if(TextUtils.isEmpty(txtUserName) || TextUtils.isEmpty(txtEmail) ||
TextUtils.isEmpty(txtPassword) || TextUtils.isEmpty(txtMobile))
{
Toast.makeText(RegisterActivity.this, "All Fields Required",
Toast.LENGTH_SHORT).show();
}
else
{
int genderId = radioGroup.getCheckedRadioButtonId();
RadioButton selected_Gender = radioGroup.findViewById(genderId);
if(selected_Gender == null)
{
Toast.makeText(RegisterActivity.this, "Select Gender Please",
Toast.LENGTH_SHORT).show();
}
else
{
41
String selectGender = selected_Gender.getText().toString();
registerNewAccoutn(txtUserName,txtEmail,txtPassword,txtMobile,selectGender);
}
}
}
});
textlogin.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
startActivity(new Intent(RegisterActivity.this,FinalActivity.class));
finish();
}
});
42
progressDialog.show();
String uRl = "http://192.168.1.105/loginregister/register.php";
StringRequest request = new StringRequest(Request.Method.POST, uRl, new
Response.Listener<String>() {
@Override
public void onResponse(String response)
{
if(response.equals("Successfully Registered"))
{
progressDialog.dismiss();
Toast.makeText(RegisterActivity.this, response ,
Toast.LENGTH_SHORT).show();
startActivity(new Intent(RegisterActivity.this,FinalActivity.class));
finish();
}
else
{
progressDialog.dismiss();
Toast.makeText(RegisterActivity.this, response ,
Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
progressDialog.dismiss();
Toast.makeText(RegisterActivity.this, error.toString() ,
Toast.LENGTH_SHORT).show();
43
}
})
{
@Override
protected Map<String, String> getParams() throws AuthFailureError
{
}
};
request.setRetryPolicy(new DefaultRetryPolicy(30000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACK
OFF_MULT));
MySingleton.getmInstance(RegisterActivity.this).addToRequestQueue(request);
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
44
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
int id = item.getItemId();
if (id == R.id.signin)
{
Intent intent = new Intent(getApplicationContext(),FinalActivity.class);
startActivity(intent);
finish();
return true;
}
if (id == R.id.home)
{
if (id == R.id.signout)
{
45
editor.putString(getResources().getString(R.string.prefLoginState), "loggedout");
editor.apply();
startActivity(new Intent(RegisterActivity.this, MainActivity.class));
finish();
return super.onOptionsItemSelected(item);
}
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Register new Account"
46
android:gravity="center"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@color/colorPrimaryDark"
android:layout_marginTop="20dp" />
<ImageView
android:id="@+id/logo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:src="@drawable/fyp_logo_1" />
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="user Name"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="5dp"
android:textColor="@color/colorPrimaryDark" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:layout_marginTop="10dp"
47
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="5dp"
android:textColor="@color/colorPrimaryDark" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="5dp"
android:textColor="@color/colorPrimaryDark" />
<EditText
android:id="@+id/mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="5dp"
android:textColor="@color/colorPrimaryDark" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
48
android:id="@+id/radiogp" >
<RadioButton
android:id="@+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:textColor="@color/colorPrimaryDark"
android:buttonTint="@color/colorPrimaryDark" />
<RadioButton
android:id="@+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"
android:textColor="@color/colorPrimaryDark"
android:buttonTint="@color/colorPrimaryDark" />
</RadioGroup>
<Button
android:id="@+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Register"
android:textAllCaps="false"
android:layout_gravity="center"
android:backgroundTint="@color/cardview_shadow_end_color"
android:textColor="@color/colorPrimaryDark"
android:layout_marginTop="20dp" />
49
<TextView
android:id="@+id/textlogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="You have already an Account\nSignin here"
android:gravity="center"
android:textSize="14sp"
android:textColor="@color/colorPrimary"
android:layout_marginTop="5dp" />
</LinearLayout>
</RelativeLayout>
$username = $_POST["username"];
$email = $_POST["email"];
$password = $_POST["psw"];
$mobile = $_POST["mobile"];
$gender = $_POST["gender"];
$isValidEmail = filter_var($email,FILTER_VALIDATE_EMAIL);
if($conn)
{
if(strlen($password)>40 || strlen($password)<6)
{
echo "Password must be less than 40 and more than 6 characters";
}
50
else if($isValidEmail === false)
{
echo "This Email is not valid";
}
else
{
if(mysqli_num_rows($usernameQuery)>0)
{
echo "User name is already used, type another one";
}
else if(mysqli_num_rows($usernameQuery))
{
echo "This Email is already used, type another Email";
}
else
{
VALUES('$username','$email','$password','$mobile','$gender')";
51
if(mysqli_query($conn,$sql_register))
{
echo "Successfully Registered";
}
else
{
echo "Failed to register";
}
}
else
{
echo "Connection Error";
}
?>
import android.content.Context;
import com.android.volley.Cache;
import com.android.volley.Network;
import com.android.volley.Request;
52
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.BasicNetwork;
import com.android.volley.toolbox.DiskBasedCache;
import com.android.volley.toolbox.HurlStack;
import com.android.volley.toolbox.Volley;
return mRequestQueu;
53
}
return mInstance;
}
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
54
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.security.AccessController;
import java.util.List;
@NonNull
@Override
public myviewholder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType)
{
View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.singlerowdesign,parent,false);
return new myviewholder(view);
55
@Override
public void onBindViewHolder(@NonNull myviewholder holder, int position)
{
holder.t1.setText(data.get(position).getName());
holder.t2.setText(data.get(position).getDescription());
Glide.with(holder.t1.getContext()).load("http://192.168.1.105/api/images/" +
data.get(position).getImage()).into(holder.img);
holder.p1.setText(data.get(position).getPrice());
}
}
@Override
public int getItemCount()
{
56
return data.size();
}
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
apiController()
{
retrofit = new Retrofit.Builder()
.baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
57
return clientobject;
apiset getapi()
{
return retrofit.create(apiset.class);
}
4.1.4.3 adapter.java
package com.example.retro4demo;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.security.AccessController;
import java.util.List;
58
public class adapter extends RecyclerView.Adapter<adapter.myviewholder>
{
@NonNull
@Override
public myviewholder onCreateViewHolder(@NonNull ViewGroup parent, int
viewType)
{
View view =
LayoutInflater.from(parent.getContext()).inflate(R.layout.singlerowdesign,parent,false);
return new myviewholder(view);
@Override
public void onBindViewHolder(@NonNull myviewholder holder, int position)
{
holder.t1.setText(data.get(position).getName());
holder.t2.setText(data.get(position).getDescription());
59
Glide.with(holder.t1.getContext()).load("http://192.168.1.105/api/images/" +
data.get(position).getImage()).into(holder.img);
holder.p1.setText(data.get(position).getPrice());
}
}
@Override
public int getItemCount()
{
return data.size();
}
4.1.4.4 apiset.java
60
package com.example.retro4demo;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.GET;
4.1.4.5 singlerowdesigne.xml
<ImageView
android:id="@+id/img"
android:layout_width="150dp"
61
android:layout_height="150dp"
android:layout_gravity="left"
android:src="@color/colorPrimary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/t1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Name"
android:textStyle="bold"
android:textSize="30sp" />
<TextView
android:id="@+id/t2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Description"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
62
<TextView
android:id="@+id/rs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:text="Rs: "
android:textStyle="bold"
android:textSize="25sp" />
<TextView
android:id="@+id/p1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:text="Price"
android:textSize="25sp" />
</LinearLayout>
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ADD TO CART"
android:textSize="25dp"
android:layout_marginLeft="10dp"
android:linksClickable="true"
63
android:padding="10dp" />
</LinearLayout>
</androidx.appcompat.widget.LinearLayoutCompat>
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
64
public class CustommerInfo extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custommer_info);
name = findViewById(R.id.name);
address = findViewById(R.id.address);
phone_1 = findViewById(R.id.phone_1);
phone_2 = findViewById(R.id.phone_2);
radioGroup = findViewById(R.id.radiogp);
submit = findViewById(R.id.submit);
submit.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
if(TextUtils.isEmpty(txtName) || TextUtils.isEmpty(txtAddress) ||
TextUtils.isEmpty(txtPhone_1) || TextUtils.isEmpty(txtPhone_2))
{
Toast.makeText(CustommerInfo.this, "All Fields Required",
Toast.LENGTH_SHORT).show();
}
else
{
int payMethod = radioGroup.getCheckedRadioButtonId();
RadioButton selected_Method = radioGroup.findViewById(payMethod);
65
if(selected_Method == null)
{
Toast.makeText(CustommerInfo.this, "Select chhose your payment
Method", Toast.LENGTH_SHORT).show();
}
else
{
String selectMethod = selected_Method.getText().toString();
registerNewAccoutn(txtName,txtAddress,txtPhone_1,txtPhone_2,selectMethod);
}
}
}
});
private void registerNewAccoutn(final String name, final String address, final String
phone_1, final String phone_2, final String pay_method)
{
66
@Override
public void onResponse(String response)
{
if(response.equals("Successfully Order Complete"))
{
progressDialog.dismiss();
Toast.makeText(CustommerInfo.this, response ,
Toast.LENGTH_SHORT).show();
startActivity(new Intent(CustommerInfo.this,OrderComplete.class));
finish();
}
else
{
progressDialog.dismiss();
Toast.makeText(CustommerInfo.this, response ,
Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
progressDialog.dismiss();
Toast.makeText(CustommerInfo.this, error.toString() ,
Toast.LENGTH_SHORT).show();
}
})
{
@Override
protected Map<String, String> getParams() throws AuthFailureError
{
67
param.put("pay_method", pay_method);
return param;
}
};
request.setRetryPolicy(new DefaultRetryPolicy(30000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACKO
FF_MULT));
MySingleton.getmInstance(CustommerInfo.this).addToRequestQueue(request);
//
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
68
setContentView(R.layout.activity_order_complete);
nam = findViewById(R.id.nam);
addres = findViewById(R.id.addres);
phon = findViewById(R.id.phon);
nam.setText(username);
addres.setText(address);
phon.setText(phone);
}
}
69
CHAPTER-5
TESTING
70
(Error message Displayed
should be
displayed)
3 Password is Blank Enter the user Message Pass
Password (Error Displayed
message should be
displayed)
4 Wrong ID This ID is invalid Message Pass
(Error message Displayed
should be
displayed)
5 Wrong Password Password is Message Pass
incorrect. Please Displayed
Enter valid
Password (Error
message should be
displayed)
6 Press Forget Forget Password Forget Password Pass
Password Button Form should be Form displayed
displayed
7 Correct User ID The main form The main form is Pass
and Password should be displayed and
displayed and login save in database
history data should
be saved on
database
71
5.1.2 Test Case: Admin Change Order Status
72
Test Case Action Expected Actual Pass/Fail
ID Output Output
73
Test Case Action Expected Actual Pass/Fail
ID Output Output
74
5.2 SCREENSHOT
5.2.1 Login Form
75
FIG 5.1 LOGIN FORM
76
FIG 5.2 DEVICE LIST PAGE
5.2.3 Order Form
77
FIG 5.3 ORDER FORM
5.2.4 Complete Order
78
FIG 5.4 COMPLETE ORDER
GLOSSARY
Our mobile application is basically a platform where all the electronic devices like mobile
79
phones, tablets, iPad etc. are available for sale and accessories for all kind of smart devices like
adapters, cables, earphones etc. are available for our customers to purchase online through their
mobile phones and deliver it to their doorstep.
80