Ejemplo n.º 1
0
def delete_staff():
    delete_menu = """
        1.By Name
        2.By Addeess
        3.By Post
        """
    print(delete_menu)
    delete_choice = int(input("Enter the delete choice"))
    if delete_choice == 1:
        delete_name = input("Enter the name of the staff to elete")
        s = Staff(name=delete_name)
        is_deleted = staff_database.delete_by_name(s)
        if is_deleted:
            print("The data is deleted")
        else:
            print("There was error in the process")
    elif delete_choice == 2:
        delete_address = input("Enter the address of the staff to delete")
        s = Staff(address=delete_address)
        is_deleted = staff_database.delete_by_address(s)
        if is_deleted:
            print("The data is deleted")
        else:
            print("There was error in the process")
    elif delete_choice == 3:
        delete_post = input("Enter the subject of the staff to delete")
        s = Staff(post=delete_post)
        is_deleted = staff_database.delete_by_subject(s)
        if is_deleted:
            print("The data is deleted")
        else:
            print("There was error in the process")
Ejemplo n.º 2
0
def generate_company_with_groups(number):
    bosses = [Staff() for  i in range(number)]
    companies = [Company() for i in range(number)]
    groups = []
    # construct company
    gnames = ['董事会', '总经理', '副总经理', '市场总监', '技术总监', '副总经理', '财务部', '行政人事部', '商务部', '市场发展部', '客户服务部', '外部办事部', '产品研发部', '技术服务部', '系统集成部', '副总经理', '采购部', '生产部', '质检部']
    for i in companies: 
        temp_groups = [Group(name=j, companyId=i._id) for j in gnames]
        # set relation
        set_parent(temp_groups, [1], 0)
        set_parent(temp_groups, [2, 3, 4, 5], 1)
        set_parent(temp_groups, [6, 7, 8], 2)
        set_parent(temp_groups, [9, 10, 11], 3)
        set_parent(temp_groups, [12, 13, 14], 4)
        set_parent(temp_groups, [15, 16, 17], 5)
        groups += temp_groups
    
    group_data = [i.get_data_for_insert() for i in groups]
    print(group_data)
    for i in range(number):
        bosses[i].companyId = companies[i]._id # keng??
        companies[i].userId = bosses[i]._id
    boss_data = [i.get_data_for_insert() for i in bosses]
    company_data = [i.get_data_for_insert() for i in companies]
    staff_sql = Staff.get_insert_sql()
    group_sql = Group.get_insert_sql()
    company_sql = Company.get_insert_sql()
    database.execute_change(staff_sql, tuple(boss_data))
    database.execute_change(company_sql, tuple(company_data))
    database.execute_change(group_sql, tuple(group_data))
    return companies, groups
Ejemplo n.º 3
0
def Signup():
    def usercheck():
        i = 0
        while i == 0:
            user = input("Username:\n\r")
            with open("LoginCred.txt") as g:
                if "Username: "******" " in g.read():
                    print("Username taken, try again.\n\r")
                else:
                    i = 1
                    return user

    f = open("LoginCred.txt", "a")
    option = input("Choose:\n\r(1)Student (2)Teacher (3)Coordinator\n\r")
    if option == '1':
        name = input("Name:\n\r")
        f.write("Student_Name: " + name + " ")
        username = usercheck()
        f.write("Clearance: 1" + " ")
        f.write("Username: "******" ")
        password = input("Password:\n\r")
        f.write("Password: "******" ")
        year = input("Year:\n\r")
        f.write("Year: " + year + "\n\r")
        newStudent = Student(name, username, password, "Student", year)
        f.close()
        return newStudent
    elif option == '2':
        f = open("LoginCred.txt", "a")
        name = input("Name:\n\r")
        f.write("Tutor_Name: " + name + " ")
        username = input("Username:\n\r")
        f.write("Clearance: 2" + " ")
        f.write("Username: "******" ")
        password = input("Password:\n\r")
        f.write("Password: "******" ")
        subject = input("Subject:\n\r")
        f.write("Teaching Subject: " + subject + "\n\r")
        newTeacher = Staff(name, username, password, 2, subject)
        f.close()
        return newTeacher
    elif option == '3':
        f = open("LoginCred.txt", "a")
        name = input("Name:\n\r")
        f.write("Tutor_Name: " + name + " ")
        f.write("Clearance: 3" + " ")
        username = input("Username:\n\r")
        f.write("Username: "******" ")
        password = input("Password:\n\r")
        f.write("Password: "******" ")
        subject = input("Subject:\n\r")
        f.write("Teaching Subject: " + subject + "\n\r")
        newCoordinator = Staff(name, username, password, 3, subject)
        f.close()
        return newCoordinator
Ejemplo n.º 4
0
def generate_company(number):
    bosses = [Staff() for  i in range(number)]
    companies = [Company() for i in range(number)]
    for i in range(number):
        bosses[i].companyId = companies[i]._id # keng??
        companies[i].userId = bosses[i]._id
    boss_data = [i.get_data_for_insert() for i in bosses]
    company_data = [i.get_data_for_insert() for i in companies]
    staff_sql = Staff.get_insert_sql()
    company_sql = Company.get_insert_sql()
    database.execute_change(staff_sql, tuple(boss_data))
    database.execute_change(company_sql, tuple(company_data))
    return companies
Ejemplo n.º 5
0
def init_data():
    customers = [Customer("01223", "Peter Parker", "Qo'yliq", 2.2, "90-932-75-98", ["Silver", 'Gold']),
                 Customer("75884", "Sherlock Holmes", "Backer street", 31415, "90-987-65-43", ["Regular", 'VIP']),
                 Customer("70070", "James Bond", "NY City", 450, "90-900-90-90", ["Silver", 'Gold'])]
    store = Store('U1510375', "John's Mall", "Ziyolar-9", "90-123-45-67")
    staff_members = [Staff("0", "02213", "Uncle Ben", "Manager"),
                     Staff("1", "45646", "Aunt May", "Cashier"),
                     Staff('2', "12345", "John Doe", "Owner")]
    products = [Product(69, "Cucumber", "Fresh and long cucumber", 69.69, 666),
                Product(666, "Tomatoes", "Red and plump", 12.14, 314),
                Product(123, "_Candies_", "Sweet sweet candies", 50, 100),
                Product(314, "_Bananas_", "My favorite", 42, 450)]
    return products, customers, staff_members, store
Ejemplo n.º 6
0
def staff_search_by_subject(subject):
    db = connection()
    sql = "select * from staff where subject='{}'".format(subject)
    cursor = db.cursor()
    cursor.execute(sql)
    result = cursor.fetchone()
    if result:
        s = Staff(name=result[1],
                  address=result[2],
                  contact_no=result[3],
                  salary=result[4],
                  post=result[5],
                  sex=result[6])
        s.setSN(result[0])
    return result
    return s
Ejemplo n.º 7
0
def getStaffDetails(sn):
    db = connection()
    sql = "select * from staff where s.n='{}'".format(sn)
    cursor = db.cursor()
    cursor.execute(sql)
    original_staff = cursor.fetchone()
    if (original_staff):
        s = Staff(name=original_staff[1],
                  address=original_staff[2],
                  contact_no=original_staff[3],
                  salary=original_staff[4],
                  postt=original_staff[5],
                  sex=original_staff[6])
        s.setSn(original_staff[0])
    return original_staff
    return s
Ejemplo n.º 8
0
    def printing_receipt():
        # Dummy Data
        store = Store(1111, "Nozima's & Darhon's Store", "Ziyollilar,9",
                      998908889900)
        staff = Staff(1234, 2222, entry_Name.get(), "Ziyollilar,9", "Manager",
                      1234)
        customer = Customer(entry_CustomerID.get(), "ban", "ddd", 122,
                            23232323, ["VIP"])
        order = Order(store, customer, staff)

        if not are_product_cells_empty():
            if are_product_cells_valid():
                for entries in products:
                    product = get_product(entries)
                    quantity = int(entries[quantity_index].get())
                    order.add_product(product, quantity)

                # RECEIPT WINDOW
                t = Toplevel()
                t.wm_title("Receipt")
                labeltest = Label(t,
                                  text=str(order.generate_receipt()),
                                  font=("Courier", 12))
                labeltest.pack()

                def array_clear():
                    del products[:]
                    t.destroy()

                close_receipt_Button = Button(t,
                                              text="Close",
                                              bg="#386fe5",
                                              width=8,
                                              font=("Courier", 12, "bold"),
                                              command=array_clear)
                close_receipt_Button.pack(pady=10)
                t.protocol("WM_DELETE_WINDOW", array_clear)

            else:
                tkinter.messagebox.showinfo(
                    "Warning!",
                    "Price must be FLOAT or INTEGER\nPoints, Quantity - MUST be INTEGER"
                )
        else:
            tkinter.messagebox.showinfo(
                "Warning!", "Firstly fill all the gaps, then you can Print!")
Ejemplo n.º 9
0
def add_teacher():
    name = input("Enter the name of the staff")
    address = input("Enter the address of the staff")
    contact_no = int(input("Enter the contact no of the staff"))
    salary = int(input("Enter the salary of the staff"))
    post = input("Enter the post the staff")
    sex = input("Enter the sex of the staff")
    s = Staff(name=name,
              address=address,
              contact_no=contact_no,
              salary=salary,
              post=post,
              sex=sex)
    is_inserted = staff_database.add_staff(s)
    if is_inserted:
        print("The data have been inserted")
    else:
        print("The data have not been inserted")
Ejemplo n.º 10
0
def set_staff_distribution(companyId):
    users = database.execute_query("select * from staff where companyId='{}'".format(companyId))
    l = len(users)
    serial = [i for i in range(l)]
    print(users[0][9])
    random.shuffle(serial)
    a, b = int(l * 0.2), int(l * 0.75)
    c = l - a - b
    for i in range(a):
        users[i] = list(users[i])
        users[i][9] = '-1'
    for i in range(a, a + b):
        users[i] = list(users[i])
        users[i][9] = '0'
    for i in range(a + b, l):
        users[i] = list(users[i])
        users[i][9] = '1'
    sql = Staff.get_update_sql()
    for i in range(len(users)):
        users[i].append(users[i].pop(0))
    user_data = tuple([tuple(i) for i in users])
    database.execute_change(sql, user_data)
Ejemplo n.º 11
0
#Python3

# import statements in various flavors
from Staff import Staff
import A as a
import ProgStaff
from MethodDemo import MethodDemo

from MyClass import SomeClass, SomeOtherClass

# import child class of Staff
from ManagementStaff import ManagementStaff
from BasicStaff import BasicStaff

officeStaff1 = Staff('Basic', 'Yvonne', 0)

print("name")
print(officeStaff1.name)

print("position")
print(officeStaff1.position)

print("set to test")
officeStaff1.position = 'Test'
print("set to Mngr")
officeStaff1.position = 'Manager'

print("position")
print(officeStaff1.position)

print("pay")
Ejemplo n.º 12
0
        cropped.append(crop_img)
        cv2.imwrite(name, crop_img)
        end_val += 5
        begin_val += 5

    staff_matrices = []
    staffs = []

    for i in range(len(start)):
        staff_matrices.append(start[i][1] - start[0][1] + expand_border)

    # print(f'staff_matrices: {staff_matrices}')
    count = 0
    for i in range(len(cropped)):
        staff = Staff(staff_matrices[:count + 5], line_thickness, line_spacing,
                      cropped[i])
        # print(f'creating staff {i}')
        staffs.append(staff)
        count += 5

    # for i in staffs:
    #     print(f'{i.line_one}\n{i.line_two}\n{i.line_three}\n{i.line_four}\n{i.line_five}')

    # print(f'Number of staffs: {num_staffs}')

    #######Getting templates###########
    quarter_note_imgs, half_note_imgs, whole_note_imgs = Resource.get_notes()
    eighth_rest_imgs, quarter_rest_imgs, half_rest_imgs, whole_rest_imgs = Resource.get_rest(
    )
    eighth_flag_imgs = Resource.get_flag()
    sharp_imgs, flat_imgs = Resource.get_accidental()
Ejemplo n.º 13
0
     objectList[i].setEmployeeNumber (objectData[i][4])
     objectList[i].setDateOfHire (objectData[i][5])
     objectList[i].setAnnualSalary (objectData[i][6])
     objectList[i].setSpecialty (objectData[i][7])
     objectList[i].setNumberOfPatients (objectData[i][8])
     print ("Name: %s"%(objectList[i].getName()))
     print ("Address: %s"%(objectList[i].getAddress ()))
     print ("DOB: %s"%(objectList[i].getDOB ()))
     print ("Employee Number: %s"%(objectList[i].getEmployeeNumber ()))
     print ("Date Of Hire: %s"%(objectList[i].getDateOfHire ()))
     print ("Annual Salary: %s"%(objectList[i].getAnnualSalary ()))
     print ("Specialty: %s"%(objectList[i].getSpecialty ()))
     print ("Number of Patients: %s\n"%(objectList[i].getNumberOfPatients ()))
 elif objectData[i][0] == "Staff":
     print (objectList[i], " has attributes as given: \n")
     objectList[i] = Staff()
     objectList[i].setName (objectData[i][1])
     objectList[i].setAddress (objectData[i][2])
     objectList[i].setDOB (objectData[i][3])
     objectList[i].setEmployeeNumber (objectData[i][4])
     objectList[i].setDateOfHire (objectData[i][5])
     objectList[i].setDepartment (objectData [i][6])
     objectList[i].setJobTitle (objectData [i][7])
     objectList[i].setHourlySalary (objectData [i][8])
     objectList[i].setStatus (objectData [i][9])
     print ("Name: %s"%(objectList[i].getName()))
     print ("Address: %s"%(objectList[i].getAddress ()))
     print ("DOB: %s"%(objectList[i].getDOB ()))
     print ("Employee Number: %s"%(objectList[i].getEmployeeNumber ()))
     print ("Date Of Hire: %s"%(objectList[i].getDateOfHire ()))
     print ("Department: %s"%(objectList[i].getDepartment ()))
Ejemplo n.º 14
0
from Person import Person
from Student import Student
from Staff import Staff
import os

PersonObj = Person('', '',)
StudentObj = Student('', '', '', '', '')
StaffObj = Staff('', '', '', '')

os.system('cls')
print('Objectos iniciales')
print(PersonObj.toString())
print(StudentObj.toString())
print(StaffObj.toString())

PersonObj.setName('Obama')
PersonObj.setAddress('Calle 53')

print()
print('Persona editada')
print(PersonObj.toString())

StudentObj.setName('Obama')
StudentObj.setAddress('Calle 53')
StudentObj.setYear('12/12/12')
StudentObj.setProgram('SOFT ING')
StudentObj.setFee(2.2)

print()
print('Estudiante Editido')
print(StudentObj.toString())
Ejemplo n.º 15
0
from Customer import Customer
from Order import Order
from Product import Product
from Staff import Staff
from Store import Store

if __name__ == "__main__":

    c1 = Customer("01223", "Peter Parker", "Qo'yliq", 2.2, "90-932-75-98",
                  ["Silver", 'Gold'])
    c2 = Customer("01223", "Sherlock Holmes", "Backer street", 31415,
                  "90-987-65-43", ["Regular", 'VIP'])
    store = Store('U1510375', "John's Mall", "Ziyolar-9", "90-123-45-67")
    staff1 = Staff("0", "02213", "Uncle Ben", "Manager")
    staff2 = Staff("1", "45646", "Aunt May", "Cashier")
    staff3 = Staff('2', "12345", "John Doe", "Owner")
    p1 = Product(69, "Cucumber", "Fresh and long cucumber", 69.69, 666)
    p2 = Product(666, "Tomatoes", "Red and plump", 12.14, 314)
    order = Order(store, c1, staff2)

    print(store)
    print()
    print(c1)
    print()
    print(c2)
    print()
    print(staff1)
    print()
    print(staff2)
    print()
    ans = 0
Ejemplo n.º 16
0
import xlrd
import xlwt
import os, shutil
from Staff import Staff
from SheetHelper import SheetHelper

doneDirPath = os.path.join(os.getcwd(), '文件池', '已完成')
if not os.path.exists(doneDirPath):
    os.makedirs(doneDirPath)

list = os.listdir('文件池')
myWorkbook = xlwt.Workbook()
mySheet = myWorkbook.add_sheet('New Staff')

SheetHelper.writeTheHeader(mySheet)

for i in range(0, len(list)):
    path = os.path.join(os.getcwd(), '文件池', list[i])
    print(path)

    if os.path.isfile(path) and os.path.splitext(list[i])[-1] == ".xlsx":
        book = xlrd.open_workbook(path)
        sh = book.sheet_by_index(0)
        staff = Staff(sh)
        staff.writeToSheet(mySheet, i + 1)

        shutil.move(path, os.path.join(doneDirPath, list[i]))

myWorkbook.save('结果.xls')
Ejemplo n.º 17
0
 def login(self, username, password, usertype):
     data = self.repo.checkDetails(username, password, usertype)
     if data is None:
         return None
     print(data)
     if usertype == "staff":
         user = Staff()
         user.set_id(data[0])
         user.set_username(data[1])
         user.set_role(data[3])
         user.set_reset_pass_status(data[4])
         return user
     else:
         user = Artist()
         user.set_id(data[0])
         user.set_birthdate(data[1])
         user.set_email(data[3])
         user.set_username(data[4])
         user.set_reset_pass_status(data[5])
         return user
Ejemplo n.º 18
0
def update_staff():
    sn = int(input("Enter the roll no:"))
    is_inserted = staff_database.getStaffDetails(sn)
    if is_inserted:
        staff_detail = staff_database.getStaffDetails(sn)
        print(staff_detail)
        print("The detail are")
        print("Name= " + staff_detail[1])
        print("Address= " + staff_detail[2])
        print("Contact no= " + staff_detail[3])
        print("Salary= " + staff_detail[4])
        print("Subject= " + staff_detail[5])
        print("Sex= " + staff_detail[6])
    update_menu = """
        1.Name
        2.Address
        3.Contact
        4.Salary
        5.Post"""
    print(update_menu)
    update_choice = int(input("Enter the update choice"))
    if update_choice == 1:
        update_name = input("Enter the name of the staff to update:")
        staff_object = Staff(name=update_name, address=None, contact_no=None, salary=None, post=None, sex=None)
        staff_object.setSN(staff_detail[0])
        is_updated = staff_database.update_name(staff_object)
        if is_updated:
            print("The data is updated")
        else:
            print("The data is not updated")
    elif update_choice == 2:
        update_address = input("Enter the address of the staff to update:")
        staff_object = Staff(name=None, address=update_address, contact_no=None, salary=None, post=None,
                                 sex=None)
        staff_object.setSN(staff_detail[0])
        is_updated = staff_database.update_address(staff_object)
        if is_updated:
            print("The data is updated")
        else:
            print("The data is not updated")
    elif update_choice == 3:
        update_contact = input("Enter the contact of the staff to update:")
        staff_object = Staff(name=None, address=None, contact_no=update_contact, salary=None, post=None,
                                 sex=None)
        staff_object.setSN(staff_detail[0])
        is_updated = staff_database.update_contact_no(staff_object)
        if is_updated:
            print("The data is updated")
        else:
            print("The data is not updated")
    elif update_choice == 4:
        update_salary = input("Enter the address of the staff to update:")
        staff_object = Staff(name=None, address=None, contact_no=None, salary=update_salary, post=None,
                                 sex=None)
        staff_object.setSN(staff_detail[0])
        is_updated = staff_database.update_salary(staff_object)
        if is_updated:
            print("The data is updated")
        else:
            print("The data is not updated")
    elif update_choice == 5:
        update_post = input("Enter the post of the staff to update:")
        staff_object = Staff(name=None, address=None, contact_no=None, salary=None, post=update_post,
                                 sex=None)
        staff_object.setSN(staff_detail[0])
        is_updated = staff_database.update_post(staff_object)
        if is_updated:
            print("The data is updated")
        else:
            print("The data is not updated")
    else:
        print("Invalid Choice")
Ejemplo n.º 19
0
 def _addStaff(self):
     newStaff = Staff()
     self._staffs.append(newStaff)
     self._setStaffCallBack(newStaff, self.numStaffs() - 1)
Ejemplo n.º 20
0
                    capacity = int(input('Capacity: '))
                    course = Course(title, professor, id, unit, capacity)
                    course.capacity_update(fill_capacity)
                    deleted_course.append(course_request)
                    print(
                        Fore.LIGHTGREEN_EX + f'Elective course to delete is {course_request}')
                    print(Style.RESET_ALL)


    # else:
    #     print(Fore.RED + "Personal code or length of your password is incorrect . ")
    #     print(Style.RESET_ALL)
    """   Staff(Education)  """
    if len(password) == 6 and username_sample.check_Personal_code(personal_code) == True:
        name, family = input('name,family: ').split(',')
        staff = Staff(name, family)

        print(Fore.LIGHTCYAN_EX + "Enter one of the following numbers:"
                                  " \n1- Definition of Course \n2- View and Enroll elective courses ")
        print(Style.RESET_ALL)
        selection = int(input('selection: '))
        if selection == 1:
            number_course_define = int(input('How many lessons do you want to define?'))
            for i in range(number_course_define):
                title, professor, id, unit, capacity = input("Enter: Title,Professor,ID,Unit,Capacity : ").split(',')
                course = Course(title,professor,id,unit,capacity)
                staff.course_define(title, professor, id, unit, capacity)

        elif selection == 2:

            name, family = input('Name of student,Family of student: ').split(',')
Ejemplo n.º 21
0
@author: z5075710
"""
import pytest
from Order import Order
from Ingredient import Ingredient
from Main import Main
from Sides import Sides

from Staff import Staff

#Customer Ordering main
print('Ordering ...')
Main = Main()
Sides = Sides()
Ingredient = Ingredient()
Staff = Staff()

main = Main.name[0]
print(main)
main = Main.name[1]
print(main)

mainBun = Main.bun_type[0]
print(mainBun)
mainBun = Main.bun_type[1]
print(mainBun)

mainBunNo = 3
print(mainBunNo)
mainBunNo = 2
print(mainBunNo)
Ejemplo n.º 22
0
import json
import os
import importlib
import urllib.request
from stanfordcorenlp import StanfordCoreNLP


def load_property(name):
    with open(os.path.dirname(__file__) + '/mapping.json', 'r', encoding='utf-8') as f:
        mapping = json.load(f)
        return mapping.get(name)

if __name__ == '__main__':
    config = load_property("leave")
    module = importlib.import_module(config["file"])
    from Staff import Staff
    staff = Staff("001", "倪奕玮", "徐锦程", "同济大学")
    while True:

        print("你要做什么呢")
        sentence = input()
        if module.entry(sentence):
            standord_nlp = StanfordCoreNLP('http://localhost', port=9000)
            message = module.ask(sentence, config["component"], standord_nlp)
            print(staff.toString() + module.format(message))
            print("-----------------")
            print(message)