Acknowledgement

First of all, I owe my deepest gratitude to my database and web database systems lecturerMr.Thangavel Saravanan, whose encouragement, guidance and support from the beginning to the final stages enabled me to develop an understating of the database systems and web programming. Finally I thank you for all who supported during the completion of the project.

1

Table of contents

Assumptions .................................................................................................................... 3 ER Diagram ..................................................................................................................... 4 Database functions .......................................................................................................... 7 Rules ............................................................................................................................ 7 User defined data types ............................................................................................... 7 Stored Procedures ....................................................................................................... 8 Triggers ...................................................................................................................... 11 Views .......................................................................................................................... 12 Screen Design ............................................................................................................... 13 DDL Statements ............................................................................................................ 21 References .................................................................................................................... 27

2

Assumptions
Every problem type is assigned with one or more than specialist.  

Equipment has only one manufacturer. 

Specialist does not need any caller¶s information to solve the problem only problem details and equipment details are required. (Caller information is encapsulated from the specialist). 

Every equipment is belongs to an equipment type and that equipment type has a specified problem category. 



Caller¶s problem logging time and server time are synchronized. One problem belongs to only one problem type and there can be more than one solution for that problem type

3

ER Diagram

4

Normalization
Un Normalized form Problem (ProblemID,CalllogID,Date,Time,CallerID,DepID,ProblemCatogory,ProblemType,Assign ed_Specalist_ID,Comments,Solution Description ) Calllog(Call_ID,Caller_ID,Name,Department,Problem_ID,Operator_ID,Date,Time,Probl em_count) Equipment(Equipment_ID, Name, Type, Manufacturer)

First Normalized form Problem (ProblemID,CalllogID,Date,Time,CallerID,DepID,Problem_Catogory,Problem_Type,Assi gned_Specalist_ID,Comments,Solution Description ) Department(Department_ID,Name,Number_of_emp) Equipment(Equipment_ID, Name, Type, Manufacturer, Equipment_Type_ID) Equiment_Type(Equipment_Type_ID,Desc) Manufacturer(Manifactuer_ID,Name) Calllog(Call_ID,Caller_ID,Name,DepartmentID,Problem_ID,Operator_ID,Date,Time,Pro blem_count)
5

Solution(Solution_ID, Solution_Desc, Specalist_ID) Problem_Catogory(Catolory_ID,Desc,Equipement_Type) Problem_Type(Problem_Type,Desc, Catolory_ID)

Second and third normalization form

Problem (ProblemID,CalllogID,,,CallerID,,Problem_Catogory,Problem_Type,Assigned_Specalist _ID,Comments,) Department(Department_ID,Name,Number_of_emp) Equipment(Equipment_ID, Name, Type, , Equipment_Type_ID) Equiment_Type(Equipment_Type_ID,Desc) Manufacturer(Manifactuer_ID,Name) Calllog(Call_ID,Caller_ID,Name,DepartmentID,Problem_ID,Operator_ID,Date,Time,Pro blem_count) Caller(Caller_ID,Name,DepartmentID) Solution(Solution_ID, Solution_Desc, Specalist_ID) Problem_Catogory(Catolory_ID,Desc,Equipement_Type)

6

Problem_Type(Problem_Type,Desc, Catolory_ID)

Database functions
Rules SQL rules are created to restrict the user input values to selected columns for example the operator ID should start with µOP¶ if not data cannot be inserted. The following table shows the rules which are used in this database.
Name Purpose Definition

Admin_id

Restrict Administration ID should start with µADMIN¶

CREATE rule AS @value LIKE 'ADMIN%[09]'

Op_idule

Restrict operator ID should start with µOP

CREATE RULE [dbo].[op_idrule] AS @value LIKE 'OP%[0-9]' CREATE RULE [dbo].[specalist_idrule] AS @value LIKE 'SP%[0-9]'

Specialist_idrule

Restrict specialist ID should start with µSP¶
Table 1 ± SQL Rules

User defined data types

Name

Purpose

AdministratorID

Adminstrator¶s ID always starts with ADMIN and increment the numeric value Operator ID always start with OP and increment the numeric value Specialist ID always start with SP and
7

OperatorID SpecialistID

increment the numeric value
Table 2 ± SQL user defined data types

Stored Procedures

Parameters Name Purpose IN OUT

Assign_Specialist

Assign a specific specialist to a problem

Problem ID

Assigned specialist ID

fowardProblem

Forward the problem to a another specialist

Problem ID

Newly assigned specialist ID

getCalllogBYID

Get the calllog by calllog ID

Calllog ID

CallLog

getDep

Get all available departments

getDeparmentByEquipmentId

Get the all equipment which belongs to a department

DepartmentID

Equipment details

8

getDepartmentByUserID

Get department information by CalllerID

Caller ID

Department Details

geteqibyID

Get equipment Equipment ID information by ID

Equipment details

getEqu

Get all equipment details

getEquipmentDetailsByProblemID Get the equipment details which belongs to a problem getEquipmentTypes Get all the equipment types getinfoByProblemID Get the problem information by Problem ID getLogin Login for operator getLoginAdmin Login for administrator

Problem ID

Equipment details

Get all the equipment types

Problem ID

Problem Details

Username,password boolean

Username,password boolean

9

getLoginsp

Login for specialist

Username,password boolean

getManifacturer

Get all Manufacturers

getProblemByEquipmentID

Get problem details which belongs to a equipment

Equipment ID

getSpecalistByID

Get specialist details by specialist ID

Specialist ID

newCaller

Create a new caller

Caller details

newCalllog

Create a new call log

Calllog details

NewEquipment

Create new equipment

Equipment details

newsolution

Create a new solution for a problem

ProblemID ,Solution details

setReputation

Update the reputation of the specialist

Specialist ID

New reputation

timelineByCaller

Get the caller history

Caller ID

Table 3 ± Stored procedures

10

11

Triggers

Name updateeqtype

Table Equipment

Action

Description

INSERT,UPDATE,DELETE When equipment is inserted or updated the Equipment type table¶s Quantity will be updated.

Update_problems_in_calllog Problem

INSERT

Update the problem count in call log when a new problem is created.

Numberofcallers

Department

INSERT,UPDATE,DELETE Update the number of employees in the department

Table 4± Triggers

12

Views

Name

Purpose To access caller

Tables

Calllog_Problem

information and problem information in one query Encapsulate the caller

Problem, Calllog

View_Specalist_Problem

information from the specialist

Problem, Specialist

Specalization_sp_pc

Specialist and his specialization details To view the problem type and the solution
Table 5± Views

Specialization , Specialist and problem category Problem Type, Solution

Problem Type_Solution

13

Screen Design
Login Screen

Figure 1 - Login Screen

14

Operator Main Screen

Figure 2 - Operator Main menu

15

New Troubleshooting

Figure 3 - New troubleshooting

16

Common Solutions

Figure 4 - Common solutions

17

Troubleshooting Status

Figure 5 - Troubleshooting status

18

Assigned specialist

Figure 6 - Assigned Specialist details

19

Specialist problem view

Figure 7 - Problems assigned to specialist

20

New Solution

Figure 8 - New Solution

21

DDL Statements
Stored procedures

ALTERproc [dbo].[Assign_Specialist] @prob_cat_id varchar(10),@Calllog_ID int,@Equipment_ID int,@Problem_Catogory_ID varchar(10),@Problem_Type_ID varchar(10),@Comments text AS

Stored Procedure ± Assign_Specalist

begintransaction declare @sp_id varchar(10) SELECT @sp_id=Specialist_ID FROM Specialization WHERE Problem_Catogory_ID=@Problem_Catogory_ID ORDERBYNEWID() INSERTINTO problem values(@Calllog_ID,@Equipment_ID,@prob_cat_id,@Problem_Type_ID,@sp_i d,0,@Comments,null) declare @call_id int declare @problem_id int selecttop 1 @call_id=Call_ID from calllog orderby Call_ID desc selecttop 1 @problem_id=Problem_ID from problem orderby Problem_ID desc UPDATE calllog SET Problem_ID=@problem_id WHERE CALL_ID=@call_id commit

22

ALTERproc [dbo].[fowardProblem] @prob_id varchar(10) AS declare @prob_type int declare @sp_id varchar(10) declare @sp_name varchar(50)
Forward Problem

SELECT @prob_type=Problem_Type_ID FROM Problem WHERE Problem_ID=@prob_id SELECT @sp_id=Specialist_ID FROM Specialization WHERE Problem_Catogory_ID=@prob_type ORDERBYNEWID()

SELECT @sp_name=NameFrom Specialist WHERE Specialist_ID=@sp_id

UPDATE Problem SET Assigned_Specalist_ID=@sp_id WHERE Problem_ID=@prob_id SELECT @sp_id AS New_SP,@sp_name ASName ALTERPROC [dbo].[getLogin] @username varchar(50),@password varchar(50) AS

Login

ifexists(SELECT*FROM Operator WHERE OperatorID=@username AND PASSWORD=@password) BEGIN return 1 END else return 0

23

New call log

ALTERproc [dbo].[newCalllog] @callerid varchar(10),@problemid varchar(10),@operatorid varchar(10), @date varchar(10), @stime varchar(10) AS INSERTINTO calllog values(@callerid,@problemid,@operatorid,@date,@stime,0)

ALTERproc [dbo].[newsolution] @solution varchar(50),@problem_id int,@specalist varchar(10) AS declare @prob_type_id varchar(10)

New solution

SELECT @prob_type_id=Problem_Type_ID from problem WHERE problem_id=@problem_id

INSERTINTO Solution values(@solution,@prob_type_id,@specalist) declare @solution_id int SELECTtop 1 @solution_id=Solution_ID FROM solution ORDERBY Solution_ID DESC PRINT @solution_id UPDATE problem set solution_ID=@solution_id,status=1 WHERE Problem_Id=@problem_id ALTERproc [dbo].[setReputation] @sp_id varchar(50),@level int AS

Set reputation

declare @currentrep int declare @newrep int

SELECT @currentrep=Reputation FROM Specialist WHERE Specialist_ID=@sp_id SET @newrep=@currentrep+@level

UPDATE Specialist SET Reputation=@newrep WHERE Specialist_ID=@sp_id

24

getEquipment by

Departmnt ID

ALTERproc [dbo].[getDeparmentByEquipmentId] @eqid int AS SELECT*FROM Department WHERE depID=(SELECT depID FROM Equipment WHERE EquipmentId=@eqid)

ALTERproc [dbo].[getinfoByProblemID] @problem_id int as

declare @caller_id varchar(10) declare @sp_id varchar(10) declare @status int declare @op_id varchar(10)
Gerinfo by problemID

SELECT @caller_id=caller_id FROM CallLog WHERE problem_id=@problem_id SELECT @sp_id=Assigned_Specalist_ID FROM problem WHERE Problem_ID=@problem_id SELECT @status=status from problem WHERE Problem_ID=@problem_id SELECT @op_id=Opeartor_ID FROM CallLog WHERE Problem_ID=@problem_id SELECT Date,Caller=(SELECTNamefrom Caller WHERE CallerID=@caller_id),SP=(SELECTnamefrom Specialist WHERE Specialist_ID=@sp_id),@status As Status,@op_id as Operator from calllog WHERE problem_id=@problem_id

getDeparmentB

yEquipmentId

ALTERproc [dbo].[getDeparmentByEquipmentId] @eqid int AS SELECT*FROM Department WHERE depID=(SELECT depID FROM Equipment WHERE EquipmentId=@eqid)

25

Caller timeline

ALTERproc [dbo].[timelineByCaller] @callerid varchar(10),@startdate varchar(12),@enddate varchar(12) as

SELECT*FROM calllog WHERE caller_id=@callerid AND date BETWEEN @startdate AND @enddate ORDERBY date,time

Table 5± DDL for stored procedures

26

Triggers

ALTERTRIGGER [dbo].[updateeqtype] ON [dbo].[Equipment] FORINSERT,UPDATE,DELETE AS Update Eq type Update No.Probems Number of callers declare @eqtype_id varchar(10) declare @cnt int SELECT @eqtype_id=CatogoryID FROM inserted

SELECT @cnt=count(*)FROM Equipment WHERE CatogoryID=@eqtype_id Update Equipment_type SET Quantity=@cnt WHERE Eq_type_ID=@eqtype_id ALTERTRIGGER [dbo].[update_problems_in_calllog] ON [dbo].[Problem] FORINSERT,UPDATE,DELETE AS declare @calllog_id varchar(10) declare @cnt int SELECT @calllog_id=Calllog_ID FROM inserted

SELECT @cnt=count(*)FROM Problem WHERE Calllog_ID=@calllog_id Update calllog SET Problem_count=@cnt WHERE Call_ID=@calllog_id ALTERTRIGGER [dbo].[updatenumcallers] ON [dbo].[Caller] FORINSERT,UPDATE,DELETE AS declare @caller_id varchar(10) declare @cnt int SELECT @caller_id=DepID FROM inserted

SELECT @cnt=count(*)FROM Caller WHERE DepID=@caller_id Update Department SET No_Employees=@cnt WHERE DepID=@caller_id
Table 5± DDL for triggers

27

References
JQuery(2010).The jQuery Project[Online].Available from:http://jquery.com/ [Accessed 9 July 2010].

28

Sign up to vote on this title
UsefulNot useful