CS Project Mobile Management
CS Project Mobile Management
project
Smartphone dealership
Session: 2024-25
Principal
Page | 2
Acknowledgemen
t
Page | 3
Index
Sr. No. Content Page No.
1. Certificate 2
2. Acknowledgement 3
3. Background of Project 5
4. Flow of Project 9
5. Use of technology 12
8. Output interface 28
Page | 4
9. Bibliography 31
BACKGROUND
OF THE PROJECT
In today’s tech-driven world, smartphones have
become an essential part of our lives. However,
managing the sale and service of smartphones
often involves extensive manual effort, from
maintaining customer records to processing
transactions.
This software simplifies the operations of a
smartphone dealership by digitizing key
processes. It registers customer details such as
name, contact information, and purchase history,
and tracks inventory, including brand, model, and
availability. Customers can easily browse and book
smartphones, schedule service appointments, and
access warranty details.
By streamlining these processes, the software
enhances customer satisfaction and improves
Page | 5
dealership management efficiency, making it a
valuable tool for both businesses and their clients.
FUNCTIONS AND
MODULES
Modules:
import mysql.connecter:
By importing this package, we are able to
establish the connection between SQL and
Python.
Functions:
connect_to_db(password):
This function establishes connection between
Python and MySQL.
search_products(cursor, company, product_name):
Page | 6
Performs the task of searching for products in a
company specified by the user.
dealer_menu():
Serves the dealer menu functionality. Displays a
the records that provide internal details related to
the retailer.
customer_menu():
Serves the customer menu functionality. Helps the
user to shop from the store efficiently by
displaying the essential records.
fetchall():
This function will return all the rows from the
result set in the form of a tuple containing the
records.
commit():
This function provides changes in the database
physically.
Page | 7
cursor():
It is a special control structure that facilitates the row-
by-row processing of records in the result set.
FLOW OF THE
PROJECT
The basic fundamentals of this project are-
1. Database Connectivity:
- The code uses “mysql.connector” to establish a
connection to the database.
- “connect_to_db” manages the database
connection.
2. Product Search:
- The “search_products” function allows
querying products by company and product name.
3. Dealer Menu:
Page | 8
- The “dealer_menu” function provides options
like "STOCK" and "SALES", which are likely linked
to stock management and sales functionalities.
The functioning of the program follows-
1. Initialization
- User inputs the database password.
- Connection to the “drift” database is
established.
2. Dealer Menu
- Options for managing:
- Stock: Adding or updating products.
- Sales: Viewing or processing sales records
3. Product Management
- Search Products:
- Query products by company and product
name.
Page | 9
- Retrieve and display product details (name,
price, stock).
- Update Stock:
- Add new products or restock existing ones.
4. Sales Management
- Record new sales.
- View detailed sales history (filtered by date or
product).
5. Error Handling
- Proper handling of database connection or
query errors.
6. Termination
- Close the database connection and exit the
application gracefully.
Page | 10
Use of
Technology
Page | 11
scalable alternative to many of the
commercial RDBMS’ available today.
The software provides you with a rich set of
features that support a secure environment
for storing, maintaining, and accessing data.
MySQL was created and supported by MySQL
AB, a company based in Sweden. This
company is now a subsidiary of Sun
Microsystems, which holds the copyright to
most of the codebase. On April 20th, 2009,
Oracle Corp., which develops and sells the
proprietary Oracle database, announced a
deal to acquire Sun Microsystems. SQL
provides many different types of commands
used for different purposes. SQL commands
can be divided into following categories:
i. Data Definition Language (DDL)
ii. Data Manipulation Language (DML)
iii. Transaction Control Language (TCL)
iv. Session Control Commands
v. System Control Commands
Page | 12
Python is an interpreted, object-oriented,
high-level programming language with
dynamic semantics. Its high-level built in
data structures, combined with dynamic
typing and dynamic binding; make it very
attractive for Rapid Application
Development, as well as for use as a
scripting or glue language to connect
existing components together.
Python's simple, easy to learn syntax
emphasizes readability and therefore
reduces the cost of program maintenance. It
supports modules and packages, which
encourages program modularity and code
reuse.
Page | 13
The Python interpreter and the extensive
standard library are available in source or
binary form without charge for all major
platforms, and can be freely distributed.
Often, programmers fall in love with Python
because of the increased productivity it
provides. Debugging Python programs is
easy: a bug or bad input will never cause a
segmentation fault. Instead, when the
interpreter discovers an error, it raises an
exception. A source level debugger allows
inspection of local and global variables,
evaluation of arbitrary expressions, setting
breakpoints, stepping through the code a
line at a time, and so on. The debugger is
written in Python itself, testifying to
Python's introspective power. On the other
hand, often the quickest way to debug a
program is to add a few print statements to
the source: the fast edit-test-debug cycle
makes this simple approach very effective.
Page | 14
HARDWARE AND
SOFTWARE
REQUIREMENTS
SYSTEM:
OS- Windows 7 Professional 32-Bit or more
Processor- Dual-core processor (2.0 GHz or
higher)
Memory- 2 GB or more
DirectX Version- DirectX12
Storage- 10GB of available disk space
Display adapter- Intel® HD Graphics
SOFTWARE:
Python 3.12 64-bit or
MySQL
MySQL-connector-python
Page | 15
PYTHON
CODES
Page | 16
import mysql.connector
# Global variables
add = []
buy = []
def connect_to_db(password):
"""Establish a connection to the database."""
try:
return mysql.connector.connect(
host="localhost",
database="drift",
user="root",
password=password
)
except mysql.connector.Error as e:
print("Error connecting to the database:", e)
return None
Page | 17
except mysql.connector.Error as e:
print(f"Error executing query for {company}: {e}")
return []
def dealer_menu():
"""Dealer menu functionality."""
print("-----------------=MENU=--------------------------")
print("---> STOCK")
print("---> SALES")
print("---> PLACE")
choice = input("Enter your choice: ").strip().upper()
if choice == "STOCK":
def stock():
password = input("Enter your MySQL password: ").strip()
db = connect_to_db(password)
if db:
cursor = db.cursor()
company = input("Enter your company name: ").strip()
product = input("Enter the product name: ").strip()
results = search_products(cursor, company, product)
if results:
print("Stock Details:", results)
else:
print("No stock found for the specified product.")
Page | 18
db.close()
stock()
elif choice == "SALES":
print("Sales functionality coming soon!")
def customer_menu():
"""Customer menu functionality."""
while True:
print("-----------------=MENU=--------------------------")
print("---> MY ORDER")
print("---> PLACE ORDER")
print("---> BACK TO LOGIN")
choice = input("Enter your choice: ").strip().upper()
Page | 19
product_name = input("Enter product's name: ").strip()
company_name = input("Enter product's company:
").strip().lower()
if action == "BUY":
card_details = input("Enter your card details:
").strip()
address = input("Enter your home address:
").strip()
print("Order confirmed!")
buy.append([product_name, company_name])
elif action == "ADD TO CART":
print("Item added to cart.")
add.append([product_name, company_name])
else:
Page | 20
print("Product not found or out of stock!")
Page | 21
print("Items in your cart:")
for item in add:
print(item)
elif sub_choice == "BACK":
break
else:
print("Invalid choice! Try again.")
else:
print("Invalid choice! Please select a valid option.")
# Main Program
print("Welcome to DRIFT!")
input("Press any key to start...")
print("Starting...")
while True:
print("LOGIN PAGE")
print("1 = DEALER")
print("2 = CUSTOMER")
Page | 22
print("3 = EXIT")
user_type = input("Enter your choice (1/2/3): ").strip()
if user_type == "1":
print("PLEASE ENTER YOUR LOGIN INFO:")
uname = input("Enter your dealer username: ").strip()
password = input("Enter your password: ").strip()
if uname == "A" and password == "dealer":
print("Hello, Dealer!")
dealer_menu()
else:
print("Invalid credentials!")
Page | 23
print("Thank you for visiting! Exiting...")
break
else:
print("Invalid selection! Please try again.")
Page | 24
mySQL
CODES
Page | 25
Creating database:
creating a table:
Page | 26
OUTPUT
interface
Page | 27
Page | 28
BIBLIOGRAPHY
The references used for the development
of this program are:
Page | 29