Ejemplo n.º 1
0
def getinfo(empno):
    with open(filepath) as f:
        lines = f.readlines()
        for line in lines:
            empdata = line.split()
            if int(empdata[0]) == empno:
                emp = Emp()  # 객체 생성
                emp.empno = int(empdata[0])
                emp.ename = empdata[1]
                emp.dept = int(empdata[2])
                emp.sal = int(empdata[3])
                emp.loc = empdata[4]
                emp.tel = empdata[5]
                emp.email = empdata[6]
                return emp
Ejemplo n.º 2
0
def getlist():
    with open(filepath) as f:
        lines = f.readlines()
        emplist = []
        for line in lines:
            empdata = line.split()
            emp = Emp() # 객체 생성
            emp.empno = int(empdata[0])
            emp.ename = empdata[1]
            emp.dept = int(empdata[2])
            emp.sal = int(empdata[3])
            emp.loc = empdata[4]
            emp.tel = empdata[5]
            emp.email = empdata[6]
            emplist.append(emp)
        return emplist
Ejemplo n.º 3
0
def update():
	#check if no records in list
	if(s.recv(1024).decode() != "empty"):
		name = input("Enter Name of Employee: ")
		s.send(name.encode())
		
		res=s.recv(1024).decode()
		
		if(res == "success"):
			e = s.recv(1024)
			e = pickle.loads(e)
			
			print("Name\t\tAge\tSalary")	
			e.disp()
			
			temp_emp = Emp()
			
			temp_emp.name = input("Enter Name : ")
			temp_emp.age = input("Enter Age : ")
			temp_emp.sal = input("Enter Salary : ")
			
			if(temp_emp.valid()):
				s.send("update".encode())
				temp_emp = pickle.dumps(temp_emp)
				s.send(temp_emp)
				res = s.recv(1024).decode()
				return res
				
			else:
				s.send("keep safe".encode())
				return s.recv(1024).decode()
			
		else:
			return "Record Not Found"
	else:
		return "No records Found"