MONO-ANDROID EMPLOYEE TIME-OFF MOBILE SERVICE A Project

MONO-ANDROID EMPLOYEE TIME-OFF MOBILE SERVICE
A Project
Presented to the faculty of the Department of Computer Science
California State University, Sacramento
Submitted in partial satisfaction of
the requirements for the degree of
MASTER OF SCIENCE
in
Computer Science
by
Komal Chopra
SPRING
2013
© 2013
Komal Chopra
ALL RIGHTS RESERVED
ii
MONO-ANDROID EMPLOYEE TIME-OFF MOBILE SERVICE
A Project
by
Komal Chopra
Approved by:
__________________________________, Committee Chair
Dr. Jinsong Ouyang
__________________________________, Second Reader
Dr. Mary Jane Lee
____________________________
Date
iii
Student: Komal Chopra
I certify that this student has met the requirements for format contained in the University format
manual, and that this project is suitable for shelving in the Library and credit is to be awarded for
the project.
__________________________, Graduate Coordinator
Dr. Behnam Arad
Department of Computer Science
iv
___________________
Date
Abstract
of
MONO-ANDROID EMPLOYEE TIME-OFF MOBILE SERVICE
by
Komal Chopra
The objective of the project is to develop the Employee Time-Off Android mobile
service that enables an Employee to submit leave of absence remotely. In addition, the
application enables a Supervisor to approve or not approve a leave of absence. Further,
the application keep a record of each request and status of leave within the company’s
database and generates leave of absence tracking reports for an Employee and Supervisor
using Android mobile devices.
The n-tier Service Oriented Architecture based Mono-Android application is created
for Employees and Supervisors to track an Employee’s leave of absence. The
functionalities provided for an Employee are Submit Leave of Absence, Track monthly
Leave Status and Leave Report generation on a timely basis. The functionalities provided
for a supervisor are Leave Approval and Employee’s Leave Report generation on a
v
timely basis. Further extension of the project includes service to cloud system; in
addition, the service can integrate available clouds and can extend to cross-platform
application.
_______________________, Committee Chair
Dr. Jinsong Ouyang
_______________________
Date
vi
ACKNOWLEDGEMENTS
I would like to thank to Dr. Jinsong Ouyang, my project advisor; for giving me an
opportunity to work with him on the latest technology. I appreciate his feedback and
patience throughout the project. His support and encouragement has helped me in
completing this project successfully. I would also like to thank Dr. Mary Jane Lee for
being the second reader in this project. Lastly, I would like to thank all the people who
have directly or indirectly supported me on my project.
vii
TABLE OF CONTENTS
Page
Acknowledgments...................................................................................................... vii
List of Figures ............................................................................................................. xi
Chapter
1. INTRODUCTION ....................................................................................................1
1.1 Problem Statement ...................................................................................... 1
2. SYSTEM REQUIREMENTS ..................................................................................2
2.1 System Requirements...................................................................................2
2.1.1 Operating Environment ................................................................ 2
2.1.2 Web-Service ................................................................................. 2
2.1.3 .Net Framework ........................................................................... 3
2.1.4 Database ....................................................................................... 3
2.2 Functional Requirements .............................................................................3
2.2.1 Users ............................................................................................ 3
2.2.2 Roles ............................................................................................ 4
2.2.3 Functionalities .............................................................................. 4
2.2.4 Assumptions and Dependencies .................................................. 4
2.3 Employee Interface Process .........................................................................5
2.3.1 Leave Submission ........................................................................ 6
2.3.2 Leave Status ................................................................................. 8
2.3.3 Employee Report ....................................................................... 10
2.4 Supervisor Interface Process ......................................................................13
2.4.1 Request Leave ............................................................................ 14
2.4.2 Supervisor Report ...................................................................... 18
viii
3. SYSTEM ARCHITECTURE ................................................................................22
3.1 Overview on Mono-Android Technology .................................................22
3.1.1 Android Background .................................................................. 22
3.1.2 Android Architecture ................................................................. 22
3.1.3 Mono for Android ...................................................................... 23
3.2 Overview on Cross Platform Technology..................................................24
3.3 Overview on Service Oriented Architecture ............................................. 25
3.3.1 Restful Web-Service .................................................................. 25
3.3.2 SOAP Web-Service ................................................................... 25
3.4 Overview on Project Architecture .............................................................26
3.5 Component Design.....................................................................................27
3.5.1 Insert Leave ................................................................................ 27
3.5.2 Leave Status ............................................................................... 28
3.5.3 Leave Report .............................................................................. 32
3.5.4 Supervisor Leave Approval ....................................................... 36
3.5.5 Supervisor Employee Leave Report .......................................... 41
3.6 Overview on Database Design ...................................................................46
4. SYSTEM IMPLEMENTATION ...........................................................................48
4.1 Interface Design .........................................................................................48
4.1.1 Login Interface ........................................................................... 48
4.1.2 Employee Menu Interface .......................................................... 49
4.1.3 Insert Leave Interface ................................................................ 50
4.1.4 Leave Status Interface ................................................................ 55
4.1.5 Employee Leave List Interface .................................................. 56
4.1.6 Employee Leave Detail Interface............................................... 58
4.1.7 Employee Report Interface ........................................................ 59
4.1.8 Employee Date Report Interface ................................................ 60
ix
4.1.9 Employee Week Report Interface ............................................ 62
4.1.10 Employee Month Report Interface........................................... 63
4.1.11 Employee Quarter Report Interface ......................................... 64
4.1.12 Employee Yearly Report Interface .......................................... 65
4.1.13 Employee Report List Interface ............................................... 66
4.1.14 Supervisor Menu Interface ....................................................... 70
4.1.15 Supervisor Leave Request Interface ........................................ 72
4.1.16 Supervisor Urgent Leave Selection Interface .......................... 73
4.1.17 Supervisor Leave Approval Interface ...................................... 76
4.1.18 Supervisor Leave Dis-Approval Interface .............................. 78
4.1.19 Supervisor Employee Report Interface .................................... 79
4.1.20 Supervisor Employee Report List Interface ............................. 82
5. SUMMARY AND FUTURE WORK ...................................................................84
Appendix A. Initial Steps of Development ............................................................... 85
Bibliography ................................................................................................................93
x
LIST OF FIGURES
Figures
Page
1.
Use-Case Diagram of Employee Module ........................................................... 6
2.
Flow Chart of Insert Leave Functionality ........................................................... 7
3.
Sequence Diagram of Insert Leave Functionality.............................................. 8
4.
Flow Chart of Leave Status Functionality .......................................................... 9
5.
Sequence Diagram of Leave Status Functionality ............................................ 10
6.
Flow Chart of Employee Report ....................................................................... 12
7.
Sequence Diagram of Employee Leave Report Functionality .......................... 13
8.
Use-Case Diagram of Supervisor Module ........................................................ 14
9.
Flow Chart of Pending Leave Functionality ..................................................... 16
10.
Flow Chart of Urgent Leave Functionality ....................................................... 17
11.
Sequence Diagram of Supervisor Leave Approval ........................................... 18
12.
Flow Chart of Employee Report Functionality................................................. 20
13.
Sequence Diagram of Employee Leave Report Functionality ......................... 21
14.
Cross Platform Architecture ............................................................................. 24
15.
Component Diagram of Insert Leave Interface ................................................ 27
16.
Component Diagram of Accrued Leave Interface ............................................ 28
17.
Component Diagram of Insert Leave Detail ..................................................... 28
18.
Component Diagram of Leave Status Selection Menu ..................................... 29
19.
Component Diagram of Leave Status Selection Menu Functionality .............. 30
20.
Component Diagram of Leave Status Menu ..................................................... 30
21.
Component Diagram of Leave Status Interface ................................................ 31
xi
22.
Component Diagram of Leave Status Functionality ......................................... 31
23.
Component Diagram of Employee Report Interface ....................................... 32
24.
Component Diagram of Employee Report Menu ............................................. 33
25.
Component Diagram of Leave-Lookup Selection Menu .................................. 34
26.
Component Diagram of Leave-Lookup Interface ............................................. 35
27.
Component Diagram of Employee Leave-Lookup Functionality .................... 35
28.
Component Diagram of Pending Leave Interface ............................................ 37
29.
Component Diagram of Pending Leave Functionality ..................................... 38
30.
Component Diagram of Pending Leave Interface ............................................ 38
31.
Component Diagram of Employee Leave Approval ....................................... 39
32.
Component Diagram of Employee Leave Detail .............................................. 39
33.
Component Diagram of Employee Leave Approval Functionality .................. 40
34.
Component Diagram of Leave Update Interface .............................................. 40
35.
Component Diagram of Urgent Leave Interface .............................................. 41
36.
Component Diagram of Urgent Leave Functionality ....................................... 41
37.
Component Diagram of Leave Selection Menu................................................ 42
38.
Component Diagram of Leave Selection Menu Functionality ......................... 43
39.
Component Diagram of Employee Leave Report ............................................. 44
40.
Component Diagram of Employee Leave Report Functionality ...................... 45
41.
Component Diagram of Employee Leave Interface Functionality ................... 45
42.
Component Diagram of Employee Leave Detail Functionality ....................... 46
43.
Database Design................................................................................................ 47
44.
Interface Design of Login Functionality ........................................................... 48
45.
Login API code ................................................................................................. 49
46.
Interface Design of Employee Menu Functionality .......................................... 50
47.
Interface Design of Insert Leave Functionality ................................................ 51
48.
LeaveData API code ......................................................................................... 52
xii
49.
LeaveInsert API code ........................................................................................ 52
50.
LeaveInsert Service ........................................................................................... 53
51.
LeaveInsert Data ............................................................................................... 54
52.
LeaveInsert Stored Procedure ........................................................................... 55
53.
Interface Design of Employee Leave Status Selection Functionality............... 56
54.
Interface Design of Employee Leave List Functionality .................................. 57
55.
LeaveData API code ......................................................................................... 58
56.
Interface Design of Employee Leave Detail Functionality.............................. 59
57.
Interface Design of Employee Report Functionality ........................................ 60
58.
Interface Design of Employee Date Report Functionality................................ 61
59.
Interface Design of Employee Week Report Functionality .............................. 62
60.
Interface Design of Employee Month Report Functionality............................. 63
61.
Interface Design of Employee Quarter Report Functionality ........................... 64
62.
Interface Design of Employee Yearly Report Functionality ............................ 65
63.
GetYear API code ............................................................................................. 66
64.
Interface Design of Employee Report List Functionality ................................. 67
65.
GetEmpReport API code .................................................................................. 68
66.
GetEmpReportData Service Layer ................................................................... 68
67.
GetEmpReport Data Layer ............................................................................... 69
68.
GetEmpReport Stored Procedure ...................................................................... 70
69.
Interface Design of Supervisor Menu Functionality ......................................... 71
70.
Interface Design of Supervisor Leave Request Functionality .......................... 72
71.
Interface Design of Urgent Leave Selection Functionality............................... 74
72.
UpdateSupPref API code .................................................................................. 74
73.
UpdateSupPref Service Layer ........................................................................... 75
74.
UpdateSupPref Data Layer ............................................................................... 75
xiii
75.
UpdateSupPref Stored Procedure ..................................................................... 76
76.
Interface Design of Supervisor Leave Approval Functionality ........................ 77
77.
SupEmpLeaveDetail API code ......................................................................... 77
78.
Interface Design of Supervisor Leave Dis-Approval Functionality ................. 79
79.
Interface Design of Supervisor Employee Report Functionality ...................... 81
80.
GetEmpName API code .................................................................................... 81
81.
Interface Design of Supervisor Employee Report List Functionality ............... 83
82.
GetSupReport API code .................................................................................... 83
83.
IIS Server Configuration Properties.................................................................. 88
84.
Snapshot of the IIS Server ................................................................................ 89
85.
Snapshot of Database Connection String .......................................................... 90
86.
Snapshot of Database Manager ......................................................................... 90
xiv
1
Chapter 1
INTRODUCTION
1.1 Problem Statement
In today’s world, there are various modes of communication like mobile, internet,
telephone etc. through which it has become very easy for employees’ to inform the
organization about their absence. However, through external software applications, an
absence record of the employee is hard to maintain and retrieve. Thus, employee Timeoff service was developed.
The objective of the project was to develop an automated service that keeps track of
the employee’s leave of absence, regularly, through Android mobile devices, with
extensible features for internet devices.
Employee's Time-off mobile service has five functionalities. Three functionalities
implemented for employees and the two functionalities are designed for supervisors. An
employee can submit a leave application using a mobile device. He can also keep track of
the submitted leave on a monthly basis. The report module for an employee is provided
so that the employee can retrieve his/her approved leave applications. On the supervisor’s
side, the leave application service has a similar report module so that the supervisor can
also check the employee’s leave details. The interface provides the supervisor with the
capability to approve or not approve an employee’s leave using a mobile device. In
addition, the interface to analyze all employees’ leave details is also part of the supervisor
functionality.
2
Chapter 2
SYSTEM REQUIREMENTS
2.1 System Requirements
The system requirements for the Mono-Android Employee Time off Mobile Service
are presented below.
2.1.1 Operating Environment
The operating environment defined as software that communicates with the hardware
allowing the application to run. In this project Xamarin’s Mono-Android operating
environment is used to develop the application. Xamarin’s Mono-Android was released
in January 2012. In this project Xamarin’s trial version has been used. The software
deployed and tested on ARM processor having API level 10/17 and designed to run on
Android version 4.0 Operating System. An Internet Connection is required to download
the Application.
2.1.2 Web-Service
Web Service defined as a method of communication between two electronic devices
over the web. The Service Oriented Architecture based design was adopted to develop the
project. Restful Web-Service integrated the interfaces of the Mono-Android Application.
The JSON open standard designed for data interchange between Web-Service and
Android Interfaces was utilized. The .Net framework used in this project to develop webservices has been downloaded from Microsoft [4].
3
2.1.3 .Net Framework
.Net Framework is a software framework provided by Microsoft that includes large
library and provides language interoperability across several programming languages [4].
The Business process was automated using C#. Net 3.5 framework. The Business Logic
of Web-Service was written using Visual Studio 2008 editor. The business Logic of
Mono-Android Interfaces was written using Visual Studio 2010 editor. The Visual Studio
2010 was used to develop the Android Interfaces. The business logic for the interfaces
was written using in C#.Net 4.0 framework.
2.1.4 Database
The database of a project defined as an organized collection of data [4]. The project
database was designed using SQL SERVER-2008. The Data Layer was used to store the
procedures written. The Data Layer interacted with the SQL SERVER-2008 and the
Restful Web-Services IIS-7 Server deployed the database as well as the Web-Services.
2.2 Functional Requirements
The functional requirements of an application/service in a project are defined as the
function of software components. It describes the behavior of the application.
2.2.1 Users
There are two types of users within this project a Supervisor and an Employee.
4
2.2.2 Roles
The role of a supervisor within the application is to Approve or Not Approve the
pending leave request submitted by an employee and the role of an employee within the
application is to submit a request a leave of absence from work.
2.2.3 Functionalities
The application in total provides five functionalities to the users.The three
functionalities implemented for an employee are: Leave Submission,Leave Status and
Employee Leave Report. The two functionalities implemented for the supervisor are:
Supervisor Request Leave and Employees Leave Reports.
2.2.4 Assumptions and Dependencies
The assumptions and dependencies for the project are identified as: The Employee
Information is present in the database,The Supervisor Information is present in the
database, The Supervisor and Employee Login use pre-assigned Login Id and Password,
The User cannot use the Back button. The user has must use the menu key for navigation.
The total number of leaves that an employee can take in an annual calendar year is a
maximum of 30 days. The number of leaves if less than 30 will not be carried forward to
the next calendar year. For eg. If an employee has taken a total of 29 days leaves in 2011,
the balance leave of 1 day will not be carried forward to the next calendar year of 2012.
5
2.3 Employee Interface Process
After Employee logs into the system, the Employee is Menu displayed. The
Employee Menu connects the Employee side functionality, Leave Submission, Leave
Status and Employee Report. The Leave Submission functionality helps the user to
submit the leave application. The Status of Leave functionality helps user to check the
status of the leave application. The Leave Report functionality helps the user to check his
Leaves- Period wise, Weekly, Monthly, Quarterly, Yearly basis. Figure 1 is the use case
diagram of employee side module, which explains the three functionalities for the
employee.
6
Figure 1: Use-Case Diagram of Employee Module
2.3.1 Leave Submission
An Employee uses this functionality for submission of a leave application. An
employee, enters the start and end date, selects the type of leave, mentions the note
(reason for leave of absence from work) and submits the leave for approval. The Leave
Submission module validates the start and end date.
7
The validation for the functionality is as below:
1. The Start date should be less than the End date.
2. The Start date and the End date should be of the current year.
3. Start date, End date and Leave Note field should not be blank.
4. Accrued Leave should be greater than “0”.
5. Absence days should be less than Accrued Leave.
Figure 2 and Figure 3 are the flow chart and the sequence diagram respectively for
the Insert Leave functionality, which involves the user to insert leave.
Figure 2: Flow Chart of Insert Leave Functionality
8
Figure 3: Sequence Diagram of Insert Leave Functionality
2.3.2 Leave Status
An Employee uses this leave status functionality to check the status of the leave
application submitted for approval. After an Employee enters in the functionality, the
selection menu appears with Pending, Approve, and Disapprove and All Leave options.
On selecting the Pending option, all the pending leaves display. On selecting the Approve
option, all the approved leaves by the supervisor display. On selecting the Not approve
option, all the leaves Not approved by the Supervisor display. On selecting, all leave
option all the leaves submitted by an employee in the present month displays. The user
interface provides a partial search, sort and count facility. With the help of sort facility,
the leaves display in an ascending or descending manner. The count functionality
provides the total number of leaves submitted by the user. Figure 4 and
9
Figure 5 is the flow chart and sequence diagram respectively of the Leave Status
Functionality, which shows an employee the status of a leave request submitted with sort
facility.
Figure 4: Flow Chart of Leave Status Functionality
10
Figure 5: Sequence Diagram of Leave Status Functionality
2.3.3 Employee Report
An employee uses this functionality to check and to analyze the leave taken by the
employee - period wise, weekly, monthly, quarterly, yearly basis. This interface displays
the period wise, weekly, monthly, quarterly, yearly basis selection. On clicking, the
period button and entering the start and end date the details of leaves taken by an
employee in the selected period displays. On clicking the weekly button, the calendar
shows up. On selecting the date from the calendar displayed, all the leaves taken in that
11
week show up. On click the monthly button, the drop down menu displays all the months
of the calendar year from January until December. The user selects the month and the
leaves taken by the employee in that particular month shows up. On clicking the quarterly
button, the drop down menu displays the four quarters of the year (Jan-Mar, April-June,
July-Sept, and Oct-Dec). The user selects the quarter and the leaves taken by the
employee in that quarter shows up. On selecting, the yearly button, the drop down menu
displays the given years. The user selects on the required year and the leave detail
appears.
Similar to the Employee Status module, the Employee Report interface provides a
search, sort and count functionality. The search functionality helps the employee to
partially search for leaves taken. The date entered in “mm/ dd /yyyy” format. The user
enters a single numeric character in the date, and the application displays all the leaves
for the entered numeric character. The sort functionality displays the leaves in an
ascending or descending order by date. The Count functionality gives the number of
Absence leaves. Figure 6 and Figure 7 show the flow chart and the sequence diagram
respectively of the Employee report functionality.
12
Figure 6: Flow Chart of Employee Report
13
Figure 7: Sequence Diagram of Employee Leave Report Functionality
2.4 Supervisor Interface Process
After the Supervisor Logs into the system, the Supervisor Menu displays. This
interface connects the user to the supervisor side functionality. The Request Leaves and
the Employee Reports functionality connected to this menu. The request leaves
functionality helps the user (supervisor) check the leaves submitted by an employee to
the supervisor. The employee reports functionality helps the user (supervisor) to check
the list of all the employees, the leaves submitted with corresponding dates and reason for
leave of absence of work. Figure 8 is the use case diagram of supervisor
14
side module, which explains the two functionalities for the supervisor.
Figure 8: Use-Case Diagram of the Supervisor Module
2.4.1 Request Leave
A supervisor uses this functionality to check the request of leaves submitted by an
employee. It displays the list of pending leave applications of all the reporting employees.
On clicking a particular leave, the details of the selected leave displays.
15
The request will display the employee’s name, dates’ of leave, reason of leave and
note (reason for leave of absence).The supervisor can approve or not approve the request
for leave. On approving the leave, the status of the leave changes from pending to
approved. On dis-approving the leave, the status of leave will change from pending to not
approve. The supervisor mentions the reason of dis-approval.
The functionality has partial search, sort and count facility. It also has the facility to
check the urgent leave requests submitted. The interface provided to the supervisor
selects the urgency of the leave. The urgency interface selects leaves within 0-7 days
from the current date. On clicking, the Pending Leave button the interface displays the
list of pending leaves. On clicking, the Urgent Leave button the interface displays the
urgent leave criteria. After setting, the Urgent Leave criteria the user can either log out or
return to the List of Pending Leave Functionality. Figures 9 and 10 is the flow chart of
pending leave and urgent leave functionality respectively and Figure 11 is the sequence
diagram of supervisor leave approval.
16
Figure 9: Flow Chart of Pending Leave Functionality
17
Figure 10: Flow Chart of Urgent Leave Functionality
18
Figure 11: Sequence Diagram of Supervisor Leave Approval
2.4.2 Supervisor Report
This functionality is similar to the Employee Report functionality provided on the
Employee side. The Interface helps the supervisor select an employee from list of
employee’s. On entering the Supervisor Menu, the Employee leave lookup functionality
allows the user (supervisor) to enter Leave Selection Menu functionality. Through this,
the user selects the name of an employee, the leave period and the leave type. The user
can select the leaves on period-wise, weekly, monthly, quarterly and yearly basis.
19
The application displays the list of the employee’s name, the number of leaves taken
and a count of the leaves taken by all the employees. On clicking the name of an
employee, the supervisor directed to the selected employee report functionality, which
displays the leave report of the selected employee.
The supervisor report interface has a partial search, sort and count functionality. This
functionality helps the user (supervisor) to search employees based on their names. On
entering, the first letters of an employee’s name all the names starting with that letter
display. On selecting the required employee, the leave detail report of that employee
displays. In addition, the sort functionality is provided through which the list of the
employees sorted in an ascending order or descending order. The count functionality
shows the total number of leaves taken by an employee in that period. Figure 12 and
Figure 13 are the flow chart and the sequence diagram of the Supervisor Report
functionality.
20
Figure 12: Flow Chart of Employee Report Functionality
21
Figure 13: Sequence Diagram of Employee Leave Report Functionality
22
Chapter 3
SYSTEM ARCHITECTURE
3.1 Overview On Mono-Android Technology
Mono-Android is an android development framework provided by the company
called Xamarin[1]. It is compatible with .Net framework, C# compiler and a Common
Language Runtime.
3.1.1 Android Background
An Android is the mobile operating system developed by Android Inc. The Operating
System is on Linux 2.6 kernel. It is the open source application of about 12 million lines
of code. The Lower layer of the Operating System written in C. This layer interacts with
the Linux kernel. The application layer of Android Operating System developed in java.
Android has the Google market for application distribution. It supports a multitude of
different devices [2].
3.1.2 Android Architecture
Android Architecture formed of Linux Kernel, Libraries, Application Framework,
and Android Applications. The Android Architecture is formed of :
1. Linux Kernel: Android Architecture is the basic hardware abstraction layer [2].
2. Libraries: Android Architecture contains various libraries [2].
3. Application Framework: It contains application framework having Activity
Manager, Window Manager, Content Providers, View System, and Package
Manager.
23
4.
Telephony Manager, Resource Manager, Location Manager and Notification
Manager [2].
5. Android Applications: It contains various applications bundled together and
distributed together. Basic Android Application Programming Interface levels
correspond with the version of the Android [2].
3.1.3 Mono for Android
It is the alternative to Java for developing Android Apps using C# and .Net
framework using Mono Develop or Visual Studio 2010 Integrated Development
Environment.Mono is the runtime that runs on any Operating System. Mono is the part of
the .Net framework having .Net runtime.Mono for Android is a framework built on top of
mono. It wraps almost the entire Android Software Development Kit. It does not compile
down to native code. It goes back and forth between DALVIK Virtual Machine and
Mono Virtual Machine.Mono for android runs on windows or OSX.Many wrappers and
bindings built on top of Linux Kernel and this made the Android Operating System.Mono
Virtual Machine is just like the .Net virtual Machine. DALVIK Virtual Machine is just
like the Java virtual Machine. These virtual Machines are able to communicate with each
other using bindings and wrappings It uses mono-runtime for compiling the code and run
on Linux kernel. Android Binding uses many wrappers that use Android Software
Development Kit. When something is done in Android Software Development Kit, it
marshal’s and send some data across DALVIK Virtual Machine. Thus, all the .Net code
converts into Java code and compiled on DALVIK Virtual Machine [2] and vice versa.
24
3.2 Overview On Cross Platform Technology
Before, the application developed in java language for androids. An application for
iPhone coded in C-Objective. In addition, windows phone application coded in Microsoft
.net Technology. Now, the code written in C #, .NET framework and it is possible to
share the code by android, iPhone, and Windows phone with their own platform User
Interface and device capabilities. This defines Cross Platform Technology. The cross
platform technology helps create the application that allows the code to share across
multiple platforms. “XAMARIN” provides the technology that helps build the Cross
Platform Application. Following are some of the services provided by “XAMARIN” to
build applicatios.The Model View Controller (MVC) design pattern based application
built so that the views are separate from Model and Controller. It provides SQLLite .Net
database for local storage of data. It provides mobile libraries for accessing device
capabilities. It also provides features for Networking, Web-Services, Input Output and
more [1]. Figure: 14 shows the Cross Platform Architecture [1].
IOS Interface
IPhone Interface
Windows Interface
Business Layer
Service Layer
Data Access Layer
Data Layer
Figure 14: Cross Platform Architecture
25
3.3 Overview On Service Oriented Architecture
The Web Services built on principles and design philosophies for designing and
developing the software in the form of interoperable service defined as Service Oriented
Architecture (SOA). The service-oriented architecture help build applications that are
extensible. Some of the famous design philosophies are SOAP1 and REST2[3].
3.3.1 Restful Web-Service
Restful Web Service embraces Http3 as the transport used throughout the system. It
does not try to achieve the transport neutrality. Restful design uses the Http as the
commonly used protocol. The Restful Web-Service concept model service as a resource
and gives a unique Identifier in the form of URI’s4. Then URI’s can be interacted with
the help of the resource using standard interface. Various Http protocol like GET, POST,
PUT, DELETE, HEAD forms the service contract. It is useful to build highly scalable
services. In addition, it is useful to obtain performance and scalability improvements. The
resources represented as XML5, JSON6, and RSS7 [3] .
3.3.2 SOAP Web-Service
1 “SOAP”, Simple Object Access Protocol.
2 “REST”, Representational State Transfer.
3 “Http” or “HHTP”, Hypertext Transfer Protocol is an application protocol for information systems.
4 “URI”, Uniform Resource Identifier identifies resource on the internet.
5 “XML”,Extended Markup Language allows user to define their own customized markup language
6 “JSON”, JavaScript Object Notation is a lightweight data interchange format.
7 “RSS”, Really Simple Syndication is a lightweight data interchange format.
26
The primary goal of SOAP service is to achieve Transport neutrality.
SOAP used for web-development [3]. The lighter version of soap used for mobile.
3.4 Overview On Project Architecture
The target of the project is to build the Mobile Application for Android Users. The
project designed using Service Oriented Architecture. It was n-tier application developed
using .Net 3.5 framework. The Mobile Service designed using Restful service, which
integrated SQL-SERVER 2008 database with Mobile Service and integrated monoandroid interfaces with Mobile Service.ADO.net helped to integrate with the SQLSERVER database. Resources of restful service respected in JSON format.
“HTTPWEBREQUEST” mechanism helped grabbing JSON objects from Restful
Service. Visual Studio 2008 Integrated Development Environment helped writing
business logic of restful service. Visual Studio 2010 Integrated Development
Environment helped writing interfaces of Mono-Android Application.IIS-7 server
deployed the Service. IIS-7 database manager deployed the database designed in SQLSERVER 2008 and stored procedures. The application deployed and tested on emulator
supporting Application Protocol Interface level 10/14 on ARM processor. Further
extension of the project can shape the service to cloud system. In addition, the service can
integrate available clouds. The service can further extend to cross-platform application.
The solution of the project is possible using Monolithic Approach using SQLLite
database too. However, focusing on further extension, the project was designed using
SOA architecture. The service design is also possible using SOAP 1.1 over HTTP and
.ASMX configuration.
27
28
3.5 Component Design
The objective of component design is to provide a design for an adaptable component
that satisfies product requirements in accordance with the product architecture.
3.5.1 Insert Leave
On clicking the ‘Insert Leave’ button, the’ Employee Id’ passes from ‘Employee
Menu’ to ‘Insert Leave’ Interface. The Leaves Accrued by the Employee is obtained from
database and displayed on the ‘Leave Insert Interface’. An Employee fills out the Insert
Leave form and submits into the database. Figure 15 and Figure 16 show the component
diagram of ‘Insert Leave Interface’ and Accrued Leave Interface respectively and Figure
17 shows the Insert Leave Detail.
Figure 15: Component Diagram of Insert Leave Interface
29
Figure 16: Component Diagram of Accrued Leave Interface
Figure 17: Component Diagram of Insert Leave Detail
3.5.2 Leave Status
On clicking Leave Status button, the ‘Employee Id’ passes from ‘Employee Menu’ to
‘Leave Status’ Interface. On clicking Leave button, the ‘Leave Status Selection Menu’
appears. Figure 18 show the component diagram of ‘Leave Status Selection Menu’ the
‘Leave Status Selection Menu’ has ‘Pending Leave’, ‘Approved Leave’, ‘Rejected
Leave’ and ‘All Leave’ button. Figure 19 show the component diagram of ‘Leave Status
Selection Menu’ Functionality. By clicking, button on ‘Leave Status Selection Menu’, the
30
‘Leave Status’ Interface appears. The ‘Status Id’ and ‘Employee Id’ passes from ‘Leave
Status Selection Menu’ to ‘Leave Status’. Figure 20 and Figure 21 show the component
diagram of ‘Leave Status Menu’ Interface and ‘Leave Status’ Interface. The ‘Leave
Status’ Interface displays the list of Leaves taken by an employee in present month.
‘Leave Status’ Interface formed of Employee Monthly Leaves, Search Leave, Sort
Leaves and Count Leave functionality. Figure 22 shows the component diagram of
Leave Status Functionality.
Figure 18: Component Diagram of Leave Status Selection Menu
31
Figure 19: Component Diagram of Leave Status Selection Menu Functionality
Figure 20: Component Diagram of Leave Status Menu
32
Figure 21: Component Diagram of Leave Status Interface
Figure 22: Component Diagram of Leave Status Functionality
33
3.5.3 Leave Report
The ‘Employee Id’ passed from ‘Employee Menu’ to ‘Employee Report’ Interface.
‘Employee ReportMenu’ has ‘Period’, ‘Week’, ‘Month’, ‘Quarter’ and ‘Year’ button.
Figure 23 and Figure 24 show the component diagram of ‘Employee Report’ Interface
and ‘Employee ReportMenu’ respectively. ‘Employee Report’ Selection passes
‘Employee Id’ from ‘Employee Menu’.Figure 25 is the component diagram of
‘LeaveLookup Selection’ Menu. List of the Employee Leaves obtained from database
and displayed. Figure 26 is the component diagram of ‘Employee LeaveLookup’
Interface. The ‘Employee LeaveLookup’ formed of, the List of Employee Leaves,
Search, Sort and Leave Count functionality. Figure 27 is the component diagram of
‘Employee Leave Lookup’ Functionality.
Figure 23: Component Diagram of Employee Report Interface
34
Figure 24: Component Diagram of Employee Report Menu
35
Figure 25: Component Diagram of Leave-Lookup Selection Menu
36
Figure 26: Component Diagram of Leave-Lookup Interface
Figure 27: Component Diagram of Employee Leave-Lookup Functionality
37
3.5.4 Supervisor Leave Approval
On clicking Pending Leave button, the ‘Supervisor Id’ passed from ‘Pending Leave’
to ‘Employee Leave Approval’ Interface. Figure 28 is the component diagram of
‘Pending Leave’ Interface. ‘Employee Leave Approval’ Interface has a list of Pending
Employee Leaves coming from the database. Figure 29 is the component diagram of
Pending Leave List Pending Leave Interface formed of, the List of Pending Leaves,
Search, Sort, Leave Count and Urgent Leave functionality ‘Employee Id’ and ‘Supervisor
Id’ passed from ‘Employee Leave’ to ‘Employee Leave Detail’. Figure 30, Figure 31,
Figure 32 is the component diagram of ‘Pending Leave’ Functionality, ‘EmployeeLeave
Approval’ and ‘Employee Leave Detail’ Respectively.’ Employee Leave Detail’ gets the
detail of Employee Leave from the database. Figure 33 and Figure 34 is the ‘Employee
Leave Approval’ Functionality and ‘LeaveUpdate Interface’ Respectively through
‘Employee Leave Approval’ Interface, the Supervisor can Approve or Not approve
Leave. Update database through Leave Approval or Leave Dis-Approval message. By
clicking ‘Urgent Leave’ button on ‘Employee Leave Approval’, the Urgent Leave date
setting done. Figure 35 is the component diagram of ‘UrgentLeave’ Interface. Urgent
Leaves obtained from the database on making Urgent Leave Selection. Figure 36 is the
component diagram of ‘UrgentLeave’ Functionality.
38
Figure 28: Component Diagram of Pending Leave Interface
39
Figure 29: Component Diagram of Pending Leave Functionality
Figure 30: Component Diagram of Pending Leave Interface
40
Figure 31: Component Diagram of Employee Leave Approval
Figure 32: Component Diagram of Employee Leave Detail
41
Figure 33: Component Diagram of Employee Leave Approval Functionality
Figure 34: Component Diagram of Leave Update Interface
42
Figure 35: Component Diagram of Urgent Leave Interface
Figure 36: Component Diagram of Urgent Leave Functionality
3.5.5 Supervisor Employee Leave Report
Supervisor clicks on the ‘EmployeeLeaveReport’ button and the ‘Supervisor Id’
passed from ‘EmployeeLeaveReport’ to ‘LeaveSelectionMenu’. Figure 37 is the
component diagram of ‘LeaveSelectionMenu’. Employee ‘LeaveSelectionMenu’ formed
of ‘Period Wise’, ‘Weekly’, ‘Monthly’, ‘Quarterly’, ‘Yearly’ Leave Selection button.
Figure 38 is the component diagram of ‘LeaveSelectionMenu’ Functionality.
43
‘Supervisor LeaveSelection’passes the Employee Id and the Supervisor Id from the
‘SupervisorLeaveSelection’ menu to the ‘SupEmpLeaveReport’. Figure 39 is the
component diagram of ‘EmployeeLeaveReport’ Functionality. ‘EmployeeLeaveReport’
interface formed of the ‘ListofEmployees’, ‘SearchLeaves’, Sort and Count
Functionality. Figure 40 is the component diagram of ‘EmployeeLeaveReport’
Functionality. List of Employee Leaves obtained from database and displayed. Figure 41
is the component diagram of ‘Employee Leave Interface’ Functionality. ‘Employee
LeaveDetail’ Interface displays the detail of an Employees Leave. Figure 42 is the
component diagram of ‘EmployeeLeaveDetail’ Functionality.
Figure 37: Component Diagram of Leave Selection Menu
44
Figure 38: Component Diagram of Leave Selection Menu Functionality
45
Figure 39: Component Diagram of Employee Leave Report
46
Figure 40: Component Diagram of Employee Leave Report Functionality
Figure 41: Component Diagram of Employee Leave Interface Functionality
47
Figure 42: Component Diagram of Employee Leave Detail Functionality
3.6 Overview on Database Design
In this project, Sql Server 2008 used for database design. There are four tables within
the database design diagram. ‘Supervisor’ Table stores information of the Supervisor.
Table formed of three column’s ‘SupervisorNo’, ‘SupervisorName’ and ‘EmailAddress’.
‘SupervisorNo’ forms the primary key of the table. ‘Employee’ Table stores information
of the Employee. Table formed of eight columns- ‘EmpNo’, ‘SupervisorNo’, ‘Name’,
‘Address’,’ EmailAddress’, ‘PhoneNo’ and ‘DaysAccure'. ‘EmpNo’ forms the primary
key of the table and ‘SupervisorNo’ forms the foreign key of the table. ‘Leave’ Table
stores information of the Leave.
48
Table has nine columns within that ‘LeaveNo’, ‘EmpNo’, ‘SubmissionDate’, ‘Start
Date’, ‘EndDate’, ‘AbsenceDays’, ‘LeaveType’, ‘Note’, ‘Status’ and ‘Reason’. ‘Leave
No’ forms the primary key of the table and ‘EmpNo’ forms the foreign key of the table.
Figure: 43 describe the Database Design of Mono-Android Employee Time-off Service.
Figure 43: Database Design
49
Chapter 4
SYSTEM IMPLEMENTATION
4.1 Interface Design
Interface Design defined as an Interface Engineering of Software Applications with
focus on user experience and Interaction between the users.
4.1.1 Login Interface
Figure 44, is a snapshot of the login interface for both the users of the application.
The Employee and Supervisor use this form to log into the application form.
Steps to use login Interface
1. The user enters the email address
2. The user enters the password
3. The user clicks on Login
Figure 44: Interface Design of Login Functionality
50
Mono-Android code behind the login interface
When the user logs into the interface, the codes behind ‘Login.axml’ and ‘Login.cs’
files are called.
Web-Service code of the login Interface
As illustrated in Figure 45, the ‘login’ API code, the email address and the password
of the user passed from the login interface to the login API of the web-service in JSON
format.
[WebGet(UriTemplate = "Login/{Email}/{Password}",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
string LoginObject(string Email, string Password);
Figure 45 : Login API code
In the Service Layer of Web-Service, ‘Login Object’ method called to get data. In
the Data Layer of Web-Service, ‘GetLoginId’ method called to get data. The
‘GetLoginId’ Stored Procedure' is called to extract data from database.
4.1.2 Employee Menu Interface
Figure 46, is a snapshot of the ‘Employee Menu’ interface for the Employee. The
Employee uses this form to log into the Employee side functionality.
51
Steps to use Employee Menu Interface
1. Employee uses this Interface to navigate to Insert Leave functionality.
2. Employee uses Employee Menu Interface to navigate to Leave Status.
3.
On clicking, Leave Report button the application navigates to Leave Report
functionality.
Figure 46: Interface Design of Employee Menu Functionality
Mono-Android code of the Employee Menu Interface
When the user enters employee interface, ‘EmployeeMenu'.axml’ and ‘EmpMenu.cs’
the code behind files are called. Logout.xml file is used for navigation.
Insert Leave Interface.
4.1.3 Insert Leave Interface
Figure 47, is a snapshot of the Employee Leave Insert Interface for the Employee.
The Employee uses this form to insert a Leave.
52
Steps to use Employee Leave Insert Interface
1. The employee uses this Interface to Insert Employee Leave functionality.
2. The employee enters the Start Date and End Date
3. The Employee selects Leave Type: Vacation or Sick Leave.
4. The employee enters the note(reason for leave)
5. The user clicks on submit to send leave on the application.
Figure 47: Interface Design of Insert Leave Functionality
Mono-Android code of the Accrued Leave Interface
When the user logs into the interface, the codes behind Leave.axml and Leave.cs files
are called.
53
Web-Service code of the Accrued Leave Interface
As illustrated in Figure 48 ‘LeaveData’ API code, the Login Id of the user is passed
from the ‘AccruedLeave’ interface to the ‘LeaveData’ API of the web-service in JSON
format. The EmpSelMenu.xml file is used for navigation.
[WebGet(UriTemplate = "LeaveData/{LoginId}",
BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
ILeaveData GetLeaveDataObject(string LoginId);
Figure 48: LeaveData API code
In Service Layer of Web-Service, ‘GetLeaveDataObject’ method is called to get data.
In Data Layer, of Web-Service ‘GetEmpLeaveInfo’method is called to get data. The
‘GetEmpLeaveInfo’ Stored Procedure is called to extract data from database.
Web-Service code of the Insert Leave Interface
As illustrated in Figure 49, ‘LeaveInsert’ API code, the login id, start date, end date,
leave days, reasons and note are passed from ‘LeaveInsert’ interface to the LeaveInsert
API of the web-service in JSON format. This API Inserts Employee Leave into the
Database.
[WebGet(
UriTemplate = "LeaveInsert/{LoginId}/{StartDate}/{EndDate}/{LeaveDays}/{Reason}/{Note}"
BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
string LeaveInsert(string LoginId, string StartDate, string EndDate, string LeaveDays, string Reason,string
Note);
Figure 49: LeaveInsert API code
54
As illustrated in Figure 50,In Service Layer of Web-Service, ‘LeaveInsert’ method is
called to insert data. The ‘login Id’, ‘Start Date’, ‘End Date’, ‘Leave dates’, ‘Reason’ and
‘Note’ values are passed from the ‘LeaveInsert’ Interface to the ‘LeaveInsert’ Service
Layer. The values are stored in ‘LeaveInsert’ data object of ‘Leave Insert Service Data’
class. In the Service Layer values of date are manipulated from dummy values to ‘/’.The
‘EmpLeaveInsert’ object is created of ‘EmpLeaveInfoGet’ data layer class.
public string LeaveInsert(string LoginId, string StartDate, string EndDate, string LeaveDays, string
Reason,string Note)
{
ILeaveInsert LeaveInsert = new ILeaveInsert();
LeaveInsert.ILoginId = LoginId;
LeaveInsert.IStartDate = StartDate;
LeaveInsert.IEndDate = EndDate;
LeaveInsert.ILeaveDays = LeaveDays;LeaveInsert.IReason = Reason;
LeaveInsert.INote = Note;
LeaveInsertServiceData LeaveInserData = new LeaveInsertServiceData(); LeaveInserData.LoginId =
LeaveInsert.ILoginId;
LeaveInserData.StartDate = LeaveInsert.IStartDate.Replace('S', '/');
LeaveInserData.EndDate = LeaveInsert.IEndDate.Replace('E', '/');
LeaveInserData.LeaveDays = Convert.ToInt32(LeaveInsert.ILeaveDays);
LeaveInserData.Reason = LeaveInsert.IReason;
LeaveInserData.Note = LeaveInsert.INote;
EmpLeaveInfoGet EmpLeaveInsert = new EmpLeaveInfoGet();
string LeaveRes = EmpLeaveInsert.InsertEmpLeave(LeaveInsertData);
return LeaveRes; }
Figure 50: LeaveInsert Service Layer
55
As illustrated in Figure 51, the Data Layer of Web-Service, ‘InsertEmpLeave’
method called to insert data. In the Layer values are passed from service
layer.’LeaveInsertData’ object to data layer,’LeaveRes’. The SQL connection is formed
and the retrieved values are passed to store procedure‘InsertEmpLeave’.
public string InsertEmpLeave(LeaveInsertServiceData LeaveSerData)
{
SqlCommand cmd = new SqlCommand("InsertEmpLeave", SqlConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@EmpNo", LeaveSerData.LoginId);
cmd.Parameters.AddWithValue("@StartDate", LeaveSerData.StartDate);
cmd.Parameters.AddWithValue("@EndDate", LeaveSerData.EndDate);
cmd.Parameters.AddWithValue("@AbsenceDays", LeaveSerData.LeaveDays);
cmd.Parameters.AddWithValue("@LeaveType", LeaveSerData.Reason);
cmd.Parameters.AddWithValue("@Note", LeaveSerData.Note);
try
{
SqlConn.Open();
Try
{
cmd.ExecuteNonQuery();
return "true";
}
catch
{
return "false";}}
Figure 51 : LeaveInsert Data Layer
As illustrated in Figure 52, the ‘InsertEmpLeave’ Stored Procedure, is called to insert
data into the database.This Stored Procedure increments the Leave No., generating a new
number and passes the value – “(@EmpNo varchar (10), @StartDate date,@EndDate
date,@AbsenceDays int,@LeaveType varchar (50), @Note varchar (max))” into Leave
database. The status for leave will set to pending by default. If the leave inserted, Boolean
value true passed back to the Insert Leave Interface. Else, exception generated, SQL
connection is closed and the handler (False) passed to the interface.
56
USE [TimeOff]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[InsertEmpLeave](@EmpNo varchar(10),@StartDate date,@EndDate
date,@AbsenceDays int,@LeaveType varchar(50),@Note varchar(max))
AS
Begin
DECLARE @LeaveNo int
DECLARE @IncreVal int = 1
SET @LeaveNo = (select count(LeaveNo) from Leave);
select StartDate from Leave where StartDate = @StartDate and EmpNo = @EmpNo;
if @@Rowcount = 0
BEGIN
Insert into
Leave([LeaveNo],[EmpNo],[SubmissionDate],[StartDate],[EndDate],[AbsenceDays],[LeaveType],[Note],[
Status],[Reason],[DateTime]) values ('L0' + cast(@LeaveNo + @IncreVal as
varchar),@EmpNo,getdate(),@StartDate,@EndDate,@AbsenceDays,@LeaveType,@Note,'P','Status of
Leave is Pending',getdate());
END
END
Figure 52: LeaveInsert Stored Procedure
4.1.4 Leave Status Interface
Figure 53, is a snapshot of the Employee Leave Status Interface . The Employee uses
this form to check status of the leaves submitted on monthly basis.
Steps to use Employee Leave Status Interface
1. This Interface belongs to Leave Status functionality.
2. The selection made by user to choose Pending Leave, Approved Leave, Rejected
Leave and All Leaves.
57
Figure 53: Interface Design of Employee Leave Status Selection Functionality
Mono-Android code of the Employee Leave Status Selection Interface
When the user logs into the interface, the codes behind LeaveStatusSel.axml and
EmpLeaveStatusSel.cs files are called.
4.1.5 Employee Leave List Interface
Figure 54, is a snapshot of the Employee Leave List Interface. The Employee uses
this form to check status of the leaves submitted on monthly basis.
Steps to use Employee Leave List Interface
1.
This interface is used by an Employee to check his/her Leave Status.
2. The application displays the StartDate, LeaveType and Status of Leave.
3. The start date mentioned in mm/dd/yyyy format.
58
4. This interface has Count Functionality that gives an Employee the Leave Count.
5. The Search and Sort functionality helps to search and sort Employee Leaves
respectively.
Figure 54: Interface Design of Employee Leave List Functionality
Mono-Android code of the Employee Leave List Interface
When the user logs into the interface the codes behind ‘EmployeeLeaveList.axml’,
‘EmployeeLeaveList.cs’,’ EmployeeListAdapter.cs’ and ‘EmployeeLeaveSupport.axml’
files are called.
Web-Service code of the Employee Leave List Interface
As illustrated in Figure 55, Employee Leave Status’ Interface Leave the
‘EmpSelMenu.xml’ file is used for navigation.
59
[WebGet(UriTemplate = "LeaveData/{LoginId}",BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
ILeaveData GetLeaveDataObject(string LoginId);
Figure 55: LeaveData API code
In Service Layer of Web-Service, ‘LeaveData’ method called to get data. In Data
Layer of Web-Service, ‘GetLeaveData’ method is called to get data.’GetEmployeeLeave’
Stored Procedure is called to extract data from database in JSON format.
4.1.6 Employee Leave Detail Interface
Figure 56, is a snapshot of the Employee Leave Detail Interface. The Employee uses
this form to check the status and obtain the leaves on monthly basis.
Steps to use Employee Leave Detail Interface
1. This Interface gives the detail of the Selected Employee Leave.
2. The start date and end date of leave are mentioned using this Interface.
3. The count of number of absent days is also shown.
4. The type of leave and leave note sent by employee to supervisor appears on this
Interface.
5. The response given by Supervisor appears.
6. The back button is used for Backward Navigation to Leave Status Interface
60
Mono-Android code of the Employee Leave Detail Interface
When the users logs into the interface the codes behind ‘LeaveDetail.axml ‘and
‘EmployeeLeaveDetail.cs’ files are called.
Figure 56: Interface Design of Employee Leave Detail Functionality
4.1.7 Employee Report Interface
Figure 57, is a snapshot of the Employee Report Interface. The Employee uses this
form to check status and obtain the leaves: Period Wise, Weekly, Monthly, Quarterly and
on Yearly basis.
Steps to use Employee Report Interface
1. This is an Employee Report Interface.
2. The leaves can be selected Period Wise, Weekly, Monthly, Quarterly and on
Yearly basis.
61
Figure 57: Interface Design of Employee Report Functionality
Mono-Android code of the Employee Report Interface
When the user logs into this interface, the codes behind Report.axml and
EmployeeReport.cs files are called. The SelMenu.xml file is used for navigation.
4.1.8 Employee Date Report Interface
Figure 58, is a snapshot of the Employee Date Report Interface. The Employee uses
this form to obtain his Leaves in certain period.
Steps to use Employee Date Report Interface
1. The user enters the start date and end date.
2. Then the user clicks on the Submit button
62
Figure 58: Interface Design of Employee Date Report Functionality
Mono-Android code of the Employee Date Report Interface
When the user logs into this interface, the codes behind ‘DateReport.axml’ and
‘EmployeeDateReport.cs’ file are called. The ‘EmpReportMenu.xml’ file is used for
navigation.
63
4.1.9 Employee Week Report Interface
Figure 59, is a snapshot of the Employee Week Report Interface. The Employee uses
this form to obtain his Leaves on a weekly basis.
Steps to use Employee Week Report Interface
1. The user must enter date.
2. Then user clicks on the Submit button
Figure 59: Interface Design of Employee Week Report Functionality
Mono-Android code of the Employee Week Report Interface
When the user logs into this interface, the codes behind ‘WeeklyReport.axml’ and
‘EmployeeWeeklyReport.cs’ files are called.
64
4.1.10 Employee Month Report Interface
Figure 60, is a snapshot of the Employee Month Report Interface. The Employee uses
this form to obtain his Leaves on a monthly basis.
Steps to use Employee Month Report Interface
1. The user must enter month.
2. Then user clicks has to click on the Submit button
Figure 60: Interface Design of Employee Month Report Functionality
Mono-Android code of the Employee Month Report Interface
When the user logs into this interface, the codes behind ‘MonthlyReport.axml’ and
‘EmployeeMonthlyReport.cs’ files are called.
65
4.1.11 Employee Quarter Report Interface
Figure 61, is a snapshot of the Employee Quarter Report Interface. The Employee
uses this form to obtain his Leaves on quarterly basis.
Steps to use Employee Quarter Report Interface
1. The user selects the desired quarter from the dropdown menu.
2. Then user clicks on the Submit button
Figure 61: Interface Design of Employee Quarter Report Functionality
Mono-Android code of the Employee Quarter Report Interface
When the user logs into this interface, the codes behind ‘QuarterlyReport.axml’ and
‘EmployeeQuarterlyReport.cs’ files are called. The’ EmpReportMenu.xml’ file is used
for navigation and the’ QuarterArray.xml’ file contains Quarters.
66
4.1.12 Employee Yearly Report Interface
Figure 62, is a snapshot of the Employee Yearly Report Interface. The Employee uses
this form to obtain his Leaves on yearly basis.
Steps to use Employee Yearly Report Interface
1. The user selects the desired year from the dropdown menu.
2. Then user clicks on submit button.
Figure 62: Interface Design of Employee Yearly Report Functionality
Mono-Android code of the Employee Yearly Report Interface
When the user logs into this interface, the codes behind ‘YearlyReport.axml’ and
‘EmployeeYearlyReport.cs’ files are called. ‘The EmpReportMenu.xml’ file is used for
navigation.
67
Web-Service code of the Employee Yearly Report Interface
As illustrated in Figure 63, “GetYear” API code, the values are retrieved from the
database and passed from ‘Get Year’ web-service API to the Yearly Report Interface in
JSON format.
[WebGet(UriTemplate = "GetYear",BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
List<YearData> GetYear();
Figure 63: GetYear API code
In Service Layer of Web-Service, ‘GetYear' method is called to get data. In Data
Layer of Web-Service, ‘GetYearData’ method is called to get data.’GetLeaveYear’
Stored Procedure is called to extract data from database.
4.1.13 Employee Report List Interface
Figure 64, is a snapshot of the Employee Report List Interface. The Employee uses
this form to obtain his Leaves in selected period. The system displays the Start Date,
Leave Type and count of Leaves taken.
Steps to use Employee Report List Interface
1. Search and Sort functionality provided.
2. When the user enters single numeric character from 0-9 in search text box, the list
of leaves starting with the numeric character displays.
3. Sort functionality displays the leaves in ascending or descending order.
4. Count of total number of absence days displayed.
5. Count of Sick and Vacation days are displayed.
68
6. Further, Type of Leave and Leave Note send by Employee to Supervisor appears.
7. The response given by the supervisor displays.
8. Back button is used for Backward Navigation to Employee Report Interface
Mono-Android code of the Employee Report List Interface
When the user logs into this interface, the codes behind ‘EmployeeReportList.axml’,
‘EmployeeReportSupport.axml’, ‘EmployeeReportList.cs’,
‘EmployeeReportListAdapter.cs’ are called.
Figure 64: Interface Design of Employee Report List Functionality
Web-Service code of Employee Report List Interface
As illustrated in Figure 65,“GetEmpReport’ API code , where the employeeid, start
date, end date and dt values(flag) are passed from the Employee Report List Interface to
the ‘GetEmpReport’ API of the web-service in JSON format. This API obtains Employee
Leaves for the specified period.
69
[WebGet(UriTemplate = "GetEmpReport/{EmpId}/{StartDate}/{EndDate}/{dt}",
BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
List<EmpReportData> GetEmpReport(string EmpId, string StartDate, string EndDate,string dt);
Figure 65 : GetEmpReport API code
As illustrated in Figure 66, in the Service Layer of Web-Service,
‘GetEmpReport’method is called to retrieve data. The Emp Id, Start Date, End Date, Flag
values passed from the Employee Report List Interface to the GetEmpReport Service
Layer. The values are stored in ‘EmpData’ object of ‘EmpReport’ Data class. In the
Service Layer values of date are manipulated from dummy values to ‘/’.The ‘EmpReport’
object is created of ReportLayer data layer class.
public List<EmpReportData> GetEmpReport(string EmpId, string StartPeriod, string EndPeriod,string dt){
IEmpReport IEmpData = new IEmpReport();
IEmpData.IEmpId = EmpId;
IEmpData.IStartPeriod = StartPeriod;
IEmpData.IEndPeriod = EndPeriod;
IEmpData.Idt = dt;
EmpReportData EmpData = new EmpReportData();
EmpData.EmpId = IEmpData.IEmpId;
EmpData.StartPeriod = IEmpData.IStartPeriod.Replace('S', '/');
EmpData.EndPeriod = IEmpData.IEndPeriod.Replace('E', '/');
EmpData.dt = IEmpData.Idt;
ReportLayer EmpReport = new ReportLayer();
return EmpReport.GetEmpReportData(EmpData);
Figure 66: GetEmpReportData Service Layer
As illustrated in Figure 67, in the Data Layer of Web-Service, ‘GetEmpLeaveReport’
method is called to insert data. In the Layer values are passed from service
layer.’EmpData’ object to data layer,’EmpData’. The SQL connection is formed and the
70
retrieved values are passed to store procedure,’GetEmpLeaveReport’.
public List<EmpReportData> GetEmpReportData(EmpReportData EmpData){
SqlCommand cmd = new SqlCommand("GetEmpLeaveReport", SqlConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@EmpNo", SqlDbType.VarChar);
cmd.Parameters["@EmpNo"].Value = EmpData.EmpId;
cmd.Parameters.Add("@FromPeriod", SqlDbType.VarChar);
cmd.Parameters["@FromPeriod"].Value = EmpData.StartPeriod;
cmd.Parameters.Add("@ToPeriod", SqlDbType.VarChar);
cmd.Parameters["@ToPeriod"].Value = EmpData.EndPeriod;
cmd.Parameters.Add("@dt", SqlDbType.VarChar);
cmd.Parameters["@dt"].Value = EmpData.dt;
List<EmpReportData> EmpReportListRet = new List<EmpReportData>();
try{
SqlConn.Open();
SqlDataReader reader = cmd.ExecuteReader();
Try
{
while (reader.Read())
{
EmpReportData EmpDataRet = new EmpReportData();
EmpDataRet.StartDate = reader.GetString(0);
EmpDataRet.EndDate = reader.GetString(1);
EmpDataRet.AbsenceDays = reader.GetInt32(2);
EmpDataRet.LeaveType = reader.GetString(3);
EmpDataRet.Note = reader.GetString(4);
EmpDataRet.Reason = reader.GetString(5);
EmpReportListRet.Add(EmpDataRet);
}
return EmpReportListRet;
}
}}}
Figure 67: GetEmpReport Data Layer
As illustrated in Figure 68, in the ‘GetEmpLeaveReport’ Stored Procedure, is called
to retrieve data from the database.This Stored Procedure passes the value – “(@EmpNo
varchar(10),@FromPeriod varchar(10),@ToPeriod varchar(10),@dt varchar(2))” into
Leave database. Selected leaves, Start date, End Date, Note, Reason, and Leave Type
71
values are obtained from the Leave database and passed back to the Employee Report
Interface.
USE [TimeOff]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetEmpLeaveReport](@EmpNo varchar(10),@FromPeriod
varchar(10),@ToPeriod varchar(10),@dt varchar(2))
AS
Begin
if @dt = 0
Select CONVERT(varchar(10),dbo.Leave.StartDate,11)as
StartDate,CONVERT(varchar(10),dbo.Leave.EndDate,11)as
EndDate,dbo.Leave.AbsenceDays,dbo.Leave.LeaveType,dbo.Leave.Note,dbo.Leave.Reason from
dbo.Employee,dbo.Leave where dbo.Employee.EmpNo = dbo.Leave.EmpNo and dbo.Leave.StartDate >=
@FromPeriod and dbo.Leave.StartDate <= @ToPeriod and dbo.Leave.Status = 'A' and
dbo.Employee.EmpNo = @EmpNo order by dbo.Leave.StartDate asc;
else if @dt = 1
Select CONVERT(varchar(10),dbo.Leave.StartDate,101)as
StartDate,CONVERT(varchar(10),dbo.Leave.EndDate,101)as
EndDate,dbo.Leave.AbsenceDays,dbo.Leave.LeaveType,dbo.Leave.Note,dbo.Leave.Reason from
dbo.Employee,dbo.Leave where dbo.Employee.EmpNo = dbo.Leave.EmpNo and dbo.Leave.StartDate >=
@FromPeriod and dbo.Leave.StartDate <= @ToPeriod and dbo.Leave.Status = 'A' and
dbo.Employee.EmpNo = @EmpNo order by dbo.Leave.StartDate asc;
else
return
END
Figure 68: GetEmpReport Stored Procedure
4.1.14 Supervisor Menu Interface
Figure 69, is a snapshot of the Supervisor Menu Interface. The Supervisor uses this
form to log into the Supervisor side functionality.
72
Steps to use Supervisor Menu Interface
1. The supervisor uses this Interface to navigate to the Leave Request functionality.
2. On clicking the Leave Report button, Supervisor side Employee Report appears.
Figure 69: Interface Design of Supervisor Menu Functionality
Mono-Android code of the Employee Report List Interface
When the user logs into this interface, the codes behind ‘SupervisorMenu.axml’ and
‘SupMenu.cs’ files are called. The’ SupSelMenu.xml’ file is used for navigation.
73
4.1.15 Supervisor Leave Request Interface
Figure 70, is a snapshot of the Supervisor Leave Request Interface. In this form, the
pending list of the employees is displayed to the Supervisor. The application displays the
Leave No, Employee Name and Submission Date.
Steps to use Supervisor Leave Request Interface
1. Leave count functionality displays total count of pending leaves.
2. Single character search functionality is provided. The user enters single numeric
character from 0-9 the leaves starting with that, number displays.
3. On clicking the sort functionality, the leaves are organized in an ascending or
descending order.
4. On clicking Urgent Leave, button all the leaves under urgent criteria display.
Figure 70: Interface Design of Supervisor Leave Request Functionality
74
Mono-Android code of the Supervisor Leave Request Interface
When the user logs into this interface, the codes behind
‘SupervisorLeaveAppList.axml’,’ SupervisorLeaveAppSupport.axml’,
‘SupervisorLeaveAppList.cs’, ‘SupervisorLeaveAppAdapter.cs’ files are called.
4.1.16 Supervisor Urgent Leave Selection Interface
Figure 71, is a snapshot of the Urgent Leave Selection Interface. Using this interface
the supervisor can set the selection on the number of days from the drop down menu. The
supervisor can select the brackets of days from 1 day to 7 days.
Steps to use Supervisor Urgent Leave Interface
1. On clicking, SET Urgent button on Supervisor Leave Request Interface the
Urgent Leave Selection interface displays.
2. Using the drop down the urgency bar can be set. From 1-7 days.
3. On clicking OK, the application displays the list of days for the selected days.
On clicking Cancel, the supervisor redirected back to the Supervisor Leave Request
Form.
75
Figure 71: Interface Design of Urgent Leave Selection Functionality
Mono-Android code of the Supervisor Urgent Leave Interface
As illustrated in Figure 72, in the “UpdateSupPref” API code, the ‘Supid’ and ‘wel’
(value of days) is passed from the Urgent Leave Interface to the ‘UpdateSupPref’ API of
the web-service in JSON format. When the user logs into this interface,
‘SupListMenu.xml’ file is used for navigation back to the Supervisor Leave Request
form.
[WebGet(UriTemplate = "UpdateSupPref/{SupId}/{Val}",BodyStyle =
WebMessageBodyStyle.WrappedRequest, ResponseFormat =
WebMessageFormat.Json)][OperationContract]
void UpdateSupPref(string SupId,string Val);
Figure 72:UpdateSupPref API code
76
Web-Service code of Employee Report List Interface
As illustrated in Figure 73, in the Service Layer of Web-Service, ‘UpdateSupPref’
method is called to retrieve data. The Supervisor Id and Flag values are passed from the
Supervisor Urgent Leave Interface to the ‘UpdateSupPref’ Layer. ‘SupPref’ object of
Data layer class is created ‘UpdateSupPref’ menthod is called and Supervisor Id and
Flag values are passed from the service layer to the Data Layer.
public void UpdateSupPref(string SupId, string Val){
DataLayer SupPref = new DataLayer();
SupPref.UpdateSupPref(SupId,Val);}
Figure 73 : UpdateSupPref Service Layer
As illustrated in Figure 74, in the Data Layer of Web-Service, ‘UpdateSupPref’
method is called to update values. In this, Layer Supervisor Id and Flag values are passed
from the Service Layer to the ‘UpdateSupPref’ data layer. The SQL connection is formed
and the retrieved values are passed to store procedure,’UpdateSupPref’.
SqlCommand cmd = new SqlCommand("UpdateSupPref", SqlConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@SupId", SqlDbType.VarChar);
cmd.Parameters["@SupId"].Value = SupId;
cmd.Parameters.Add("@Val", SqlDbType.VarChar);
cmd.Parameters["@Val"].Value = Val;
Figure 74:UpdateSupPref Data Layer
77
As illustrated in Figure 75,in the ‘UpdateSupPref’ Stored Procedure, is called to
update data from the database.This Stored Procedure passes the value – “((@SupId
varchar(50),@Val varchar)” into Leave database. For the Supervisor the Leave
Preference then gets sated.
ALTER PROCEDURE [dbo].[UpdateSupPref](@SupId varchar(50),@Val varchar)AS
Begin
update SupervisorPref set dbo.SupervisorPref.LeavePref = @Val where dbo.SupervisorPref.SupervisorNo
= @SupId;
END
Figure 75:UpdateSupPref Stored Procedure
4.1.17 Supervisor Leave Approval Interface
Figure 76, is a snapshot of the Supervisor Leave Approval Interface. Using this
interface the supervisor can approve or disapprove the pending leave.
Steps to use Supervisor Leave Approval Interface
1. On entering this form supervisor can go through the leave.
2. On clicking, the Approve button the status of leave changes from pending to
approve.
3. On clicking the Not approve button status changed from pending to not approve.
78
Figure 76: Interface Design of Supervisor Leave Approval Functionality
Mono-Android code of the Supervisor Leave Approval Interface
When the user logs into this interface the codes behind ‘SupervisorDetail.axml’ and
‘EmployeeReportDetail.cs’ files are called The ‘SupListMenu.xml’ file is used for
navigation.
Web-Service code of the Supervisor Leave Approval Interface
As illustrated in Figure 77, in the ‘SupEmpLeaveDetail’ API, the ‘LeaveNo’ is passed
from the Super Leave Approval Interface to the ‘SupEmpLeaveDetail’API of the webservice in JSON format.
[WebGet(UriTemplate = "SupEmpLeaveDetail/{LeaveNo}",BodyStyle =
WebMessageBodyStyle.WrappedRequest, ResponseFormat =
WebMessageFormat.Json)]SupLeaveRequestServiceDetailData GetSupEmpLeaveDataDetail(string
LeaveNo);
Figure 77: SupEmpLeaveDetail API code
79
In Service Layer of Web-Service, ‘SupEmpLeaveDetail’ method is called to change
status of leave. In Data Layer of Web-Service, ‘GetSupEmpLeaveDetail’ method is
called to update data.’GetSupEmpLeaveDetail’ Stored Procedure is called to update data
from database.
4.1.18 Supervisor Leave Dis-Approval Interface
Figure 78, is a snapshot of the Supervisor Leave Dis-Approval Interface. Using this
interface the supervisor can disapprove leave, stating the reason for disapproval.
Steps to use Supervisor Leave Approval Interface
1. On entering this form supervisor enters the rejection message and then press ok or
cancel button.
2. On clicking, the Ok button the rejection message is passed from interface to
‘SupEmpLeaveDetail’ Web-Service.
3. On clicking the cancel button, the supervisor is redirected to the
‘SupervisorEmployeeReportList’ Interface.
80
Figure 78: Interface Design of Supervisor Leave Dis-Approval Functionality
4.1.19 Supervisor Employee Report Interface
Figure 79, is a snapshot of the Supervisor Employee Report Interface. This Interface
is provided to the supervisor to obtain the approved leaves of all the employees or the
selected employee.
Steps to use Supervisor Employee Report Interface
1. The supervisor selects the employee from the list of given employees present in
the drop-down.
2. The supervisor can select the name of the employee from the downtown menu.
3. The supervisor can also use the search function provided to find the employee.
4. The application then auto populates the name of the employee in ‘Selected Emp’.
5. The supervisor can select the leave type from the drop down menu.
81
6. On clicking the period button the Supervisor is redirected to Period wise search
interface(Figure 58).OR
7. On clicking the period button the Supervisor is redirected to Weekly search
interface (Figure 59).OR
8. On pressing the period button the Supervisor is redirected to Monthly search
interface(Figure 60).OR
9. On pressing the period button the Supervisor is redirected to Quarterly search
interface(Figure 61).OR
10. On pressing the period button, the Supervisor is redirected to Yearly search
interface (Figure 62).
Mono-Android code of the Supervisor Employee Report Interface
When the user logs into this interface, the codes behind
‘SupervisorEmpReportList.axml’,’ SupervisorEmpReportSupport.axml’,
‘SupEmpReportList.cs’ and ‘SupEmpReportListAdapter.cs’ files are called. The
‘SupEmpReport.xml’ file is used for navigation.
82
Figure 79: Interface Design of Supervisor Employee Report Functionality
Web-Service code of the Supervisor Employee Leave Report Interface
As illustrated in Figure 80, In the‘GetEmpName’ API code, the ‘Supid’ is passed
from the Supervisor Employee Leave Report interface to the ‘GetEmpName’ API of the
web-service in JSON format.
[WebGet(UriTemplate = “GetEmpName/{SupId}”,BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
List<EmpNameData> GetEmpName(string SupId);
Figure 80: GetEmpName API code
In Service Layer of Web-Service, ‘GetEmpName’ method is called to get data. In
Data Layer of Web-Service, ‘GetEmpNameData’ method is called to get
data.’GetEmpName’ Stored Procedure is called to extract data from database.
83
4.1.20 Supervisor Employee Report List Interface
Figure 81, is a snapshot of the Supervisor Employee Report List Interface. This
Interface is provides the supervisor to obtain list of approved leaves of all the employees
or the selected employees. A List of Employee Names and count of their Absence Days
displays, Aggregation of Total Leaves, Sick and Vacation Leaves is also displayed.
Steps to use Supervisor Employee Report List Interface
1. On clicking the Ascending sort by Name button leaves is sorted in an ascending
order of Employee Name.
2. On clicking the Descending sort by Name button leaves gets sorted in a
descending order of Employee Name
3. On clicking, the Ascending sort by Absence Days button leaves is sorted in
ascending order by Absence Days.
4. On clicking the Descending sort by Absence Days button leaves is sorted in
descending order by Absence Days.
5. On entering character in Employee Search text. The entire Employee name
starting with that character is filtered.
Mono-Android code of the Supervisor Employee Report List Interface
When the user logs into this interface, the codes behind
‘SupervisorEmpReportList.axml’,’ SupervisorEmpReportSupport.axml’
‘SupervisorReportListAdapter1.cs’,’ SupervisorReportListAdapter2.cs’ files are called.
84
Figure 81: Interface Design of Supervisor Employee Report List Functionality
Web-Service code of the Supervisor Employee Leave Report Interface
As illustrated in Figure 82 , in the ‘GetSupReport’ Restful Interface, Supervisor Id,
Start Date, End Date and Flag value is passed from the Supervisor Employee Leave
Report interface to the ‘GetSupReport’ API of the web-service in JSON format.
[WebGet(UriTemplate = "GetSupReport/{SupId}/{StartDate}/{EndDate}/{Val}",BodyStyle =
WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
List<SupReportData> GetSupReport(string SupId, string StartDate, string
Figure 82 : GetSupReport API code
‘GetSupReport’ , ‘GetSupReportData’ and ‘GetSupLeaveReport’ are its service Layer
method, Report Layer method and Stored Procedure respectively.
85
Chapter 5
SUMMARY AND FUTURE WORK
Objective of the project was to develop an automated service keeping track of an
employees' leave absence regularly, through android mobile devices, with extensible
features for internet devices.
Supervisor and Employee are two application users within this project. It had five
functionalities. Insert Leave, Leave Status and Employee Report functionalities were
Employee side functionalities. Supervisor Leave Approval and Supervisor Leave Report
were Supervisor side functionalities.
The Design of Project is feasible using Monolithic Approach. The advantage of the
Monolithic Approach as compared to Service Oriented Architecture is that the time taken
to retrieve the data from the database is less. The project is designed using Service
Oriented Architecture for further extensibility whereas Monolithic Approach is limited
with extensibility.
The mobile service was an n-tier application developed using .net 3.5 framework.
Mobile Service designed using Restful service, integrated with SQL-SERVER 2008
database as well as with mono-android interfaces.ADO.net helped to integrate with the
SQL-SERVER database.
Further extension of the project includes the service to cloud system. In addition, the
service can integrate available clouds. Service further extends to cross-platform
application.
86
APPENDIX A. Initial Steps of Development
The appendix explains, the development of the project using the code of Login
functionality.
Restful Service Design
‘System.ServiceModel’ and ‘System.ServiceModel.Web’are the two service references
used within the project to develop the restful web-service.The two namespaces contains
Libraries that are used to develop Restful Service Design
Interface of Web-Service
This is the ‘get’ uri template defined for ‘get’ request.The Email and Password
parameter map to the Email and Passsword variable mentioned in ‘LoginObject’.The
response is sent back in JSON format. The users can extract the resource from the
database using the login service contract. The request obtained from the user is stored in
‘IEmail’ and ‘IPassword’ data member and the login id provided to the interfaces are
collected from the databases.The service behaviour converts class to web-service class. In
this project, the web‘Service’ class is inhereted by Iservice web interface class. The
Service.svc file defines the file in which classes belonging to WCFService4.Service"
service is mentioned as:
87
[ServiceContract]
public interface IService
{
[WebGet]
UriTemplate = "Login/{Email}/{Password}",BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
string LoginObject(string Email, string Password);
}
[DataContract]
public class ILogin
{
[DataMember]
public string IEmail;
[DataMember]
public string IPassword;
[DataMember]
public string ILoginId;
}
[ServiceBehavior]
public class Service : IService
{}
<%@ ServiceHost Language="C#" Debug="true" Service="WCFService4.Service"
CodeBehind="~/App_Code/Service.cs" %>
88
Web-Config File
The web config file defines the end point of the web-service.This end point defines
the way to communicate with the web-service.The ABC of the end point
are:Address,Behaviour Configuration and Contract.The address specifies the where the
web-service is located.In the project web-service is deployed on IIS server. So the client
uses its IIS server address for communication.Binding defines the transport protocol used
for message exchange.Contract defines the message contained in transportaton.WebHttp
behaviour is configured to the endpoint. The web-config file is:
<system.serviceModel><services>
<service behaviorConfiguration="Default" name="WCFService4.Service">
<endpoint address="" behaviorConfiguration="httpBehavior" binding="webHttpBinding"
contract="WCFService4.IService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Default">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="httpBehavior"><webHttp/></behavior></endpointBehaviors></behaviors>
89
IIS-7 Server
Internet Information Service (IIS) is a flexible, secure and manageable web-server for
hosting anything on web.It can be downloaded from http://www.iis.net/.After installing,
its properties are set by going to control panel-> programs ->. Turn features on and off,as
per requirements of project.The project has used Web management tools, Miscrosoft .Net
Framework 3.5.1 and Windows Process Activation Service. Figure 81 is the snap shot of
the IIS Server Configuration properties.
Figure 83: IIS Server Configuration Properties
90
Web-Service Deployment
After checking the web-service on Asp.net development server.The IIS management
tool is launched and add the developed site to IIS using ‘add site’ button.The IIS server
defines its alias name,Application pool and Physical path. The physical path should be as
small as possible to avoid confusion, following which ,all the files gets deployed IIS
server.Click on ‘.svc file’ browse and the site is launched on the web browser.The website is launched on http 80 or http 8080 port.The url obtained is used at client side to
form comunication between client and server.Figure 82 is a snap shot of the IIS server.
Figure 84: Snapshot of the IIS Server
Database Deployment
IIS Database Manager is an extension of IIS Manager.It allows to manage local and
remote databases from IIS Manager.It automatically discovers databases on the Web
Server and also provides the ability to connect any database.It supports Microsoft SQL
server and MS SQL.It provides functionalities to manage tables,views,stored procedures
and data as well as running of ad hoc queries.
91
It can be downloaded from www.iis.net.After the Database Manager is downloaded
and installed, click on added site(wcf), then on features view for that site, then on
Database Manager in IIS manager and then on Connection String.Then add connection
string of the database by specifying SQL server credentials like server name ,database
name , UserId and Password of the database. After the connection string is formed
database gets added to IIS Database Manager.On clicking the database manager in
features view database belonging to wcf site can be retrived.Figure 83 depicts the
Snapshot of Database Connection String.
Figure 85: Snaptshot of Database Connection String
The Connection string gets added to the Web-Config file of the deployed site.Below
mentioned snap shot. Figure 84 depicts that the database has been successfully added to
Database Manager.
Figure 86: Snapshot of Database Manager
The Connection string gets added to the Web-Config file of the deployed
site.Database time-off connection string is described as:
92
<connectionStrings>
<remove name="TimeOffConn1"/>
<remove name="LocalMySqlServer"/>
<remove name="Local"/>
<add connectionString="Server=komal-HP;Database=TimeOff;User ID=kc;Password=kc"
name="TimeOff"/>
</connectionStrings>
In the data layer of the web-service add the following code to get connected with the
database. This code will retrieve connection string added in the Web- Configuration file
of the web-service.
public static string ConnString =
System.Configuration.ConfigurationManager.ConnectionStrings[0].ConnectionString;
SqlConnection SqlConn = new SqlConnection(ConnString);
Mono-Android Installation
First, install the .net 4.0 framework with VS-2010 ultimate version on windows
machine. From the official site of “XAMARIN”, the trial version of Android is
downloaded. This will install Java Development Kit, Android Software Development Kit,
and plugin for VS-2010.It is installed in C drive under “XAMARIN” folder. The Android
operating system and target hardware selected for the project by going to its properties.
Web-Service Connectivity
In project, “HTTPWEBREQUEST” mechanism is used to grab data from a REST,
service.It is at the core of many of the convenience libraries available.
93
There are other ways to grab data like Web Client, Rest Sharp, Hammock, NSURL
Connection, and Service Stack. Data extracted in JSON format.System.Net, System.IO,
System.JSON are the libraries imported for extracting objects in JSON format. Following
snippet code mentioned in the Interface Class. It gets Login ID of user from database
using Rest Web-Service. The hpptWebRequest passed from the interface to the webservice. ‘IEmail’ and ‘Ipassword’ are passed and the ‘Iloginid’ is retrieved in JSON
format. The developed Application is built and deployed on Android emulator
public void PostJsonLogin (JsonLoginData JLogin)
{
try
{
var request1 = HttpWebRequest.Create (string. Format (@IP.IPAddress + "Login/" + JLogin.JEmail + "/" +
JLogin.JPassword)); //url of service endpoint
request1.ContentType = "application/json"; //content is obtained in JSON format request1.Method =
"GET";
HttpWebResponse response = request1.GetResponse () as HttpWebResponse;
StreamReader reader = new StreamReader (response.GetResponseStream ());
var content = reader.ReadToEnd ();
JLogin.JLoginId = content;
reader. Close ();
response. Close ();
}
catch
}}
94
Bibliography
[1] Mono-Android, URL: http//www.xamarin.com.
[2] Plural Sight, URL: http//www.pluralsight.com.
[3] Restful Web-Services, URL: http//www.microsoft.com.
[4] .NET FRAMEWORK, ‘MSDN The Microsoft Developer Network’, .NET
FRAMEWORK version 3.5, Date 2007-11-20, URL: http://www.microsoft.com.
[5] Mono-Android-Framework, ‘XAMARIN Create ios, Android, Mac and Windows
apps in c#’, Mono-Android version Trial, Date 2012-01-11, URL:
http://www.xamarin.com.
[6] IIS-7 Framework, ‘IIS The Official Microsoft IIS Site’, IIS version 7, Date 2012-0904, URL: http://www.iis.net.
Related documents