Vous êtes sur la page 1sur 24

Acknowledgement

First of all, I owe my deepest gratitude to my database and web database systems
lecturer Mr.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)

5
Calllog(Call_ID,Caller_ID,Name,

DepartmentID,Problem_ID,Operator_ID,Date,Time,Problem_count)

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)

6
Problem_Catogory(Catolory_ID,Desc,Equipement_Type)

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 CREATE rule
AS
should start with ‘ADMIN’
@value LIKE 'ADMIN%[0-
9]'
Op_idule Restrict operator ID CREATE RULE [dbo].
[op_idrule]
should start with ‘OP
AS
@value LIKE 'OP%[0-9]'
Specialist_idrule Restrict specialist ID CREATE RULE [dbo].
[specalist_idrule]
should start with ‘SP’
AS
@value LIKE 'SP%[0-9]'
Table 1 – SQL Rules

User defined data types

Name Purpose
Adminstrator’s ID always starts with
AdministratorID
ADMIN and increment the numeric value
Operator ID always start with OP and
OperatorID
increment the numeric value
SpecialistID Specialist ID always start with SP and

7
increment the numeric value
Table 2 – SQL user defined data types

Stored Procedures

Parameters
Name Purpose
IN OUT
Assign_Specialist Assign a Problem ID Assigned
specific specialist
specialist to a ID
problem
fowardProblem Forward the Problem ID Newly
problem to a assigned
another specialist
specialist ID
getCalllogBYID Get the calllog Calllog ID CallLog
by calllog ID

getDep Get all


available
departments

getDeparmentByEquipmentId Get the all DepartmentID Equipment


equipment details
which belongs
to a
department
getDepartmentByUserID Get Caller ID Department
department Details
information by
CalllerID

8
geteqibyID Get equipment Equipment ID Equipment
information by details
ID

getEqu Get all


equipment
details

getEquipmentDetailsByProblemI Get the Problem ID Equipment


D equipment details
details which
belongs to a
problem
getEquipmentTypes Get all the Get all the
equipment equipment types
types

getinfoByProblemID Get the Problem ID Problem


problem Details
information by
Problem ID
getLogin Login for Username,passwor boolean
operator d

getLoginAdmin Login for Username,passwor boolean


administrator d

getLoginsp Login for Username,passwor boolean


specialist d

getManifacturer Get all


Manufacturers

getProblemByEquipmentID Get problem Equipment ID

9
details which
belongs to a
equipment
getSpecalistByID Get specialist Specialist ID
details by
specialist ID
newCaller Create a new Caller details
caller

newCalllog Create a new Calllog details


call log

NewEquipment Create new Equipment details


equipment

newsolution Create a new ProblemID ,Solution


solution for a details
problem
setReputation Update the Specialist ID New
reputation of reputation
the specialist
timelineByCaller Get the caller Caller ID
history

Table 3 – Stored procedures

10
Triggers

Name Table Action Description


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

11
Views

Name Purpose Tables


To access caller
Calllog_Problem information and problem Problem, Calllog
information in one query
Encapsulate the caller
View_Specalist_Problem information from the Problem, Specialist
specialist
Specialist and his Specialization , Specialist
Specalization_sp_pc
specialization details and problem category
To view the problem type
Problem Type_Solution Problem Type, Solution
and the solution
Table 5– Views

12
Screen Design

Login Screen

Figure 1 - Login Screen

13
Operator Main Screen

Figure 2 - Operator Main menu

14
New Troubleshooting

Figure 3 - New troubleshooting

15
Common Solutions

Figure 4 - Common solutions

16
Troubleshooting Status

Figure 5 - Troubleshooting status

17
Assigned specialist

Figure 6 - Assigned Specialist details

18
Specialist problem view

Figure 7 - Problems assigned to specialist

19
New Solution

Figure 8 - New Solution

20
DDL Statements

Stored procedures
Stored

ALTER proc [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
Procedure –

ALTER proc [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 ORDER BY NEWID()

SELECT @sp_name=Name From Specialist WHERE Specialist_ID=@sp_id

UPDATE Problem SET Assigned_Specalist_ID=@sp_id WHERE


ALTER PROC [dbo].[getLogin] @username varchar(50),@password
Login

varchar(50)
AS

ALTER proc [dbo].[newCalllog] @callerid varchar(10),@problemid


varchar(10),@operatorid varchar(10), @date varchar(10), @stime varchar(10)
AS
New call log

INSERT INTO calllog values


(@callerid,@problemid,@operatorid,@date,@stime,0)

21
ALTER proc [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

INSERT INTO Solution values (@solution,@prob_type_id,@specalist)

declare @solution_id int


SELECT top 1 @solution_id=Solution_ID FROM solution ORDER BY
Solution_ID DESC
PRINT @solution_id

UPDATE problem set solution_ID=@solution_id,status=1 WHERE


Set

ALTER proc [dbo].[setReputation] @sp_id varchar(50) ,@level int


AS
reputation

declare @currentrep int


ment byby getEquip

ALTER proc [dbo].[getDeparmentByEquipmentId] @eqid int


AS

SELECT * FROM
ALTER procDepartment WHERE depID=(SELECT
[dbo].[getinfoByProblemID] depID
@problem_id int FROM
as
Gerinfo

declare @caller_id varchar(10)


EquipmentIdCaller getDeparmentBy

ALTER proc [dbo].[getDeparmentByEquipmentId] @eqid int


AS
problemID

SELECT * FROM Department WHERE depID=(SELECT depID FROM


Equipment WHERE EquipmentId=@eqid)

ALTER proc [dbo].[timelineByCaller] @callerid varchar(10),@startdate


varchar(12),@enddate varchar(12)
as
timeline

Table 5– DDL for stored procedures

22
23
Triggers

ALTER TRIGGER [dbo].[updateeqtype] ON [dbo].[Equipment]


FOR INSERT,UPDATE,DELETE
AS
Update Eq type

declare @eqtype_id varchar(10)


declare @cnt int

SELECT @eqtype_id=CatogoryID FROM inserted

SELECT @cnt=count(*) FROM Equipment WHERE CatogoryID=@eqtype_id

ALTER TRIGGER [dbo].[update_problems_in_calllog] ON [dbo].[Problem]


FOR INSERT,UPDATE,DELETE
AS
Update No.Probems

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


ALTER TRIGGER [dbo].[updatenumcallers] ON [dbo].[Caller]
Number of callers

FOR INSERT,UPDATE,DELETE
AS

declare @caller_id varchar(10)


declare @cnt int

SELECT @caller_id=DepIDTable
FROM inserted
5– DDL for triggers

References

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


2010].

24

Vous aimerez peut-être aussi