Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 72

DELIVERY WORKFLOW

A PROJECT REPORT
Submitted in partial fulfilment for the award of the degree
of

Master of Technology
in
Information Technology
By
Madhurima Lankamalla
(15MIN0609)

Under the guidance of

Prof. Ravinder Reddy B


VIT University

School of Information Technology and Engineering

August, 2019

i
School of Information Technology and Engineering

DECLARATION BY THE CANDIDATE

I hereby declare that the thesis entitled DELIVERY WORKFLOW submitted by


me to Vellore Institute of Technology University Vellore, in partial fulfillment of the
requirement for the award of the degree of Master of Technology in Information
Technology is a record of confide project work carried out by me under the guidance of
Prof. Ravinder Reddy B. I further declare that the work reported in this project has not
been submitted and will not be submitted, either in part or in full, for the award of any
other degree or diploma in this institute or any other institute or university.

Place: HYDERABAD

Date: Signature of the Candidate

ii
School of Information Technology and Engineering

BONAFIDE CERTIFICATE

This is to certify that the project work DELIVERY WORKFLOW by Madhurima


Lankamalla (15MIN0609), to Vellore Institute of Technology University, Vellore, in
partial fulfillment of the requirement for the award of the degree of Master of Technology
in Information Technology, is a project confide work carried out by him/her under my
supervision. The project fulfills the requirement as per the regulations of this Institute and
in my opinion meets the necessary standards for submission. The contents of this report
have not been submitted and will not be submitted either in part or in full, for the award
of any other degree or diploma in this Institute or any other Institute or University.

Prof. Ravinder Reddy B


Internal Supervisor
VIT University

Internal Examiner(s) External Examiner(s)

iii
ACKNOWLEDGEMENT

This major project would have been possible without the valuable assistance of many people to
whom we are indebted. The satisfaction that accompanies the successful of any task would be
incomplete without the mention of people who made it possible whose is constant guidance of
encouragement crowned our efforts with success in various stages.

My heartfelt gratitude goes to my guide Prof. Ravinder Reddy B for his valuable and timely
help, which boomed the project to this extent.

I would like to express my sincere gratitude and thanks to Vellore Institute of Technology and
Wipro Technologies for the WISTA course and the encouragement and inspiration given throughout
the course of study.

I extend my deep sense of gratefulness to The Management and The Faculty Members of
WIPRO WISTA program for their pleasing support.

A special word of thanks is to our classmates for providing the moral support. Finally yet
importantly, I owe all the efforts to my beloved Family members and all my dear friends towards this
endeavor, which in turn changed all the obscure today an explicit tomorrow.

iv
ABSTRACT

The application Delivery Work Flow will be easily available to everyone to directly raise a complaint
(with a detailed description), issues they are facing and Address and all the required details. The Admin
will assign an Engineer for the particular job and the status of the issue will be updated in the database.

This Application is similar to other Help desk systems which will be specifically taking the electricity
related issues into consideration by taking the inputs from the user in the form of Portal and saves the
data into Database for future.

It will be an Android application where people can log their complaints and get resolution by TSSPDCL
(Telangana State Southern Power Distribution Company Limited).

v
Table of Contents

ABSTRACT .............................................................................................................................................................. v
LIST OF FIGURES............................................................................................................................................... viii
LIST OF ABBREVATIONS .................................................................................... Error! Bookmark not defined.
1. INTRODUCTION ............................................................................................................................................1
1.1. Objective.....................................................................................................................................................1
1.2. Scope ..........................................................................................................................................................1
1.3. Problem in Existing System .......................................................................................................................2
1.4. Solution ......................................................................................................................................................2
2. LITERATURE SURVEY ................................................................................................................................3
2.1. Information Gathering ................................................................................................................................3
2.2. System Feasibility ......................................................................................................................................3
2.2.1. Economical .........................................................................................................................................3
2.2.2. Technical ............................................................................................................................................3
2.2.3. Behavioral...........................................................................................................................................3
2.3. Platform Specifications ..............................................................................................................................3
3. Requirement Specification ...............................................................................................................................4
3.1. Software & Hardware Requirements:.........................................................................................................4
4. PROPOSED SYSTEM .....................................................................................................................................5
4.1. Use Case Diagrams.....................................................................................................................................5
4.1.1. Brief Description ................................................................................................................................8
4.1.2. Flow of the Event ...............................................................................................................................8
4.2. Sequence Diagrams ....................................................................................................................................9
4.3. Activity Diagram ..................................................................................................................................... 11
4.4. Class Diagram ......................................................................................................................................... 13
5. DETAILED DESIGN OF THE SYSTEM................................................................................................... 15
5.1. Architectural Design ................................................................................................................................ 15
5.2. System Design ......................................................................................................................................... 16
5.3. Data Design ............................................................................................................................................. 18
6. MODULE AND IMPLEMENTATION ...................................................................................................... 19
6.1. Coding ..................................................................................................................................................... 19

vi
7. TESTING ....................................................................................................................................................... 44
7.1. Testing ..................................................................................................................................................... 44
7.2. Testing Types .......................................................................................................................................... 44
7.3. Test Cases: ............................................................................................................................................... 47
8. RESULT - SCREENSHOTS ........................................................................................................................ 50
9. CONCLUSION AND FUTURE SCOPE ..................................................................................................... 63
[10]. REFERENCES.............................................................................................................................................. 64

vii
LIST OF FIGURES

Figure 4.1. -Admin Use Case Diagram- 1 ..................................................................................................................5


Figure 4.2. - Use Case Diagram – 2 ...........................................................................................................................6
Figure 4.3. -Use Case Diagram – 3 ............................................................................................................................7
Figure 4.4 - Sequence Diagram - 1 .............................................................................................................................9
Figure 4.5 - Activity Diagram – 1 ........................................................................................................................... 11
Figure 4.6 - Activity Diagram - 2 ............................................................................................................................ 12
Figure 4.7 - Class Diagram – 1 ................................................................................................................................ 13
Figure 4.8 - Class Diagram – 2 ................................................................................................................................ 14
Figure 5.1 - Architectural Design Diagram ............................................................................................................. 16
Figure 8.1 - Result -screenshots............................................................................................................................... 50

LIST OF TABLES
Table 1: Test Cases Part 1 ........................................................................................ Error! Bookmark not defined.
Table 2: Test Cases Part 2 ........................................................................................ Error! Bookmark not defined.
Table 3: Test Cases Part 3 ........................................................................................ Error! Bookmark not defined.

LIST OF ABBREVATIONS

ACRONYM EXPANSION

DFD Data Flow Diagram

UCD Use Case Diagram

GUI Graphical User Interface

RAM Random Access Memory

ROM Read Only Memory

viii
1. INTRODUCTION

Earlier there is no system to solve every day facing Electricity problems like Fuze down, New
Connection requests etc. But we are still doing either like going to TSSPDCL office to give a complaint
or getting the TSSPDCL (Telangana State Southern Power Distribution Company Limited) contact
number of particular branch from our neighbor’s or from someone and making the team to complete the
task. If we got the number and we call, also they will not respond clearly and we have to follow up with
them every day, which is very time consuming. To reduce these activities we are coming up with a new
application in which everything will be online and people can easily understand and resolve their issues.

Delivery Workflow (Electricity E-Complaint System) is a similar to Service or Help Desk and Delivery
Workflow application that provides the users an integrated console to raise and solve the issues that they
are facing in their everyday life and it will be maintained in a system using the Database for future
reference and it will help the team to easily resolve the issues that the people are facing.. The Delivery
Workflow is a single point of contact for the users who need help in solving the Electricity issues.

1.1. Objective

The objective of the project is to clearly identify the issues that are faced by the public in a
quick manner and easily resolve them.

1.2. Scope

Maintenance system should be mandatory for every organization to easily identify the issues and
get it resolved. Increased accuracy, reliability and efficiency of the problem solving process.
Universe development required for the project. Detailed Description of the problem with user’s
contact information and the Address will be mentioned which will be easy for the Team to
contact and reach the place.

1
1.3. Problem in Existing System

We have to follow with them every day, which is a time consuming process. The TSSPDCL
application is very slow and users are facing many issues while logging the complaint.
TSSPDCL application does not show any consistency.

1.4. Solution

DELIVERY WORK FLOW will let the users to raise their complaints sitting at home and get a
resolution rather than going to Electricity office and raising a complaint. The user just needs to
enter the required details of the issue they are facing and their address for the team to come and
resolve the issue.

2
2. LITERATURE SURVEY

System Requirement Analysis of Delivery Workflow consists of requirements that system must
have to run properly. This application is an Android application.

2.1. Information Gathering

I have visited TSSPDCL application to gather maximum information. Faculty have helped us to
making the decision in various steps of project life cycle.

2.2. System Feasibility

2.2.1. Economical
System is economical feasible and can be easily implemented with minimum hardware and
software resources as this is an Android application and the information is provided by
TSSPDCL site. Only there is a need of Internet connection and the data that need to be filtered .It
is very easy for the user to raise a complaint and get to know the status of it.

2.2.2. Technical
It is the study of the function performance and constraints that may affect the ability to achieve
an acceptable system. The project development requires Android developer to have technical
knowledge for the application development.

2.2.3. Behavioral
In the application, .sqllite file as the database. There are simple forms to fill and service requires
no ambiguous entries, all the behavioral entries are simple, and GUI based. The Application
design is very user friendly, interactive. The application should be used by consumer to raise a
complaint and be able to pay the electricity bill.

2.3. Platform Specifications


There is only one user to interact with the system that is Customer.

3
3. Requirement Specification

The main reliability requirement to develop this application, the customer can raise a complaint to
Electricity department on household issues .The following are the some of the reliability
requirements during usage of the application.

User can raise the complaint by giving the particular details like consumer No. and description of the
issue.

In number fields, we cannot enter any text values.

Duplication values are not allowed.

The Data entered by the user is stored in Database and can retrieve when it is needed.

User can check the status of the complaint and can pay the electricity bill through the application.

3.1. Software & Hardware Requirements:

Operating System : Windows 7 and above


IDE : Star UML
Language : Java
Database : SQLlite

4
4. PROPOSED SYSTEM

4.1. Use Case Diagrams

Use case diagrams are behavior diagrams used to describe a set of actions (use cases) that some
system or systems (subject) should or can perform in collaboration with one or more external users
of the system (actors).Each use case should provide some observable and valuable result to the
actors or other stakeholders of the system.

Admin

Figure 4.1. -Admin Use Case Diagram- 1

5
User

Figure 4.2. - Use Case Diagram – 2

6
Payment

Figure 4.3. -Use Case Diagram – 3

7
4.1.1. Brief Description

The use case diagram of Delivery Workflow is used to raise the complaint

4.1.2. Flow of the Event

In this current application, the process flow will be described as below by using the buttons which have been
designed on application level.

LogIn
After launching the application, User can login with the valid credentials and navigate to home page.

Assessment

After logging the ticket, the request will be in Assessment phase.

Plan Phase

When the Request is in plan phase, an engineer is assigned to the work request raised by the user

Fulfilment Phase

When the work is in progress then the admin change the status of the request to fulfilment.

Closure

When the work request raised by the user is fulfilled then the status will be closure.

8
4.2. Sequence Diagrams

A sequence diagram is a kind of interaction diagram that shows how processes operate with one
another and in what order.

A sequence diagram shows object interactions arranged in time sequence.

It depicts the objects and classes involved in the scenario and the sequence of messages exchanged
between the objects needed to carry out the functionality of the scenario.

Sequence diagrams are typically associated with use case realizations in the Logical View of the
system under development. Sequence diagrams are sometimes called event diagrams, event
scenarios.

Sequence diagram shows the sequence of the searching process.

It is simple and easy task when user submit the information database will display the information.

Admin

Figure 4.4 - Sequence Diagram - 1

9
User

Figure 4.2 - Sequence Diagram – 2

10
4.3. Activity Diagram

Activity diagrams are the object-oriented equivalent of flow charts and dataflow diagrams from
structured development. It describes the workflow behavior of a system. The process flows in the
system are captured in the activity diagram. Activity diagram illustrates the dynamic nature of a
system by modeling the flow of control from Activity to activity.

Admin

Figure 4.5 - Activity Diagram – 1

11
User

Figure 4.6 - Activity Diagram - 2

12
4.4. Class Diagram

It depicts the objects and classes involved in the scenario and the sequence of messages exchanged

between the objects needed to carry out the functionality of the scenario.

Describing the static view of the system.

Showing the collaboration among the elements of the static view.

Describing the functionalities performed by the system.

Sequence diagrams are sometimes called event diagrams, event scenarios.

Admin

Figure 4.7 - Class Diagram – 1

13
User

Figure 4.8 - Class Diagram – 2

14
5. DETAILED DESIGN OF THE SYSTEM

5.1. Architectural Design

Architectural design represents the structure and component of program complement that are

required to build a computer as well as mobile-based system.

It consists of the architectural style that system will take the structure and properties of the

components that constitute the system, and the interrelationships that occur among all

architectural component of the system.

An architecture model encompassing data architecture and program structure is created during

architectural design.

In addition, component properties and relationship (interactions) are described.

In working flow of Delivery workflow, the logged ticket raised by customer/user has four

phases- Assessment phase, Plan phase, Fulfillment phase and Closure phase. When a user logs

their ticket through application. The initial phase of the ticket will be in Assessment phase.

In plan phase, a particular engineer will be assigned to work on the request or complaint raised

by the user.

In fulfillment, phase the engineer contact the user and works according to the request raised by

the user. When the work done then the Admin changes the status of the request to Closure.

In each phase the status of the request is got updated in the Database and user can check their

status whenever they log in to the application.

User can also pay their electricity bill using the application.
15
Figure 5.1 - Architectural Design Diagram

5.2. System Design

Custom objects

Custom objects are the native components that model the data we need to store in our application

like a database table, an Android studio.

Android Studio is the official integrated development environment (IDE) for Google's Android

operating system, built on JetBrains' IntelliJ IDEA software and designed specifically for

Android development.

Database used in the Android application is SQLlite, it is saved as a .sqllite file

16
Data Concepts

As you know, the underlying architecture of the platform includes a database where your data is
stored. This means that all the information you enter is stored in that database and then retrieved
from the database whenever you view it within your app.

Historically, companies were required to buy, build, and maintain their own databases and IT
infrastructures to distribute and run their applications. Part of the simplicity the Android Studio has
in built database, SQLlite is used in the Android studio.

It is worth pointing out that although your data is stored in a database and a simple understanding of
database concepts is helpful, you do not need to be a database developer to build an app on the
platform. We will not be doing any traditional database programming in the course of developing
our app. In simple terms, a database is an organized collection of information. Common examples
include a phonebook, a library catalog, an employee directory, a catalog of the MP3s you own.

In the case of our Delivery Workflow application, Information about the consumer and the issue
details the Electricity bill details of the consumer and the status of the complaint raised by the
consumer. Typically, you use a database to collect information about people, things, or concepts that
are important to you and whatever project you are working on.

In a database, a TABLE represents each entity. A database table is simply a list of information,
presented with rows and columns, about the category of person, thing, or concept you want to track.
So in a phonebook, you might have a table to store information about residences and another table to
store information about businesses; or in a library catalog, you might have one table to store
information about books and another to store information about authors.

In our Delivery Workflow application, we will have tables to store information about
Consumer/user, Billing amount and Complaint.

17
5.3. Data Design

In our current application, we are using .sqllite file as a database.

So whenever consumer/user register in the application by providing few details, from the next
time user can login by the user name and password directly. The details provided by the user
while registration are stored in Database.

If the User raises a complaint, the ticket got logged with a unique reference no. and the data got
stored in the database.

Admin can update the status of the ticket in the application which will be updated in the database
accordingly.

18
6. MODULE AND IMPLEMENTATION

6.1. Coding

RegisterActivity.java

package com.project.semester.deliveryworkflow;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.project.semester.deliveryworkflow.Database.DatabaseHelper;
import com.project.semester.deliveryworkflow.Database.DatabaseInterface;
import com.project.semester.deliveryworkflow.Models.User;

public class RegisterActivity extends AppCompatActivity {

//Ui Reference
private EditText mNameView;
private EditText mAddressView;
private EditText mConsumerNoView;
private EditText mUserNameView;

19
private EditText mPasswordView;
private EditText mConfirmPasswordView;
static UserRegistraionManager userRegistraionManager;

String textName, textUserName, textUserAddress, textUserPassword, textUserConsumerNo;

private DatabaseHelper databaseHelper;


private User user;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);

mNameView = (EditText) findViewById(R.id.edt_name);


mAddressView = (EditText) findViewById(R.id.edt_address);
mConsumerNoView = (EditText) findViewById(R.id.edt_consumerNo);
mUserNameView = (EditText) findViewById(R.id.edt_userName);
mPasswordView = (EditText) findViewById(R.id.edt_password);
mConfirmPasswordView = (EditText) findViewById(R.id.edt_confimPassword);

userRegistraionManager = new UserRegistraionManager(RegisterActivity.this);

databaseHelper = new DatabaseHelper(RegisterActivity.this);


user = new User();

try {
DatabaseInterface.getInstance(this).getDatabaseName();

20
} catch (Exception e) {
e.printStackTrace();
}
}
//--------------------------------------------------------------------------------------------------

boolean isFieldValid(String field, int minLengthRequired) {


if (field == null)
return false;

return field.length() >= minLengthRequired ? true : false;


}
//--------------------------------------------------------------------------------------------------

boolean isValidEmail(String email) {


return email.contains("@") & email.contains(".com");
}
//--------------------------------------------------------------------------------------------------

//Do all validation here


private boolean validate() {
boolean bOk = true;
String name = mNameView.getText().toString();
String address = mAddressView.getText().toString();
String userName = mUserNameView.getText().toString();
String password = mPasswordView.getText().toString();
String confirmPassword = mConfirmPasswordView.getText().toString();
String consumerNo = mConsumerNoView.getText().toString();

if (!TextUtils.isEmpty(name) && !isFieldValid(name, 5)) {

21
mNameView.setError("Name is Too short");
mNameView.requestFocus();
bOk &= false;
}
if (!TextUtils.isEmpty(address) && !isFieldValid(address, 15)) {
mAddressView.setError("Address is Too short");
mAddressView.requestFocus();
bOk &= false;
}
if (!TextUtils.isEmpty(consumerNo) && !isFieldValid(consumerNo, 6)) {
mConsumerNoView.setError("Consumer# is Too short");
mConsumerNoView.requestFocus();
bOk &= false;
}

if (!TextUtils.isEmpty(userName) && !isFieldValid(userName, 5)) {


mUserNameView.setError("Invalid Email");
mUserNameView.requestFocus();
bOk &= false;
} else if (!isValidEmail(userName)) {
mUserNameView.setError("Invalid Email");
mUserNameView.requestFocus();
bOk &= false;
}
if (!TextUtils.isEmpty(password) && !isFieldValid(password, 5)) {
mPasswordView.setError("Password is Too short");
mPasswordView.requestFocus();
bOk &= false;
}
if (TextUtils.isEmpty(confirmPassword)) {
mConfirmPasswordView.setError("Password Mismatch");

22
mConfirmPasswordView.requestFocus();
bOk &= false;
}
if (confirmPassword != null && password != null) {
if (!confirmPassword.equals(password)) {
mConfirmPasswordView.setError("Password Mismatch");
mConfirmPasswordView.requestFocus();
bOk &= false;
}
}
return bOk;
}
//--------------------------------------------------------------------------------------------------

public void onRegister(View view) {

if (true == validate()) {

if (!databaseHelper.checkUser(mUserNameView.getText().toString().trim())) {

user.setName(mNameView.getText().toString().trim());
user.setEmail(mUserNameView.getText().toString().trim());
user.setAddress(mAddressView.getText().toString().trim());
user.setPassword(mPasswordView.getText().toString().trim());
user.setMobileNo(mConsumerNoView.getText().toString());

textName = mNameView.getText().toString();
textUserName = mUserNameView.getText().toString();
textUserConsumerNo = mConsumerNoView.getText().toString();
textUserPassword = mPasswordView.getText().toString();

23
textUserAddress = mAddressView.getText().toString();

Log.d("AllReg", "reg " + textName + textUserName + textUserConsumerNo +


textUserPassword + textUserAddress);

userRegistraionManager.createUserRegSession(textName, textUserConsumerNo,
textUserName, textUserPassword, textUserAddress);

// user = new
User(0,textName,textUserName,textUserAddress,textUserPassword,textUserConsumerNo);
databaseHelper.addUser(user);

showDialog(textUserName,true,RegisterActivity.this);

Log.v("RegisterActivity :","Saved User Details


:"+databaseHelper.getAllUser().size());

/* ConsumerDetails consumerDetails = new ConsumerDetails();


consumerDetails.setName(mNameView.getText().toString());
consumerDetails.setAddress(mAddressView.getText().toString());
consumerDetails.setPassword(mPasswordView.getText().toString());
consumerDetails.setUserName(mUserNameView.getText().toString());

consumerDetails.setConsumerNumber(Integer.parseInt(mConsumerNoView.getText().toString()
));

DatabaseInterface db = DatabaseInterface.getInstance(this);
ConsumerDac dac = new ConsumerDac(db);
try {
boolean result = dac.insertConsumerDetails(consumerDetails);

24
if (true == result) {
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(intent);
}
} catch (RuntimeException e) {

}
*/
}
else{
Toast.makeText(this, "Email Already Exists..Please Login..",
Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(intent);
// Snackbar.make(nestedScrollView, getString(R.string.error_email_exists),
Snackbar.LENGTH_LONG).show();
}
}
//--------------------------------------------------------------------------------------------------

// Code for showing dialog to the user after successfully registration.

private void showDialog(String title, Boolean type, Context context){

String setTitle;

if(!type){

25
setTitle = "<font color='#ED3439'>"+"User "+"<"+title+">"+" Register
Successfully.."+"</font>";

}else{
setTitle = "<font color='#01B0F1'>"+"User "+"<"+title+">"+" Register
Successfully.."+"</font>";

}
android.support.v7.app.AlertDialog.Builder alertDialogBuilder = new
android.support.v7.app.AlertDialog.Builder(context);
alertDialogBuilder.setCancelable(false);
alertDialogBuilder
.setTitle( Html.fromHtml(setTitle))

.setPositiveButton("Ok", new DialogInterface.OnClickListener() {


public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
dialog.dismiss();

}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

}
});

android.support.v7.app.AlertDialog alertDialog = alertDialogBuilder.create();


alertDialog.setCanceledOnTouchOutside(false);

26
alertDialog.getWindow().getAttributes().windowAnimations = R.style.DialogTheme; //style
id
alertDialog.show();

LoginActivity.java
package com.project.semester.deliveryworkflow;

import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.Context;
import android.content.CursorLoader;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;

27
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.project.semester.deliveryworkflow.Activites.MainScreenActivity;
import com.project.semester.deliveryworkflow.Database.DatabaseHelper;

import java.util.ArrayList;
import java.util.List;

import static android.Manifest.permission.READ_CONTACTS;

/**
* A login screen that offers login via email/password.
*/
public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<Cursor> {

/**
* Id to identity READ_CONTACTS permission request.
*/
private static final int REQUEST_READ_CONTACTS = 0;

/**
* Keep track of the login task to ensure we can cancel it if requested.
*/

28
// private UserLoginTask mAuthTask = null ;

// UI references.

private AutoCompleteTextView mEmailView;


private EditText mPasswordView;
private LinearLayout mLoginFormView;
private ProgressBar mProgressView;

private DatabaseHelper databaseHelper;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
// Set up the login form.
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
populateAutoComplete();

mPasswordView = (EditText) findViewById(R.id.password);


mProgressView=(ProgressBar) findViewById(R.id.progress_bar);

Button mEmailSignInButton = (Button) findViewById(R.id.btn_sign_in);

mEmailSignInButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});

29
mLoginFormView = (LinearLayout) findViewById(R.id.email_login_form);

databaseHelper = new DatabaseHelper(LoginActivity.this);

// DatabaseInterface db = DatabaseInterface.getInstance(getApplicationContext());
// ConsumerDac dac= new ConsumerDac(db);

/* try{

ConsumerDetails consumerDetails = dac.getConsumerDetails(null);

if(consumerDetails == null)
{
Intent intent = new Intent(getApplicationContext() , RegisterActivity.class);
startActivity(intent);
}
}catch(Exception e){
e.printStackTrace();
}*/

}
//-------------------------------------------------------------------------------------------------------------

private void populateAutoComplete() {


if (!mayRequestContacts()) {
return;
}
getLoaderManager().initLoader(0, null, this);
}

30
//-------------------------------------------------------------------------------------------------------------

private boolean mayRequestContacts() {


if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return true;
}
if (checkSelfPermission(READ_CONTACTS) ==
PackageManager.PERMISSION_GRANTED) {
return true;
}
if (shouldShowRequestPermissionRationale(READ_CONTACTS)) {
Snackbar.make(mEmailView, R.string.permission_rationale,
Snackbar.LENGTH_INDEFINITE)
.setAction(android.R.string.ok, new View.OnClickListener() {
@Override
@TargetApi(Build.VERSION_CODES.M)
public void onClick(View v) {
requestPermissions(new String[]{READ_CONTACTS},
REQUEST_READ_CONTACTS);
}
});
} else {
requestPermissions(new String[]{READ_CONTACTS},
REQUEST_READ_CONTACTS);
}
return false;
}
//-------------------------------------------------------------------------------------------------------------

/**
* Callback received when a permissions request has been completed.

31
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == REQUEST_READ_CONTACTS) {
if (grantResults.length == 1 && grantResults[0] ==
PackageManager.PERMISSION_GRANTED) {
populateAutoComplete();
}
}
}
//-------------------------------------------------------------------------------------------------------------

/**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/
private void attemptLogin() {

// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);

// Store values at the time of the login attempt.


String email = mEmailView.getText().toString();
String password = mPasswordView.getText().toString();

boolean cancel = false;


View focusView = null;

32
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
mPasswordView.setError(getString(R.string.error_invalid_password));
focusView = mPasswordView;
cancel = true;
}

// Check for a valid email address.


if (TextUtils.isEmpty(email)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
} else if (!isEmailValid(email)) {
mEmailView.setError(getString(R.string.error_invalid_email));
focusView = mEmailView;
cancel = true;
}

if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
// showProgress(true);
Log.v("LoginActivity :","Logging in..."+mEmailView.getText().toString().trim()+ "
"+mPasswordView.getText().toString().trim());

33
if (databaseHelper.checkUser(mEmailView.getText().toString().trim(),
mPasswordView.getText().toString().trim())) {

Log.v("LoginActivity :","Logging in...");

showDialog("User "+"<"+mEmailView.getText().toString().trim()+">"+" Login


Successfully..",true,LoginActivity.this);

} else {
// Snack Bar to show success message that record is wrong
Toast.makeText(this, "May be Password and EmailId Not Valid",
Toast.LENGTH_SHORT).show();
// Snackbar.make(nestedScrollView, getString(R.string.error_valid_email_password),
Snackbar.LENGTH_LONG).show();
}

// mAuthTask = new UserLoginTask(email, password);


// mAuthTask.execute((Void) null);
}
}
//-------------------------------------------------------------------------------------------------------------

private boolean isEmailValid(String email) {

return email.contains("@") & email.contains(".com");


}

private boolean isPasswordValid(String password) {

return password.length() > 4;


}

34
//-------------------------------------------------------------------------------------------------------------

// Code for Showing dialoge for registration Confirmation.

private void showDialog(String title, Boolean type, Context context){

String setTitle;

if(!type){
setTitle = "<font color='#ED3439'>"+title+"</font>";

}else{
setTitle = "<font color='#01B0F1'>"+title+"</font>";

}
android.support.v7.app.AlertDialog.Builder alertDialogBuilder = new
android.support.v7.app.AlertDialog.Builder(context);
alertDialogBuilder.setCancelable(false);
alertDialogBuilder
.setTitle( Html.fromHtml(setTitle))

.setPositiveButton("Ok", new DialogInterface.OnClickListener() {


public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(LoginActivity.this, MainScreenActivity.class);
startActivity(intent);
dialog.dismiss();

}
}).setNegativeButton("", new DialogInterface.OnClickListener() {
@Override

35
public void onClick(DialogInterface dialog, int which) {

}
});

android.support.v7.app.AlertDialog alertDialog = alertDialogBuilder.create();


alertDialog.setCanceledOnTouchOutside(false);
alertDialog.getWindow().getAttributes().windowAnimations = R.style.DialogTheme; //style
id
alertDialog.show();
}
/**
* Shows the progress UI and hides the login form.
*/
/* @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
// On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
// for very easy animations. If available, use these APIs to fade-in
// the progress spinner.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
int shortAnimTime =
getResources().getInteger(android.R.integer.config_shortAnimTime);

mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);


mLoginFormView.animate().setDuration(shortAnimTime).alpha(
show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
});

36
// mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
mProgressView.animate().setDuration(shortAnimTime).alpha(
show ? 1 : 0).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
} else {
// The ViewPropertyAnimator APIs are not available, so simply show
// and hide the relevant UI components.
mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
// mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
}
}*/

@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
return new CursorLoader(this,
// Retrieve data rows for the device user's 'profile' contact.
Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
ContactsContract.Contacts.Data.CONTENT_DIRECTORY),
ProfileQuery.PROJECTION,

// Select only email addresses.


ContactsContract.Contacts.Data.MIMETYPE +
" = ?", new String[]{ContactsContract.CommonDataKinds.Email
.CONTENT_ITEM_TYPE},

// Show primary email addresses first. Note that there won't be

37
// a primary email address if the user hasn't specified one.
ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}

@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
List<String> emails = new ArrayList<>();
cursor.moveToFirst();
while (!cursor.isAfterLast()) {
emails.add(cursor.getString(ProfileQuery.ADDRESS));
cursor.moveToNext();
}

addEmailsToAutoComplete(emails);
}

@Override
public void onLoaderReset(Loader<Cursor> cursorLoader) {

private void addEmailsToAutoComplete(List<String> emailAddressCollection) {


//Create adapter to tell the AutoCompleteTextView what to show in its dropdown list.
ArrayAdapter<String> adapter =
new ArrayAdapter<>(LoginActivity.this,
android.R.layout.simple_dropdown_item_1line, emailAddressCollection);

mEmailView.setAdapter(adapter);
}

38
private interface ProfileQuery {
String[] PROJECTION = {
ContactsContract.CommonDataKinds.Email.ADDRESS,
ContactsContract.CommonDataKinds.Email.IS_PRIMARY,
};

int ADDRESS = 0;
int IS_PRIMARY = 1;
}

/**
* Represents an asynchronous login/registration task used to authenticate
* the user.
*/
/*public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {

private final String mEmail;


private final String mPassword;

UserLoginTask(String email, String password) {


mEmail = email;
mPassword = password;
}

@Override
protected Boolean doInBackground(Void... params) {
// TODO: attempt authentication against a network service.

try {
// Simulate network access.
Thread.sleep(1000);

39
} catch (InterruptedException e) {
return false;
}
DatabaseInterface db = DatabaseInterface.getInstance(getApplicationContext());
ConsumerDac dac= new ConsumerDac(db);
ConsumerDetails consumerDetails = dac.getConsumerDetails(mEmail);
if(consumerDetails == null)
{
return false;
}
return consumerDetails.getPassword().equals(mPassword);
}

@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);

if (success) {
finish();

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


startActivity(intent);

} else {
mPasswordView.setError(getString(R.string.error_incorrect_password));
mPasswordView.requestFocus();
}
}

@Override

40
protected void onCancelled() {
mAuthTask = null;
showProgress(false);
}
}*/
}

RegisterComplaintActivity.java

package com.project.semester.deliveryworkflow.Activites;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.project.semester.deliveryworkflow.R;
import com.project.semester.deliveryworkflow.UserRegistraionManager;

import java.util.HashMap;
import java.util.Random;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

41
public class RegisterComplainActivity extends AppCompatActivity {

@BindView(R.id.edt_consumerName) EditText consumerName;


@BindView(R.id.edt_consumerMobileNumber) EditText consumerMobileNo;
@BindView(R.id.edt_shortDescription) EditText shortDesc;
@BindView(R.id.edt_longDescription) EditText longDescription;
@BindView(R.id.btn_RegisterComplain) Button btnRegisterComplain;

private Unbinder unbinder;

String generatedPassword = "";


static UserRegistraionManager userRegistraionManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_complain);

userRegistraionManager = new UserRegistraionManager(RegisterComplainActivity.this);

unbinder = ButterKnife.bind(this);

HashMap<String, String> user = userRegistraionManager.getUserRegDetails();


// get username
String UserName = user.get(userRegistraionManager.KEY_NAME);
String UserId = user.get(userRegistraionManager.KEY_USER_ID);

// get email
final String email = user.get(userRegistraionManager.KEY_EMAIL);
// get brandname
final String pass = user.get(userRegistraionManager.KEY_PASS);

42
// get mobile
final String mobile = user.get(userRegistraionManager.KEY_MOBILE);

Log.v("RegisterComplActivity :","user logged in saved data :" +UserName + " " +UserId+
" "+email+ " "+pass+ " "+mobile + "");

consumerName.setText(UserName);
consumerMobileNo.setText(mobile);
}
@OnClick({R.id.btn_RegisterComplain})
public void OnClick(View view) {

if (view.getId() == R.id.btn_RegisterComplain) {

GenerateRandomNumber();
// finish();
}
}
private void GenerateRandomNumber() {

Random random = new Random();


generatedPassword = String.format("%04d", random.nextInt(10000));
Toast.makeText(this,"Complain registered successfully and the Ref No is
<"+generatedPassword+">",Toast.LENGTH_LONG).show();
Intent Login = new Intent(this, MainScreenActivity.class);
startActivity(Login);
Log.d("GeneratedRandomNumber", "Random :" + generatedPassword);

}
}

43
7. TESTING

7.1. Testing
 Code has many more possible states than it has lines of code.
 For example, the following method has 4,294,967,296 different states.
 System testing of software or hardware is testing conducted on a complete, integrated system to
evaluate the system's compliance with its specified requirements.
 System testing falls within the scope of black box testing, and as such, should require no
knowledge of the inner design of the code or logic.

7.2. Testing Types

Black Box Testing


 The technique of testing without having any knowledge of the interior workings of the
application called as Black Box Testing.
 The tester is oblivious to the system architecture and does not have access to the source code.
 Typically, while performing a Black Box test, a tester will interact with the system's user
interface by providing inputs and examining outputs without knowing how and where the inputs
are worked upon.

Black Box Testing


 White Box testing is the detailed investigation of internal logic and structure of the code.
 White Box testing also called as glass testing or open box testing.
 In order to perform white Box testing on an application, a tester needs to know the internal
workings of the code.

44
Grey Box Testing
 Grey Box testing is a technique to test the application with having a limited knowledge of the
internal workings of an application.
 In software testing, the phrase the more you know, the better carries a lot of weight while testing
an application.

Unit Testing
 Unit testing contains the testing of each unit of Recruitment Application.
 We test each interface by providing input values and check whether it is properly working or not.
We also test database connectivity.
 We enter the values in interface and check whether these values are properly assigned to
corresponding tuples or not.

Integration Testing
 Integration testing, defined as the testing of combined parts of an application to determine if they
function correctly.
 Integration testing can be done in two ways:
 Bottom-Up integration testing and
 Top-Down integration testing.

System Testing
 System testing tests the system as a whole.
 Once all the components are integrated, the application as a whole tested rigorously to see that it
meets the specified Quality Standards.
 A specialized testing team will be working on this type of testing.

45
Acceptance Testing

 This is arguably the most important type of testing, as the Quality Assurance Team who will
gauge whether the application meets the intended specifications and satisfies the client’s
requirement conducts it.
 The QA team will have a set of prewritten scenarios and test cases that are used to test the
application.
 In System Testing, we have tested entire Recruitment Application.
 We have run all programs as a single system, inputs various test cases, and analyses that all are
going correctly or not.
 In system testing, we have tested various test cases. According to which, Application showed the
corresponding error message.

46
7.3. Test Cases:

T.C EXPECTED Pass/


T.C_NO
SCENARIO T.C_STEPS RESULT Actual Result Fail Reference
Application
Should open
Launch the Open the Application has
TC_01 Successfully Pass Screenshot - 1
application application been opened.
and able to see
home page
It should
Register Click on the It navigated to
TC_02 navigate to Pass Screenshot - 2
new user Register button the register page
register page

Pop up appeared
Should get
Register saying
TC_03 Enter the details ‘Registration Pass Screenshot - 3
new user ‘Registration
Sucessful’
Sucessful’

It should
Click on login It navigated to
TC_04 Login navigate to Pass Screenshot - 4
button the Login page
Login page

It should
Enter login It navigated to
TC_05 Login navigate to User Pass Screenshot - 5
details User home page
home page
It navigated to
Payment page
It shouls where consumer
Click on the Pay
TC_06 Pay Bill navigate to gets the Pass Screenshot - 6
Bill button
payment page electricity bill
amount to be
paid
It should
It navigated to
Click on the Pay navigate to
TC_07 Pay Bill payment options Pass Screenshot - 7
now button payment
page
options page
Table 1. Test Cases Part 1

47
EXPECTED Pass/
T.C_NO
T.C SCENARIO T.C_STEPS RESULT Actual Result Fail Reference

It should
Click on the It navigated to
navigate to
TC_08 Pay Bill Credit / Debit the payment Pass Screenshot - 8
the payment
card button gateway page
gateway page
Should get a Pop up got
Enter the details
pop up appeared ‘
TC_09 Pay Bill and click on pay Pass Screenshot - 9
‘payment Payment
button
successful’ Successful’
Pop up got
Enter the details Error saying
appeared
TC_10 Pay Bill and click on pay invalid card Pass Screenshot - 10
‘Invalid card
button details
details’

It should
It navigated to
Register Click on Register navigate to
TC_11 complaint Pass Screenshot - 11
Complaint complaint complaint
page
page

Pop up got
Pop up saying
Enter the details appeared -
‘Complaint
Register and click on the ‘Complaint
TC_12 registered Pass Screenshot - 12
Complaint register complaint registered
with reference
button. with reference
no.*****’
no.*****’
It should
Navigated to
View Complaint Click on few navigate to
TC_13 complaint Pass Screenshot - 13
Status complaint status complaint
status page
status page
Table 2. Test Cases Part 2

48
T.C EXPECTED Pass/
T.C_NO
SCENARIO T.C_STEPS RESULT Actual Result Fail Reference

It should
Admin Click on the Admin navigate to It navigated to
TC_14 Pass Screenshot – 14
Login login button. Admin login Admin login page
page

Admin Enter the login Login


TC_15 Login successful. Pass Screenshot –15
Login details successful

Admin Enter the incorrect Invalid login Login


TC_16 Pass Screenshot – 16
Login login details details unsuccessful

It should
Enter the valid login It navigated to the
List navigate to the
TC_17 details and click on list complaints Pass Screenshot – 17
Complaints list complaints
Login button page
page

It should
It navigated to the
List Click on the navigate to the
TC_18 compliant status Pass Screenshot – 18
Complaints complaints listed. complaint
page
status page

Select the status of Status of the Status of the


Complaint
TC_19 the complaint from complaint complaint got Pass Screenshot – 19
Status
the drop down changed changed

Table 3. Test Cases Part 3

49
8. RESULT - SCREENSHOTS

Screenshot - 1

Figure 8.1 - Result -screenshots

Screenshot – 2

50
Screenshot – 3

51
Screenshot – 4

Screenshot – 5

52
Screenshot – 6

53
Screenshot – 7

Screenshot – 8

54
Screenshot – 9

Screenshot – 10

55
Screenshot – 11

Screenshot – 12

56
57
Screenshot – 13

Screenshot – 14

Screenshot – 15

58
Screenshot – 16

59
Screenshot – 17

Screenshot – 18

60
Screenshot – 19

61
62
9. CONCLUSION AND FUTURE SCOPE

The essence of Delivery work flow can be summed up as complaining about electricity issues

without going to electrical office. By using DWF we can even follow up with the electrical

department officer, as we will provided with the contact details of the person who is allocated to the

work we requested or raised in the system. The current application can be applicable for state wise

electrical departments, and only deals with the household electricity issues.

In future the same application can be applicable for the Whole country and can also deals with the

remaining electricity issues around the country.

63
[10]. REFERENCES

[1] Foundations of Software testing by Dorothy Graham


[2] Hello, Android by Ed Burnette
[3] https://StarUML.microsoft.com/
[4] https://www.sqlite.org/index.html
[5] https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase

64

You might also like