You are on page 1of 94

E-COMMERCE FOR ELECTRONIC

DEVICES APPLICATION
By

AHMAD RAZA 2020-GCUF-071632

FAISAL ALI 2020-GCUF-071626

MUHAMMAD HASHIM YASIN 2020-GCUF-071636

Project is submitted in partial fulfillment of the


requirements for the degree of

ASSOCIATE DEGREE
IN
COMPUTER SCIENCE

DEPARTMENT OF COMPUTER SCIENCE

GOVERNMENT COLLEGE UNIVERSITY, FAISALABAD


2022
DECLARATION

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 ................................

Member of Supervisory Committee


Signature .......................................................
Name .............................................................
Designation with Stamp ................................

Member of Supervisory Committee


Signature .......................................................
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

CHAPTER-1 SOFTWARE REQUIREMENT SPECIFICATION ........................................ 1


1.1 INTRODUCTION ............................................................................................................
2
1.2 BACKGROUND ..............................................................................................................
2
1.3 THE PURPOSE OF THE PROJECT ...............................................................................
2
1.4 THE SCOPE OF THE PROJECT .....................................................................................
3
1.5 REASONS TO DEVELOP ONLINE ELECTRONIC STORE .......................................
3
1.6 FEATURES OF MOBILE APPLICATION .....................................................................
5
1.7 OBJECTIVE .....................................................................................................................
5
1.8 MISSION ..........................................................................................................................
6
1.9 DEVELOPED APPLICATION ........................................................................................
6
1.10 SUMMARY ......................................................................................................................
6
CHAPTER-2 REQUIREMENT ANALYSIS & FEASIBILITY STUDY ...............................
7
2.1 STAKEHOLDERS ............................................................................................................
8
2.2 FUNCTIONAL REQUIREMENTS ..................................................................................
8
2.3 FUNCTIONAL REQUIRMENTS TABLE .......................................................................
8
2.3.1 Requirement Name: Admin Login ..............................................................................
8

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

CHAPTER-5 TESTING .............................................................................................................


68
5.1 TEST CASES ...............................................................................................................
69
5.1.1 Test Case: Login ....................................................................................................
69
5.1.2 Test Case: Admin Change Order Status .................................................................
70

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.

1.3 THE PURPOSE OF THE PROJECT


E-Commerce is developing day by day all over the world. Marketing. Of course, the main task
of mobile e-commerce apps is to sell the product, but sometimes the focus is not only on these clear
tasks but also on marketing. The point is to promote the product as efficiently as possible with the
help of an application. Online shopping and visiting an online shop enable the customer to search,
find, order and pay for the products, information and services that they need. To be able to do
online shopping, one must visit an online shop, like a website or an account in the social networking

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.

1.4 THE SCOPE OF THE PROJECT


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. Shopping online is
fast growing to be part of our everyday lives. Increasingly people are using the convenience of
online shopping due to people having computers in the home along with high-speed connection.

1.5 REASONS TO DEVELOP ONLINE ELECTRONICS STORE


Electronics products seem to be the big winners when it comes to online sales. From mobile
phones and headphones to tablets and even hard drives, the best electronic products are now
available online. Several surveys have proved that customers who shopped online were far more
satisfied than those who did from a walk-in store.
We think that some real-life examples will help you understand better. So, here are some of the
benefits that our client received due to the online laundry business – Electronic store.

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.

d. Less compulsive shopping


More often than not people go out and shopping stuff compulsively that they don’t really need.
This is all because salesperson uses their selling skills or pressure customers to make those
purchases. But such a scenario will never appear in the case of online shopping. You can take all the
time you want to purchase something.

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.

f. Send out gifts more easily


Sending gifts to pals or family members will be much easier, despite where they are. Be it
wedding events, Daddy’s Day, Mommy’s Day, anniversaries, or other special occasions, you could
go shopping electronics products online as well as send them to your loved ones straight

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.6 FEATURES OF MOBILE APPLICATION


Our mobile application has all the latest electronic devices like Mobile phone, Tablets, Laptops
etc. and all the electronic devices accessories like adapters, chargers, cables, earphone etc. Our
mobile application has all the electronic equipment’s related to smart phone that are used in our
daily life. Our mobile application is very simple to use, it has very good and attractive speed runs
smoothly on all devices, excellent image resolution is provided in our mobile application, and the
most important thing is security. We provide best security in our mobile application to satisfy our
customers.

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.9 DEVELOPED APPLICATION


An app is the common slang term for a software application or software program that can be
run on a computer device to accomplish a task; namely, to accomplish it easier and more efficiently
than we could do it ourselves as mere mortals. If you have a smartphone or computer tablet, you
probably have used some game apps, news apps, or even map apps to help you find the local coffee
shop. Application development is the name of the profession that employs people who design,
develop, and deploy these computer applications.
Application developers have a computer programming background. As you might imagine, the
reason it's called application development instead of just computer programming is because there
are many more steps involved before and after the actual writing of the computer program. All of
those steps are very typical and are collectively called a systems development lifecycle.

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.

2.2 FUNCTIONAL REQUIREMENTS


The System must provide following functionalities.
 Keeping records of admission of customers.
 Keeping the records of products.
 Keeping the daily sell.
 Storing the feedback given by customers.
 Keeping details about the product as it is delivered or not etc.
 Storing the items selected by the customers in the temporary storage.

2.3 FUNCTIONAL REQUIREMENTS TABLE


2.3.1 Admin Login
Admin logins to the system by entering valid user id and password for managing Orders &
Products and look for the products listing.

Sign In Admin logs in to their account with authorized id & password.


Manage Records Admin manages all the records of stocks, products, orders & deliveries
Manage Stock Admin manages the stocks. Checks the remaining stock of all products.
Add items Admin adds new items into the store if required.
Remove items Admin remove the items from the store that are out of stock or short.
Sign out After completing all work admin logs out from their account.

Table 2.1 ADMIN LOGIN

8
2.3.2 Customer Login
Customer logins to the system by entering valid user id and password for the shopping.

Sign up New customers sign up to register themselves.


Sign in Existing or Registered customers sign in with their valid account.
Search item Customers Search items that they are looking for.
Add to cart Customers add the item to cart they buy and continue shopping if they
want to after completing their shopping, they will confirm their all
products for the delivery from the bucket.
Give Information Customers will provide their address and complete contact information
where they want to deliver the products.
Sign out After completing their shopping customers will logs out from their
account.

Table 2.2 CUSTOMER LOGIN

2.3.3 Order Taker Login


Order taker log on with their valid and authorized id and password. The order taker
receives the order from customer and ready that product for the delivery, after taking the order
from the customer that ordered product will be checked and out for the delivery to our
customer.

Sign up New Employees will have to register their self.


Sign in Existing or Registered employees sign in with their valid account.
Checks order Order Takers checks the queued orders regularly and get them ready for
the delivery.
Verification Order Takers verify the products from the customers and then kick out
the orders for delivery
Sign out After completing their work order takers will logs out from their
account.

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.

Table 2.4 TRANSACTIONS

2.3.5 Track Order


When the order is out for delivery the update message sent to our customer with the
tracking number of their product, they will track and find the exact location of their product by
using tracking number.

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.

Table 2.5 TRACK ORDER

2.3.6 Complete Order

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.

Table 2.6 COMPLETE ORDER

2.4 USE CASE MODELS


2.4.1 Admin
Admin logs in to the store with valid email and password. The responsibility of admin is to
manage all the products listed in the store check the stock availability of products, check the
orders that are queued in the order box, check the delivered products, manage prices of the
products. These are all the responsibilities of administrators.

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

2.4.3 Order Taker


Order taker log on with their valid and authorized id and password. The order taker
receives the order from customer and ready that product for the delivery, after taking the order
from the customer that ordered product will be checked and out for the delivery to our
customer.

13
FIG 2.3 USE CASE OF ORDER TAKER

2.5 DESCRIPTION OF ADMIN USE CASE IN FULLY DRESSED FORMAT


TABLE
ADMIN

Participant System Administrator


Work Admin works within the functional department, which provide

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

Typical course of Action


Admin Action System Action
Enter user name and password for login Check the user’s name and password for login
Click on the login button Admin login successfully
Alternate course of Action
Admin Action System Response
After login to application first page will Error will display if user name is not correct
display.
If user name is wrong
After login to website page will display. Error will display if password is not correct
If password is wrong

CUSTOMER

Participant BUYER in the System


Work Buys Products from the E-Shop
Purpose Allows the customers to buy products from the shop
Priority High
Condition Buys products as guests and log on with their registered accounts
to buy products and avail discount for existing or old customers.

Typical course of Action


Customer Action System Response
Complete the given form of for creating new Form validation
accounts
Click on terms and condition Check terms and condition
Click on the submit button to continue Donor registered successfully and profile
page will display
Alternate course of Action
Customer Action System Response
After clicking on submit button application Error will be display. Fill all fields with
page will display correct information
If required information are not filled
After clicking on submit button application Error will be display. Enter unique E-mail
page will display. address
If E-mail already exist
After clicking on submit button application Error will display the password length should
will display be 8 or greater than 8
If password length less then 8

15
ORDER TAKER

Participant Takes Order in the system


Work Oder Taker checks the orders and get them ready for the delivery
after verification from the customers
Purpose Accepts orders from customers
Priority High
Condition Order Takers log on to the shop with their authorized account and
then manage the orders that are queued from the customers

Typical course of Action


Order Taker Action System Response
Complete the given form of for creating new Form validation
accounts
Click on terms and condition Check terms and condition
Click on the submit button to continue Acceptor registered successfully and profile
page will display
Alternate course of Action
Order Taker Action System Response
After clicking on submit button application Error will be display. Fill all fields with
page will display correct information
If required information are not filled

TABLE 2.7 DESCRIPTION OF ADMIN USE CASE IN FULLY DRESSED


FORMAT

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.

2.6.2 Fast Response Time


Our application is very active and tuned for response of customers queries. Our application
will response to the customers within sec to make it comfortable for the customers. Our application
should be fast enough to provide a good ROI (Return on Investment). The customers will ask
questions related to the products, orders they made and to know anything in our application. Our
social department will be very active and responsive to reply all the customers questions. Fast
responsive system is very important to provide best guide to our customers.

2.6.3 Ease of Use


Due to rapid growth of technology, business organizations have switched over from the
traditional method of selling goods to electronic method of selling goods. Business organizations
use internet as a main vehicle to conduct commercial transactions.
i. Convenience of online shopping
Customers can purchase items from the comfort of their own homes or work place. Shopping
is made easier and convenient for the customer through internet. It is also easy to cancel the
transactions.
ii. No pressure shopping
Generally, in physical stores, the sales representatives try to influence the buyers to buy the
product. There can be some kind of pressure, whereas the customers are not pressurized in any
way in online stores.
iii. Online shopping saves time
Customers do not have to stand in queues in cash counters to pay for the products that have
been purchased by them. They can shop from their home or work place and do not have to spend
time traveling. The customers can also look for the products that are required by them by
entering the key words or using search engines.

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.

2.6.4 Performance Requirements


Use better and high-speed smart devices to experience our app. For better performance
use the devices that have 3 GB or more Ram. Software versions of devices should be up to date for
better performance and smooth running of our app.

2.6.5 Safety Requirements


We will provide every opportunity for our customers, if the customer receives wrong
products, then they will be able to exchange the product without any delivery cost within 3 days of
receiving the parcel. The customer will cancel the product if they don’t want to buy the product or
finds the better product than ordered product within 24 hours of order placement.

2.6.6 Security Requirements


Security of our customer is the first priority for us. We did not ask for the permission of
phone call gallery and contact list from our customers to access our app. We also save the customer
personal information private and confidential in their accounts.

2.6.7 Software Quality Attributes


When the customer places an order they will be notify about the location of product
through the provided email address or text message on the provided phone number regularly by our
mobile application.

19
CHAPTER-3
DESIGN

3.1 System Sequence Diagram of Admin Login

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

3.3 CLASS DIAGRAM

22
FIG 3.2 CLASS DIAGRAM

3.4 ENTITY RELATIONSHIP DIAGRAM (ERD)

23
FIG 3.4 ENTITY RELATIONSHIP DIAGRAM (ERD)

3.4.1 ERD OF ADMIN

24
FIG 3.5 ERD OF ADMIN

3.4.2 ERD OF CUSTOMER

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;

public class FinalActivity extends AppCompatActivity


{

EditText email, password;


Button login;
TextView register;
CheckBox loginstate;
SharedPreferences sharedPreferences;

@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));
}

private void login(final String email, final String password)


{
final ProgressDialog progressDialog = new ProgressDialog(FinalActivity.this);
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(false);
progressDialog.setTitle("Signin Account");
progressDialog.show();
String uRl = "http://192.168.1.105/loginregister/login.php";

StringRequest request = new StringRequest(Request.Method.POST, uRl, new


Response.Listener<String>()
{
@Override
public void onResponse(String response)
{
if(response.equals("Login Success"))
{
progressDialog.dismiss();
Toast.makeText(FinalActivity.this, response,
Toast.LENGTH_SHORT).show();
SharedPreferences.Editor editor = sharedPreferences.edit();
if(loginstate.isChecked())
{

31
editor.putString(getResources().getString(R.string.prefLoginState),"loggedin");
}
else
{

editor.putString(getResources().getString(R.string.prefLoginState),"loggedout");
}

editor.apply();

startActivity(new Intent(FinalActivity.this, AppStartActivity.class));

}
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
{

HashMap<String,String> param = new HashMap<>();

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)
{

Intent intent = new Intent(getApplicationContext(),RegisterActivity.class);


startActivity(intent);
finish();
return true;
}

return super.onOptionsItemSelected(item);
}

4.1.1.2 XML code


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"

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>

4.1.1.3 PHP code


<?php

require "conn.php";

$email = $_POST["email"];
$password = $_POST["psw"];

$isValidEmail = filter_var($email,FILTER_VALIDATE_EMAIL);

if($conn)
{

if($isValidEmail === false)

37
{
echo "This Email is not valid";
}
else
{

$sqlCheckEmail = "SELECT * FROM users_table WHERE email LIKE '$email'";


$usernameQuery=mysqli_query($conn,$sqlCheckEmail);

if(mysqli_num_rows($usernameQuery)>0){

$sqlLogin = "SELECT * FROM users_table WHERE email LIKE


'$email' AND password LIKE '$password'";
$loginQuery = mysqli_query($conn,$sqlLogin);
if(mysqli_num_rows($loginQuery)>0)
{
echo "Login Success";

}
else
{
echo "Wrong Password";

}
}
else
{

echo "This Email is not Registered";


}

38
}

}
else
{
echo "Connection Error";
}

?>

4.1.2 Sign up Code


4.1.2.1 Java code
package com.example.retro4demo;

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;

public class RegisterActivity extends AppCompatActivity


{

EditText userName, email , password , mobile;


RadioGroup radioGroup;
Button register;
TextView textlogin;

@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)
{

String txtUserName = userName.getText().toString();


String txtEmail = email.getText().toString();
String txtPassword = password.getText().toString();
String txtMobile = mobile.getText().toString();

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();

}
});

private void registerNewAccoutn(final String username, final String email, final


String password, final String mobile, final String gender)
{

final ProgressDialog progressDialog = new ProgressDialog(RegisterActivity.this);


progressDialog.setCancelable(false);
progressDialog.setIndeterminate(false);
progressDialog.setTitle("Registering New Account");

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
{

HashMap<String,String> param = new HashMap<>();


param.put("username", username);
param.put("email", email);
param.put("psw", password);
param.put("mobile", mobile);
param.put("gender", gender);
return param;

}
};

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)
{

Intent intent = new Intent(getApplicationContext(),HomeActivity.class);


startActivity(intent);
finish();
return true;
}

final SharedPreferences sharedPreferences =


getSharedPreferences("UserInfo",MODE_PRIVATE);

if (id == R.id.signout)
{

SharedPreferences.Editor editor = sharedPreferences.edit();

45
editor.putString(getResources().getString(R.string.prefLoginState), "loggedout");
editor.apply();
startActivity(new Intent(RegisterActivity.this, MainActivity.class));
finish();

return super.onOptionsItemSelected(item);
}

4.1.2.2 XML code


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".RegisterActivity">

<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>

4.1.2.3 PHP code


<?php
require "conn.php";

$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
{

$sqlCheckUsername = "SELECT * FROM users_table WHERE username


LIKE 'Abdo'";
$usernameQuery=mysqli_query($conn,$sqlCheckUsername);

$sqlCheckEmail = "SELECT * FROM users_table WHERE email LIKE


'$email'";
$usernameQuery=mysqli_query($conn,$sqlCheckEmail);

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
{

$sql_register = "INSERT INTO


users_table(`username`,`email`,`password`,`mobile`,`gender`)

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";
}

?>

4.1.3 Keep me login Code


4.1.3.1 Java code
package com.example.retro4demo;

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;

public class MySingleton


{

private static MySingleton mInstance;


private RequestQueue mRequestQueu;
private Context mCtx;

public MySingleton(Context mCtx)


{
this.mCtx = mCtx;
mRequestQueu = getmRequestQueu();
}

public RequestQueue getmRequestQueu()


{
if(mRequestQueu == null)
{
Cache cache = new DiskBasedCache(mCtx.getCacheDir(), 1024*1024);
Network network = new BasicNetwork(new HurlStack());
mRequestQueu = new RequestQueue(cache,network);
mRequestQueu = Volley.newRequestQueue(mCtx.getApplicationContext());

return mRequestQueu;

53
}

public static synchronized MySingleton getmInstance(Context context)


{
if(mInstance == null)
{
mInstance = new MySingleton(context);
}

return mInstance;
}

public <T> void addToRequestQueue(Request<T> request)


{
mRequestQueu.add(request);
}

4.1.4 Products Display Code


4.1.4.1 Response model.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;

54
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;

import java.security.AccessController;
import java.util.List;

public class adapter extends RecyclerView.Adapter<adapter.myviewholder>


{

public View itemView;


List<responsemodel> data;
private Intent pakageContext;
View rootView;

public adapter(List<responsemodel> data)


{
this.data = data;
}

@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());

static class myviewholder extends RecyclerView.ViewHolder


{
ImageView img;
TextView t1 , t2 , p1 ;

public myviewholder(@NonNull View itemView)


{
super(itemView);
img = itemView.findViewById(R.id.img);
t1 = itemView.findViewById(R.id.t1);
t2 = itemView.findViewById(R.id.t2);
p1 = itemView.findViewById(R.id.p1);

}
}

@Override
public int getItemCount()
{

56
return data.size();
}

4.1.4.2 api Controller.java


package com.example.retro4demo;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class apiController


{
private static final String url = "http://192.168.1.105/api/";
private static apiController clientobject;
private static Retrofit retrofit;

apiController()
{
retrofit = new Retrofit.Builder()
.baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.build();
}

public static synchronized apiController getInstance()


{
if(clientobject == null)

clientobject = new apiController();

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>
{

public View itemView;


List<responsemodel> data;
private Intent pakageContext;
View rootView;

public adapter(List<responsemodel> data)


{
this.data = data;
}

@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());

static class myviewholder extends RecyclerView.ViewHolder


{
ImageView img;
TextView t1 , t2 , p1 ;

public myviewholder(@NonNull View itemView)


{
super(itemView);
img = itemView.findViewById(R.id.img);
t1 = itemView.findViewById(R.id.t1);
t2 = itemView.findViewById(R.id.t2);
p1 = itemView.findViewById(R.id.p1);

}
}

@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;

public interface apiset


{
@GET("json_user_fetch.php")
Call<List<responsemodel>> getdata();

4.1.4.5 singlerowdesigne.xml

<?xml version="1.0" encoding="utf-8"?>


<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="20dp"
android:padding="10dp"
android:onClick="addcart"
android:orientation="horizontal">

<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>

4.1.5 Take Order Code


4.1.5.1 CustomerInfo.java
package com.example.retro4demo;

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
{

EditText name, address , phone_1 , phone_2 ;


RadioGroup radioGroup;
Button submit;

@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)
{

String txtName = name.getText().toString();


String txtAddress = address.getText().toString();
String txtPhone_1 = phone_1.getText().toString();
String txtPhone_2 = phone_2.getText().toString();

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);

Intent intent = new Intent(getApplicationContext(),OrderComplete.class);


intent.putExtra("txtName",txtName);
intent.putExtra("txtAddress",txtAddress);
intent.putExtra("txtPhone_1",txtPhone_1);
startActivity(intent);

}
}

}
});

private void registerNewAccoutn(final String name, final String address, final String
phone_1, final String phone_2, final String pay_method)
{

final ProgressDialog progressDialog = new ProgressDialog(CustommerInfo.this);


progressDialog.setCancelable(false);
progressDialog.setIndeterminate(false);
progressDialog.setTitle("Please wait");
progressDialog.show();
String uRl = "http://192.168.1.105/loginregister/customerinfo.php";
StringRequest request = new StringRequest(Request.Method.POST, uRl, new
Response.Listener<String>() {

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
{

HashMap<String,String> param = new HashMap<>();


param.put("name", name);
param.put("address", address);
param.put("phone_1", phone_1);
param.put("phone_2", phone_2);

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);

//

4.1.6 Overall order summary Code


4.1.6.1 OrderComplete.java
package com.example.retro4demo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

public class OrderComplete extends AppCompatActivity {

TextView nam , addres, phon;

@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);

String username = getIntent().getStringExtra("txtName");


String address = getIntent().getStringExtra("txtAddress");
String phone = getIntent().getStringExtra("txtPhone_1");

nam.setText(username);
addres.setText(address);
phon.setText(phone);

}
}

69
CHAPTER-5
TESTING

5.1 TEST CASES


5.1.1 Test Case: Login

Test Case Action Expected Actual Pass/Fail


ID Output Output
1 User ID and Enter the user ID Message Pass
Password are Blank and Password Displayed
(Error message
should be
displayed)
2 User ID is Blank Enter the user ID Message Pass

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

TABLE 5.1 TEST CASE LOGIN

71
5.1.2 Test Case: Admin Change Order Status

Test Case Action Expected Actual Pass/Fail


ID Output Output

1 Admin Login User ID and Login Form Pass


with ID and Password is Displayed (If
Password incorrect (Error Admin enters
message should be correct ID and
displayed if Wrong Password)
ID or Password or
Both)

2 Click on Order Box form Order Box Pass


Orders Box displayed displayed

3 Change the Order Received Order is Pass


Order status to from the customer Received by
Ready to Ship order taker

4 Change the Order is Shipped to Order Shipped Pass


Order status to the customer to the Customer
Shipped

TABLE 5.2 TEST CASE ADMIN CHANGE ORDER STATUS

5.1.3 Test Case: Customer Order

72
Test Case Action Expected Actual Pass/Fail
ID Output Output

1 Customer Log in must be Log in Pass


Login with successful successfully done
valid ID and
Password
2 Create new Purchase order Purchase order Pass
purchase order must be creation
by clicking on successful successfully done
Add to Cart
button

3 Search item Enter the Item number Pass


number (Enter associated item must be added
the associated number for the successfully
item number vendor
for the vendor)

4 Save and Click the save Purchase order Pass


confirm button and creation must be
purchase order confirm the order successful

TABLE 5.3 TEST CASE CUSTOMER ORDER

5.1.4 Test Case: Complete Registration

73
Test Case Action Expected Actual Pass/Fail
ID Output Output

1 Open Log in Log in page has Log in page Pass


Page been displayed displayed

2 Click on Register Registration Registration Pass


button for the Form has been Form displayed
new users displayed

3 Register ID and Redirect to Log Log in page Pass


Password in Page after displayed on
Completing screen
Registration

4 Enter Log in data has Message Pass


valid/registered been saved to Displayed
ID and Password database

TABLE 5.4 TEST CASE COMPLETE REGISTRATION

74
5.2 SCREENSHOT
5.2.1 Login Form

75
FIG 5.1 LOGIN FORM

5.2.2 Device List Page

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

You might also like