Upload
shadrack-benard-kweingoti
View
214
Download
0
Embed Size (px)
Citation preview
7/25/2019 Beauty Products Management System Documentation
1/13
0
UNITED STATES INTERNATIONAL
UNIVERSITY-AFRICA
COURSE TITLE : DATABASE MANAGEMENT
SYSTEMS
COURSE CODE : IST 4030
SEMESTER/YEAR : SPRING/2013
TASK : BEAUTY PRODUCTS
ENTERPRISE SYSTEM
PRESENTED TO : DR. PATRICK KANYI WAMUYU
(Ph.D.)
BY : SHADRACK BENARDKWEINGOTI
ID NO : 631448
7/25/2019 Beauty Products Management System Documentation
2/13
1
ANALYSIS AND DESIGN
The Login Process:
The system has been designed with an emphasis on security features whereby only authorized users can
use it. The administrator creates the prospective users and gives them their respective access rights and
privileges to allow them to use the system accordingly. Created users are assigned a unique password and
username so that they can login to the system. Validity checks include: A username, unique password,
and privileges. In this case, the system allows the company manager and sales representatives, and the
administrator himself to be able to login and use it.
The Administrator: Logs in as the main designer of the system and can carry out a variety of functions
in accordance with the business requirements of the system. This range from changing and continuous
improvement of the system. He also creates new users, assigns them different access levels into the
system.
The Manager: He She is the one in charge of the business and knows all the requirements. He registers
new sales representatives, and has full access to all other information which includes the sales
representatives information, items, orders, customers, and ordered items details. He acts as an overseer in
the entire process of customers needs getting fulfilled by ensuring that enough and competent sale
representatives are hired and their information is kept into the database of the company for reference.
The Sales Representative: He represents the customers, entering their information into the system and
processing orders on their behalf.
DATABASE DESIGN
THE EXTENDED ENTITY RELATIONSHIP DIAGRAM
Diagram 1 below depicts the EERD of the Beauty Products Enterprise. The Sales Representative acts on
behalf of the customer in the entire process of placing orders. He represents the customer. The company
has many sales representatives who represent the customers. A customer places an order. The Order
contains Ordered Items which in turn has an item. The company has three items which include: Beauty
Products, Appliances, and Sporting Goods.
7/25/2019 Beauty Products Management System Documentation
3/13
2
Diagram 1: EERD of the Beauty Products Enterprise System
SALES REP CUSTOMER
ORDER
ITEMORDER
ITEM
BEAUTYPRODUCT
APPLIANCE
SPORTING
GOODS
Represents
Places
Contains
Has
d
REP NO (PK)NAME
NAME
REP_NO (FK)
ADDRESSCUST_NO
ORDER
NO (FK)
7/25/2019 Beauty Products Management System Documentation
4/13
3
1.1.1.
RELATIONAL SCHEMA DIAGRAM
SALES REPRESENTATIVE
REP NO (PK) NAME
CUSTOMER
CUST NO (PK) NAME ADDRESS REP NO (FK)
ORDER
ORDER NO (PK) ORDER DATE CUST NO (FK)
ORDER ITEM
ORDER NO (FK) ITEM NO (FK) NUM ORDERED QUOTED PRICE
ITEMS
ITEM NO (PK) DESCRIPTION PRICE
LOGIN
USERNAME PASSWORD PRIVILEDGE
Diagram 2: Relational Schema of the Beauty Products Enterprise System
1.1.2.
ACCESS CONTROL: RIGHTS TO THE SYSTEM USERS
OBJECT/SUBJECT SALES
REPRESENTATIVES
TABLE
CUSTOMERS
TABLE
ORDERS
TABLE
ORDER
ITEMS
TABLE
ITEMS
TABLE
ADMIN ALL ALL ALL ALL ALL
MANAGER SELECT,NSERT,
UPDATE,DELETE
SELECT,UPDATE
DELETE
SELECT SELECT SELECT,INSERT
UPDATE,DELETE
SALES REPS NONE SELECT
INSERT
UPDATE
SELECT
INSERT
UPDATE
SELECT
INSERT
UPDATE
SELECT
INSERT
UPDATE
Table 1: Access Control: Rights to the system users.
7/25/2019 Beauty Products Management System Documentation
5/13
4
1.2.
IMPLEMENTATION
1.2.1.
DATABASE DESIGN USING ORACLE
A. SEQUENCE USED
I.) Customer Number Sequence:
CREATE SEQUENCE "CUST_NO_SEQ" MINVALUE 1 MAXVALUE 1000 INCREMENT BY 1 STARTWITH 41 CACHE 20 NOORDER NOCYCLE ;
II.)
Sales Representative Number Sequence:
CREATE SEQUENCE "REP_NO_SEQ" MINVALUE 1001 MAXVALUE 2000 INCREMENT BY 100 START
WITH 2001 CACHE 20 NOORDER NOCYCLE ;
B. LIST OF SQL DDL COMMANDS USED
I. Customer Table:
CREATE TABLE "CUSTOMERS"
( "CUST_NO" NUMBER,
"NAME" VARCHAR2(20) NOT NULL ENABLE,
"ADDRESS" CHAR(20),
"REP_NO" NUMBER,
PRIMARY KEY ("CUST_NO") ENABLE
) ;ALTER TABLE "CUSTOMERS" ADD FOREIGN KEY ("REP_NO")
REFERENCES "SALES_REPS" ("REP_NO") ENABLE;
II. Items Table:
CREATE TABLE "ITEMS"
( "ITEM_NO" CHAR(20),
"DESCRIPTION" VARCHAR2(20),
"PRICE" NUMBER,
PRIMARY KEY ("ITEM_NO") ENABLE
) ;
III. Login Table:
CREATE TABLE "LOGIN"
( "USERNAME" VARCHAR2(20),
"PASSWORD" VARCHAR2(15),
"PRIVILEDGE" VARCHAR2(20)
) ;
IV. Order Table
CREATE TABLE "ORDERS"
( "ORDER_NO" NUMBER,
"ORDER_DATE" DATE,
"CUST_NO" NUMBER,
PRIMARY KEY ("ORDER_NO") ENABLE
) ;ALTER TABLE "ORDERS" ADD FOREIGN KEY ("CUST_NO")
REFERENCES "CUSTOMERS" ("CUST_NO") ENABLE;
V. Order Items Table
7/25/2019 Beauty Products Management System Documentation
6/13
5
CREATE TABLE "ORDER_ITEMS"
( "ORDER_NO" NUMBER,
"ITEM_NO" CHAR(20),
"NUM_ORDERED" NUMBER,
"QUOTED_PRICE" NUMBER,
"TOTAL_COST" NUMBER,
PRIMARY KEY ("ORDER_NO", "ITEM_NO") ENABLE
) ;ALTER TABLE "ORDER_ITEMS" ADD FOREIGN KEY ("ORDER_NO")
REFERENCES "ORDERS" ("ORDER_NO") ENABLE;ALTER TABLE "ORDER_ITEMS" ADD
FOREIGN KEY ("ITEM_NO")
REFERENCES "ITEMS" ("ITEM_NO") ENABLE;
VI. Items Table
CREATE TABLE "ITEMS"
( "ITEM_NO" CHAR(20),
"DESCRIPTION" VARCHAR2(20),
"PRICE" NUMBER,
PRIMARY KEY ("ITEM_NO") ENABLE
) ;
VII.
Sales Representatives Table
CREATE TABLE "SALES_REPS"
( "REP_NO" NUMBER,
"NAME" VARCHAR2(20) NOT NULL ENABLE,
PRIMARY KEY ("REP_NO") ENABLE
) ;
VIII. Creating users: Manager and Salesrep
Create user manager identified by bpemanager;
Grant connect, resource, create synonym, create view to manager;
Create user salesrep identified by bpesalesrep;
Grant connect, resource,create synonym,create view to salesrep;
C. QUERIES AND SUB QUERIES USED ON THE DATABASE:
INSERTION QUERIES:
query = "INSERT INTO SALES_REPS VALUES(REP_NO_SEQ.NEXTVAL,'"+sales_rep_name+"')";
query = "INSERT INTO CUSTOMERS
VALUES(CUST_NO_SEQ.NEXTVAL,'"+customer_name+"','"+customer_address+"','"+sales_rep_number+"')";
query = "INSERT INTO ORDERS VALUES('"+order_no+"','"+order_date+"','"+customer_no+"')";
query = "INSERT INTO ORDER_ITEMS
VALUES('"+orderno+"','"+itemno+"','"+no_ordered+"','"+quoted_price+"','"+total+"')";
query = "INSERT INTO ITEMS VALUES('"+itemsno+"','"+description+"','"+price+"')";
7/25/2019 Beauty Products Management System Documentation
7/13
6
DATA RETRIEVAL QUERIES:
rs = stmt.executeQuery("SELECT username, password, priviledge FROM login WHERE username =
'"+username+"'");
query = "SELECT * FROM SALES_REPS";
query = "SELECT * FROM CUSTOMER";
query = "SELECT * FROM ITEMS_VIEW";
query = "SELECT * FROM ORDER_ITEMS_VIEW";
query = "SELECT * FROM ORDER_VIEW";
D. VIEWS USED:
i.) Items_View
This view allows the person to view the existing items and their details to view the existing items in case
they want to refer to the items. CREATE OR REPLACE FORCE VIEW "ITEMS_VIEW" ("ITEM_NO",
"DESCRIPTION", "PRICE") AS select item_no,description,price from items;
ii.)
Order_Items_View
This view allows the person to view the existing ordered items and their details for reference and eventual
use. CREATE OR REPLACE FORCE VIEW "ORDER_ITEMS_VIEW" ("ITEM_NO", "ORDER_NO",
"NUMBER_ORDERED", "QUOTED_PRICE", "TOTAL_COST") AS select
order_no,item_no,num_ordered,quoted_price,total_cost from order_items;
iii.)
Sales_Rep
This view is used to view the existing sales representatives and their details for reference. CREATE OR
REPLACE FORCE VIEW "SALES_REP" ("NAME", "REP_NO") AS select name,rep_no from
sales_reps;
iv.)
Order_View
This view is used to view the order items existing in the system for use and reference. CREATE OR
REPLACE FORCE VIEW "ORDER_VIEW" ("ORDER_NO", "ORDER_DATE", "CUSTOMER_NO")
AS select order_no,order_date,cust_no from orders;
7/25/2019 Beauty Products Management System Documentation
8/13
7
E.
PROCEDURES USED:
i.)
Items_delete procedure
create or replace procedure items_delete
as
begin
delete from items
where item_no=408;
end;
This procedure deletes the items whose item no is 408 from the items table.
ii.) Update_price procedure
create or replace procedure update_price
asbegin
update items set price=price*2;
end;
This procedure allow price to be doubled in the items table.
F.
SYNONYMS USED:
i.) SQL> create synonym customers for sheddy.customers;
ii.) SQL> create synonym orders for sheddy.orders;
The synonyms customer and orders are created by the database administrator to allow outside users across
the network to access the tables customers and orders that he created.
G.
TRIGGERS USED:
i.)
Least_quoted_price trigger
CREATE OR REPLACE TRIGGER "LEAST_QUOTED_PRICE"before insert or update of quoted_price on order_itemsfor each row
beginif(:new.quoted_price
7/25/2019 Beauty Products Management System Documentation
9/13
8
for each row
begin
if(:new.price
7/25/2019 Beauty Products Management System Documentation
10/13
9
1.2.2.
DESIGN AND CREATION OF THE USER INTERFACE USING JAVA APPLICATION
USER INTERFACE SCREEN SHOTS
Diagram 2. LOGIN FORM: Username Admin,Manager, Sales_Rep & Respective Password.
Diagram 3. CUSTOMERS FORM Customer No, Customer Name, Address, and Sales Rep No
7/25/2019 Beauty Products Management System Documentation
11/13
10
Diagram 4. ORDERS FORM: Order No, Order date, Customer No
Diagram 5. ORDER ITEMS FORM: Item No, Order No, Number Ordered, Quoted Price, Total
7/25/2019 Beauty Products Management System Documentation
12/13
11
Diagram 6. ITEMS FORM: Item No, Description, Price
Diagram 7. SALES REPRESENTATIVE FORM: Sales Rep No, Sales Rep Name
7/25/2019 Beauty Products Management System Documentation
13/13
12
2.0.
DISCUSSION
Some of the challenges I faced was the limited time I had to plan for, design, and implement the system.
However my learning process was improved through development, in short iterative and consultation
cycles. Overall, I can say that doing this project has been a remarkable learning experience as I have
learnt design and implementation concepts that I can apply in future with emphasis to oracle database and
programming in Java. Oracle has proved to be one of the best database platforms, since one can easily
understand and use it.
3.0.
SUMMARY
Beauty Products Enterprise System is a system that aims to place the companys data on a computer
managed by fully featured Data Base Management System, hence ensuring that the data is more current
and more accurate than the present manual system. This will in turn enable the companysmanagement to
generate reports from the database which are more reliable without human error hence accurate. This
system is user friendly, saves time, efficient, easy to use and manage, hence its of great importance. It
has been implemented using Java and SQL which are both cross-platform so as to enhance portability. I
would recommend this system to other institutions and schools of higher learning and welcome any ideas
from other system designers in order to improve the system.