def __init__(self, master):
     Frame.__init__(self, master)
     self.notebook = ttk.Notebook()
     self.tab1 = Department(self.notebook)
     self.tab2 = Employee(self.notebook)
     self.notebook.add(self.tab1, text="Departments")
     self.notebook.add(self.tab2, text="Employees")
     self.notebook.pack()
class NoteBook(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.notebook = ttk.Notebook()
        self.tab1 = Department(self.notebook)
        self.tab2 = Employee(self.notebook)
        self.notebook.add(self.tab1, text="Departments")
        self.notebook.add(self.tab2, text="Employees")
        self.notebook.pack()

    # controller function
    def switch_tab1(self, frame_class):
        new_frame = frame_class(self.notebook)
        self.tab1.destroy()
        self.tab1 = new_frame
 def __init__(self, tuple=None):
     if(tuple):
         self.id = tuple[0]
         self.name = tuple[1]
         self.position = tuple[2]
         self.department_id = tuple[3]
         self.department = Department.find(self.department_id)
         self.salary = tuple[4]
 def save(self):
     Database._cursor.execute(
         "insert into employees set name = %s, position = %s, salary = %s, department_id = %s",
         [self.name, self.position, self.salary, self.department_id])
     Database._db.commit()
     self.id = Database._cursor.lastrowid
     self.department = Department.find(self.department_id)
     self.display()
Exemplo n.º 5
0
def getDepartments(elements):
    dept_list = []
    for i in range(0, len(elements)):
        if 'searchForCourseByDept' in elements[i].value:
            parsed_elements = parseElements(elements[i])
            dept_list.append(
                Department(parsed_elements[0], parsed_elements[1],
                           parsed_elements[2], parsed_elements[3]))
    return dept_list
    def get_department(self, dep_name: str) -> Department:
        # Пошук департеманта
        SessionManager.db.cursor.execute(
            "SELECT * FROM Department WHERE departmentName =(?) ",
            (dep_name, ))
        dep = SessionManager.db.cursor.fetchone()
        department_description = dep[0]
        department_id = dep[1]
        department_name = dep[2]

        return Department(department_id, department_name,
                          department_description)
Exemplo n.º 7
0
def create_yest_dict(yest_output):
    """
    given a list of lists with current icd status data
    output dictionary of Department objects
    """
    yest_dict = {}
    for row in yest_output:
        yest_dict[row[0]] = Department(ID=row[0],
                                       name=row[1],
                                       specialty=row[2],
                                       icu=row[3],
                                       first=row[4],
                                       last=row[5])
    return yest_dict
Exemplo n.º 8
0
 def adddepartment(self, deptname, university, numofmembers, firstname,
                   lastname, academiclevel):
     deptadded = True
     count = 0
     while count < len(self.deptlist) and deptadded:
         thisdept = self.deptlist[count]
         if thisdept.getdeptname() == deptname and thisdept.getuniversity(
         ) == university:
             deptadded == False
         count = count + 1
     else:
         if deptadded:
             newdep = Department(deptname, university, numofmembers,
                                 firstname, lastname, academiclevel)
             self.deptlist.append(newdep)
     return deptadded
Exemplo n.º 9
0
 def displayAllDepartments():
     department_list = Department.get()
     # cursor.execute("Select * from departments")
     for department in department_list:
         department.display()
Exemplo n.º 10
0
per_appliances = p_norm['Appliances'] / 100
per_cam_aud_phones = (p_norm['Audio'] + p_norm['Cameras'] +
                      p_norm['Cell Phones']) / 100
per_computers_tablets = p_norm['Computers&Tablets'] / 100
per_tv_home_theater_1 = p_norm['TV&Home Theater'] * (
    area_tvhometheater_1_disp / area_tvhometheater_disp) / 100
per_tv_home_theater_2 = p_norm['TV&Home Theater'] * (
    area_tvhometheater_2_disp / area_tvhometheater_disp) / 100
per_video_gaming = p_norm['Video Gaming'] / 100

#############
# DEPT OBJS #
#############

appliances = Department(pos_appliances, dim_appliances, RED, "Appliances",
                        quantity_appliances, area_appliances,
                        area_appliances_disp, per_appliances)

cam_aud_phones = Department(pos_cam_aud_phones, dim_cam_aud_phones, INDIGO,
                            "CamerasAudioPhones", quantity_cam_aud_phones,
                            area_cam_aud_phones, area_cam_aud_phones_disp,
                            per_cam_aud_phones)

computers_tablets = Department(pos_computers_tablets, dim_computers_tablets,
                               AQUAMARINE, "Computers&Tablets",
                               quantity_computers_tablets,
                               area_computers_tablets,
                               area_computers_tablets_disp,
                               per_computers_tablets)

tvhome_theater_1 = Department(pos_tvhometheater_1, dim_tvhome_theater_1,
The first structure contains all department data, CAPES and Descriptions. (Department structure)
The second structure contains description data that is tokenized and sorted by course.
'''

#dictionary for the file paths.
file_dict = {
    'ECE': ['../raw_data/ECE_Description.txt', '../raw_data/ECE_CAPE.txt'],
    'MATH': ['../raw_data/MATH_Description.txt', '../raw_data/MATH_CAPE.txt'],
    'CSE': ['../raw_data/CSE_Description.txt', '../raw_data/CSE_CAPE.txt'],
    'COGS': ['../raw_data/COGS_Description.txt', '../raw_data/COGS_CAPE.txt']
}

#create dictionary to contain structures.
departments = {}
for el in file_dict.keys():
    departments[el] = Department(el)
    departments[el].loadDescription(file_dict[el][0])
    departments[el].loadCourses(file_dict[el][1])

#save the dictionary
with open('departments.pkl', 'wb') as f:
    pkl.dump(departments, f)

with open('departments.pkl', 'rb') as f:
    departments = pkl.load(f)

#tokenizer structure that to be used for queries later on.
department_tokenizers = {}
for el in departments.keys():
    department_tokenizers[el] = DataTokens()
    for course in departments[el].descriptions:
Exemplo n.º 12
0
def create_today_dict(today_dept, yest_dict, icu_specialties, date2):
    """
    create a dictionary of departments from today_dept list of lists
    yest_dict contains dictionary of Departments from previous icu status file
    icu_specialties is a list of specialties considered icu
    date2 is today's date, used to update first and last icu dates
    """
    today_dict = {}
    for row in today_dept:
        #if the dept specialty is an icu specialty
        if row[2] in icu_specialties:
            #if dept was not in yesterday's dictionary, create new Department
            if row[0] not in yest_dict:
                today_dict[row[0]] = Department(row[0], row[1], row[2], 'Yes',
                                                date2, date2)
            #else point today's entry for it at yesterday's entry and update
            else:
                today_dict[row[0]] = yest_dict[row[0]]
                today_dict[row[0]].name = row[1]
                today_dict[row[0]].specialty = row[2]
                today_dict[row[0]].icu = 'Yes'
                #populate first date if blank
                if not today_dict[row[0]].first:
                    today_dict[row[0]].first = date2
                #update last with today's date
                today_dict[row[0]].last = date2
        #if the dept specialty is not an icu specialty
        else:
            #if dept was not in yesterday's dictionary, create new Department
            if row[0] not in yest_dict:
                today_dict[row[0]] = Department(row[0], row[1], row[2], 'No',
                                                None, None)
            #else point today's entry for it at yesterday's entry and update
            else:
                today_dict[row[0]] = yest_dict[row[0]]
                today_dict[row[0]].name = row[1]
                today_dict[row[0]].specialty = row[2]
                today_dict[row[0]].icu = 'No'
    return today_dict
Exemplo n.º 13
0
        output += f" {i + 2}. Exit"





        return output



    def __repr__(self):
        return f'Store("{self.name}", {self.departments})'


# instance of the Store class
my_store = Store("Bobs Emporium", [Department("Clothes"), Department("Tools"), Department("Electronics"), Department("Bobs Specials")])

# print(repr(my_store))
# make a variable to hold the users choice?
choice = 0
while choice != len(my_store.departments) + 1:

    # print out the menu
    print(my_store)

    # request input from the user
    choice = int(input("Select the number of department you wish to enter. "))
    if choice == len(my_store.departments) + 1:
        print(f"Thanks for shopping at {my_store.name}")
        break
    elif choice > 0 and choice <= len(my_store.departments):
Exemplo n.º 14
0
    def handle(self, event):
        dettitle = ""
        faculties = 0
        nameuniv = ""
        isemptyfields = False
        alreadyexists = False
        if self.titleentry.get() == "" or self.numentry.get(
        ) == "" or self.nameentry.get() == "":
            isemptyfields = True
        if isemptyfields:
            self.errlabel.config(text="Please fill all fields")
        else:
            try:
                newdepart = Department()
                depttitle = self.titleentry.get()
                faculties = int(self.numentry.get())
                nameuniv = self.nameentry.get()

                # If data was valid, no exceptions would have occured by this point

                # Check for any duplicate departments
                count = 0
                while count < len(self.departlist) and alreadyexists == False:
                    depttocheck = self.departlist[count]
                    if depttocheck.getdeptname(
                    ) == depttitle and depttocheck.getnumberofmembers(
                    ) == faculties and depttocheck.getuniversity() == nameuniv:
                        alreadyexists = True
                        raise Exception
                    count = count + 1

                # If there are no duplicate Departments, add the user's Department to the list
                if alreadyexists == False:

                    # Set attributes of new Department object
                    newdepart.setdeptname(depttitle)
                    newdepart.setnumberofmembers(faculties)
                    newdepart.setuniversity(nameuniv)

                    # Add the new Department to the list
                    self.departlist.append(newdepart)

                    #  Clear the user-entry boxes
                    self.titleentry.delete(0, END)
                    self.numentry.delete(0, END)
                    self.nameentry.delete(0, END)

                    # Reset the text in 'departments'
                    if self.departments.get(1.0, 1.13) == "No department":
                        self.departments.delete(1.0, END)
                    currtext = self.departments.get(1.0, END)
                    self.departments.delete(1.0, END)
                    self.departments.insert(1.0, (currtext + str(newdepart)))

                    # Use the 'errLabel' Label to tell the user that their Department was added
                    self.errlabel.config(text="Department added")

                    # Update the info in the other tab of the GUI
                    self.selectpane.updatedepartlist(newdepart)
            except (ValueError):
                self.errlabel.config(
                    text="Please enter an integer for the number of faculty")
            except (Exception):
                if alreadyexists == True:
                    self.errlabel.config(
                        text="Department not added - already exist")
Exemplo n.º 15
0
 def delete_department(self, department_name: str):
     Department.get_department_by_name(department_name).delete_department()
Exemplo n.º 16
0
 def create_department(self, department_name: str, description: str) -> None:
     dep = Department(department_name, description)
     dep.add_department()
Exemplo n.º 17
0
    def addNewDepartment():

        deparment = Department()
        deparment.name = input("Please enter the department name : ")
        deparment.save()
Exemplo n.º 18
0
 def update(self):
     Database._cursor.execute("Update employees set salary = %s,name = %s, position=%s, department_id = %s where id = %s",
                    [self.salary, self.name,self.position,self.department_id,self.id])
     Database._db.commit()
     self.department = Department.find(self.department_id)
     self.display()
Exemplo n.º 19
0
# lets make some products

# clothes
tshirt = Clothing("Long Sleve T-Shirt", 20, "XXL", "Blue")
red_shoes = Clothing("Red Running Shoe", 34, "12", "Red")

# tools
hammer = Tool("Ball Pane Hammer", 5, "Hammer")
screw_driver = Tool("Philips Head Screw Driver", 3, "Screw Driver")

# electronics
televisions = Electronic("50 inch Wide Screen LCD", 400, "50w")
tablet = Electronic("Android Tablet", 50, "8w")

# lets create some Departments
clothes_dept = Department("Clothes", [tshirt, red_shoes])
tools_dept = Department("Tools", [hammer, screw_driver])
electronics_dept = Department("Electronics", [televisions, tablet])

# instance of the Store class
my_store = Store("Bobs Emporium", [clothes_dept, tools_dept, electronics_dept])

# print(repr(my_store))
# make a variable to hold the users choice?
choice = 0
while choice != len(my_store.departments) + 1:

    # print out the menu
    print(my_store)

    # request input from the user
Exemplo n.º 20
0
"""
Assignment4
"""
from Department import Department
from Faculty import Faculty


def printMenu():
    print("Choice\t\tAction\n" + "------\t\t------\n" +
          "A\t\tAdd Department\n" + "D\t\tDisplay Department\n" +
          "Q\t\tQuit\n" + "?\t\tDisplay Help\n\n")


printMenu()
dept = Department()
userIn = input("What action would you like to perform?\n")
while len(userIn) == 1:
    userIn = userIn.upper()
    if userIn == "A":
        print("Please enter the department information:\n")
        deptName = input("Enter its name:\n")
        dept.setDeptName(deptName)
        numMembers = input("Enter its number of members:\n")
        dept.setNumberOfMembers(int(numMembers))
        univ = input("Enter its university:\n")
        dept.setUniversity(univ)
        fName = input("Enter its faculty's first name:\n")
        lName = input("Enter its faculty's last name:\n")
        aLevel = input("Enter its faculty's academic level:\n")
        dept.setCurrentFaculty(fName, lName, aLevel)
    elif userIn == "D":