Royal University of Law and Economics

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Royal University of Law and Economics

Topic: Sale Management System


Subject: .NET Programming 2
Class: IT3C01
Professor: Pichdaro PEN
Content

1. Introduction
1.1. About the project
2. How to install SQL sever 2019
2.1. Download SQL Server 2019
2.2. Install SQL Server 2019 developer edition
2.3. Install Microsoft SQL Server Management Studio
3. How to install Visual studio 2022
3.1. A
3.2. B
3.3. C
4. Project Plane Sale management system
4.1. a
4.2. b
5. Create Database and Table in SQL Sever
5.1. Create Database
5.2. Create Table
a. Table Customer
b. Table Products
c. Table Sale Order Items
d. Table Purchases
e. Table Sale Orders
f. Table Staff
g. Table Sale Reports
6. C# form
6.1.
7. Conclusion
Introduction
1. About the project
How to
Install
SQL SEVER 2019

1. Download SQL Server 2019


2. Install SQL Server 2019 developer edition
3. Install Microsoft SQL Server Management Studio
1. Download SQL Server 2019

please click the following link:

https://www.microsoft.com/en-us/sql-server/sql-server-downloads

Once complete downloading, you can double-click the file SQL2019-


SSEI-Dev.exe file to launch the downloader.

1. The downloader will ask you to select the installation type, choose the
Download Media option. This option allows you to download the setup
files first and install the SQL Server later.

2. Specify the folder for storing the installation files, then click the
Download button:
3. The downloader will start downloading the installation files. It’ll take a
while.
4. Once the download completes, open the folder that stores the
downloaded file:

5. Right-click the iso file and select the Mount option to mount the iso
file:

6. Open the installation folder and click the setup.exe file to launch the
installer:
2. Install SQL Server 2019 developer edition

1. After double click setup.exe, you’ll see the following window; select
the installation option on the left:
2. Click the first link to launch a wizard to install SQL Server 2019:

3. Specify the edition that you want to install, select Developer edition,
and click the Next button.
4. Select the “I accept the license terms.” and click the Next button:

5. Uncheck the “Use Microsoft Update to check for updates


(recommended)” if you don’t want to get the updates for the SQL Server
and click the Next button:
6. The installation checks for the prerequisites before installation. If no
error occurs, click the Next button:

7. Select the features that you want to install. For learning purposes, you
need the Database Engine Services; check the checkbox and click the
Next button to continue:
8. Provide the instance ID of the SQL Server and click the Next button:

9. Select the Mixed Mode, provide the password for system


administration (sa) account (you need to store this password in a secure
place so that you can use it to connect to the SQL Server later), click the
Add Current User to specify the SQL Server Administrators, and click the
Next button:
10. Verify the SQL Server 2019 features to be installed:

11. Click the Close button to complete the installation:


3. Install Microsoft SQL Server Management Studio

The SQL Server Management Studio is software for querying,


designing, and managing SQL Server on your local computer or in the
cloud. It provides you with tools to configure, monitor, and administer
SQL Server instances.

First, download the SSMS follow link:

https://learn.microsoft.com/en-us/sql/ssms/download-sql-server-
management-studio-ssms?view=sql-server-ver16

Second, double-click the installation file SSMS-Setup-ENU.exe to


launch the SSM installer. The installation process of SMSS is
straightforward. you need to follow the screen sequence.

1. Click the Install button

2. Wait for a few minutes while the installer sets up the software:
3. Once setup is completed, click the Close button:
How to
install
Visual studio 2022
CREATE DATABASE
AND
TABLE IN SQL SEVER

1. Create Database
2. Create Table
a. Table Customer
b. Table Products
c. Table Sale Order Items
d. Table Purchases
e. Table Sale Orders
f. Table Staff
g. Table Sale Reports
1. Creating the Database:
Create database Sale_Management_System;
Using Sale_Management_System;
2. Creating Tables:

a. customer:

 Stores customer information:

o customerId: Unique identifier for each customer


(primary key)

o customerName: Customer's name


o customerEmail: Customer's email address
o customerPhone: Customer's phone number

o customerAddress: Customer's address

show code:

-- Customers Table

Create Table Customer (


Cus_ID INT PRIMARY KEY,

Cus_Name VARCHAR(50) Not null,


Email VARCHAR(100),

Phone VARCHAR(20) NOt Null,

Address VARCHAR(255)
);

b. products:

 Stores product information:


o productsId: Unique identifier for each product (primary
key)

o productsName: Product name


o productsCategory: Product category

o productsPrice: Product price

o productsUnitInStock: Quantity of the product in stock

o productsUnitOnSale: Quantity of the product on sale

show code:

-- Products Table
CREATE TABLE Product (

Pro_ID INT PRIMARY KEY,

Pro_Name VARCHAR(100) Not Null,


Category VARCHAR(50),

Price DECIMAL(10, 2) Not NUll,

Units_in_Stock smallint Not Null,


Units_On_Sale smallint Not Null,
);

c. sale_order_items:

 Stores details of items within a sale order:

o saleorderitemsId: Unique identifier for each item (primary


key)
o saleOrdersId: Foreign key linking to the associated sale
order (sale_orders table)
o productId: Foreign key linking to the ordered product
(products table)

o saleorderitemsQuantity: Quantity of the product ordered


o saleorderitemsPrice: Price of the product at the time of
order

show code:
-- SalesOrderItems Table

CREATE TABLE SalesOrderItems (

Order_ID INT ,

Ord_ID INT,

Pro_ID INT,

Quantity INT,
Price DECIMAL(10, 2),

Constraint PK Primary Key (Order_ID,Ord_ID,Pro_ID),


FOREIGN KEY (Pro_ID) REFERENCES Product(Pro_ID),

Foreign Key (Ord_ID) References SalesOrders(Ord_ID)

);
d. purchases:
 Stores purchase history for products:

o purchaseId: Unique identifier for each purchase (primary


key)
o productId: Foreign key linking to the purchased product
(products table)

o purchaseDate: Date of purchase

o Quantity: Quantity of the product purchased


o costPrice: Cost price of the product at the time of
purchase

show code:
-- Purchases Table

CREATE TABLE Purchases (


Pur_ID INT ,

Pro_ID INT ,

PurchaseDate DATE,
Quantity INT,

CostPrice DECIMAL(10, 2),

Constraint PK_Pro_ID Primary Key (Pro_ID,Pur_ID),

FOREIGN KEY (Pro_ID) REFERENCES Product(Pro_ID)

);
e. sale_orders:
 Stores sale order information:

o saleOrdersId: Unique identifier for each sale order


(primary key)

o customerId: Foreign key linking to the customer who


placed the order (customer table)

o StaffId: Foreign key linking to the staff member who


processed the order (staff table)

o orderDate: Date the order was placed


o TotalAmount: Total amount of the sale order

Show code:

-- SalesOrders Table

CREATE TABLE SalesOrders (


Ord_ID INT Primary Key,

Cus_ID INT,
St_ID INT,
OrderDate DATE,

TotalAmount DECIMAL(10, 2),


FOREIGN KEY (Cus_ID) REFERENCES Customer(Cus_ID),

FOREIGN KEY (St_ID) REFERENCES Staff(St_ID)

);
f. staff:

 Stores staff information:

o staffId: Unique identifier for each staff member (primary


key)
o staffName: Staff member's name

o position: Staff member's position

show code:
-- Staffs Table

CREATE TABLE Staff (

St_ID INT PRIMARY KEY,


St_Name VARCHAR(50) Not Null,
Position VARCHAR(50)Not Null,

);

g. sale_report:

 Stores sales reports:


o saleReportId: Unique identifier for each report (primary
key)

o orderId: Foreign key linking to the associated sale order


(sale_orders table)
o profit: Profit generated from the sale
o Revenue: Total revenue from the sale

o Expenses: Expenses incurred for the sale


o reportDate: Date the report was generated

show code:

-- SaleReports Table
CREATE TABLE SaleReports (

Re_ID INT Primary Key ,

Ord_ID INT,

Profit DECIMAL(10, 2),

Revenue DECIMAL(10, 2),


Expenses DECIMAL(10, 2),
ReportDate DATE,

FOREIGN KEY (Ord_ID) REFERENCES


SalesOrders(Ord_ID)
);

You might also like