def addNewEmp(): add = "新規追加" image_id = "" #画像ID作成 for _ in range(10): image_id += (random.choice(string.ascii_letters)) emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, emp_image = getEmpInfo( ) add_emp_image, emp_image = imageSetVariable(emp_image) cursor, cnx = db.connect() dept_info = db.deptInfoData(cursor) info_add, img_add = db.createAddEmpQuery(emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, add_emp_image) judge, result = db.exeAddEmpQuery(cursor, cnx, emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, add_emp_image, emp_image, info_add, img_add) return render_template("emp_add.html", add=add, judge=judge, result=result, dept_info=dept_info)
def addNewDept(): add, dept_name = getAddDeptInfo() cursor, cnx = db.connectDatabase() dept_info = db.deptInfoData(cursor) dept_add = db.setAddDeptQuery(dept_name) judge, result = db.exeAddDeptQuery(cursor, cnx, dept_name, dept_add) params = correctAddDeptValue(add, judge, result, dept_info) return render_template("dept_add.html", **params)
def searchEmp(): search_dept, search_emp_id, search_name = getSearchEmpInfo() cursor, _ = db.connect() dept_info = db.deptInfoData(cursor) query = db.createSearchQuery(search_dept, search_emp_id, search_name) emp_info, emp_count = db.exeSearchEmpQuery(cursor, query) params = correctSearchEmpValue(search_name, search_emp_id, search_dept, dept_info, emp_info, emp_count) return render_template("emp_search.html", **params)
def deleteDept(): delete_info, dept_name = getDeleteDeptInfo() cursor, cnx = db.connect() dept_info = db.deptInfoData(cursor) dept_delete = db.createDeleteDeptQuery(delete_info) message, dept_info = db.exeDeleteDeptQuery(cursor, cnx, delete_info, dept_name, dept_delete, exist_info, dept_info) return render_template("all_dept.html", dept_info=dept_info, message=message)
def addNewDept(): add, dept_name = getAddDeptInfo() cursor, cnx = db.connect() dept_info = db.deptInfoData(cursor) dept_add = db.createAddDeptQuery(dept_name) judge, result = db.exeAddDeptQuery(cursor, cnx, dept_name, dept_add) return render_template("dept_add.html", add=add, judge=judge, result=result, dept_info=dept_info)
def deleteDept(): delete_info, dept_name = getDeleteDeptInfo() cursor, cnx = db.connectDatabase() dept_info = db.deptInfoData(cursor) dept_delete = db.setDeleteDeptQuery(delete_info) exist_info = db.comformDeleteInfo(dept_info, delete_info) message, dept_info = db.exeDeleteDeptQuery(cursor, cnx, delete_info, dept_name, dept_delete, exist_info, dept_info) params = correctDeleteDeptValue(dept_info, message) return render_template("all_dept.html", **params)
def addNewEmp(): add, emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, emp_image = getEmpInfo( ) add_emp_image, emp_image = imageSetVariable(emp_image) cursor, cnx = db.connectDatabase() dept_info = db.deptInfoData(cursor) info_add, img_add = db.setAddEmpQuery(emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, add_emp_image) judge, result = db.exeAddEmpQuery(cursor, cnx, emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, add_emp_image, emp_image, info_add, img_add) params = correctAddEmpValue(add, judge, result, dept_info) return render_template("emp_add.html", **params)
def editEmp(): change_info, emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, emp_image = getChangeEmpInfo( ) add_emp_image, emp_image = imageSetVariable(emp_image) cursor, cnx = db.connectDatabase() dept_info = db.deptInfoData(cursor) edit_info, dept_select, pref_select = db.getEditEmpinfo( cursor, change_info) info_update, img_update = db.setEditEmpQuery( change_info, emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, add_emp_image) judge, result = db.exeEditQuery(cursor, cnx, emp_name, emp_age, emp_sex, emp_postal, emp_pref, emp_address, emp_dept, join_date, retire_date, image_id, add_emp_image, emp_image, info_update, img_update) params = correctEditValue(pref_select, dept_select, dept_info, edit_info, judge, result) return render_template("emp_add.html", **params)
def deptList(): cursor, _ = db.connect() dept_info = db.deptInfoData(cursor) return render_template("all_dept.html", dept_info=dept_info)
def deptList(): cursor, _ = db.connectDatabase() dept_info = db.deptInfoData(cursor) params = {"dept_info": dept_info} return render_template("all_dept.html", **params)