Skip to content
Permalink
fc4804c86b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
17 lines (16 sloc) 791 Bytes
class InsertCommand:
def __init__(self, db, name, email, phone, address, service, joining_date, travel):
self.db = db
self.name = name
self.email = email
self.phone = phone
self.address = address
self.service = service
self.joining_date = joining_date
self.travel = travel
def execute(self):
if not all([self.name, self.email, self.phone, self.address, self.service, self.joining_date, self.travel]):
raise ValueError("Missing required parameter")
if not self.phone.isdigit() or len(self.phone) != 10:
raise ValueError("Invalid phone number")
self.db.insert(self.name, self.email, self.phone, self.address, self.service, self.joining_date, self.travel)