def find_dept(self): Deptno=raw_input("Enter Department Number:") f=open("department.txt","r") lines=f.readlines() for line in lines: words=line.split("\t") if words[0]==Deptno: print line print "The Department Data Found Successfully" break else: print "The Data Doesnot found on the Department number" f.close() print "*"*30 print "Please go through below options:" print "1.If you want to find one more department: " print "2.If you want go to options of department: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: de=cl_Dept() de.find_dept() elif ch==2: from sub_options import suboptions su= suboptions() su.department_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def list_dept(self): f=open("department.txt","r") lines=f.readlines() print "*"*50 print "The Department Details in the Organization are:" print "*"*50 for line in lines: print line f.close() print "The Details of each and every department in the organization are displayed" print "*"*30 print "Please go through below options:" print "1.If you want go to options of Department: " print "2.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: from sub_options import suboptions su= suboptions() su.department_options() elif ch==2: exit() else: print "invalid choice, enter a correct choice:" return
def add_dept(self): Deptno=v.validation_dno() Dname=raw_input("Enter Department Name:") Loc=raw_input("Enter Department Location:") f=open("department.txt","a") data="%s\t%s\t%s\t\n"%(Deptno,Dname,Loc) f.write(data) f.close() print "The record added successfully" print "*"*30 print "Please go through below options:" print "1.If you want to add one more Department: " print "2.If you want go to options of Department: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: de=cl_Dept() de.add_dept() elif ch==2: from sub_options import suboptions su= suboptions() su.department_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def add_project(self): Pid=v.validation_pid() Pname=raw_input("Enter Project Name:") Teamsize=v.validation_psize() Pdomain=raw_input("Enter the Domain of Project:") Pclient=raw_input("Enter Project Client name:") Pmanager=raw_input("Enter the name of Project Manager:") f=open("project.txt","a") data="%s\t%s\t%s\t%s\t%s\t%s\n"%(Pid,Pname,Teamsize,Pdomain,Pclient,Pmanager) f.write(data) f.close() print "You have Added successfully" print "*"*30 print "1.If you want to add one more project: " print "2.If you want go to options of project: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: p=cl_project() p.add_project() elif ch==2: from sub_options import suboptions su= suboptions() su.project_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def search_project(self): Pname=raw_input("Enter project name:") f = open("project.txt","r") lines=f.readlines() for line in lines: words=line.split("\t") if words[1]==Pname: print line print Pname,":project is founded" break else: print "project not founded" f.close() print "1.If you want to find one more project: " print "2.If you want go to options of project: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: p=cl_project() p.search_project() elif ch==2: from sub_options import suboptions su= suboptions() su.project_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def search_attendance(self): eid=raw_input("Enter employee id:") f = open("reports.txt","r") lines=f.readlines()[1:] for line in lines: words=line.split("\t") if words[0]==eid: print lineimport.datetime print "Please go through below options:" print "1.If you want to find one more employee attendance: " print "2.If you want go to options of attendance: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: a=cl_attendance() a.search_attendance() elif ch==2: from sub_options import suboptions su= suboptions() su.attendance_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def add_attendance(self): Eid=v.validation_eno() month=raw_input("Enter Month no:") if int(month) > datetime.datetime.today().month: print "enter valid month" add_attendance() year=raw_input("Enter year") leaves=raw_input("Enter leaves") org_wdays=raw_input("Enter org working days :") emp_wdays=str(int(org_wdays)-int(leaves)) s=0 #print emp_wdays f=open("reports.txt") ls=f.readlines()[1:] f.close() for l in ls: words=l.split("\t") if eid == words[0] and month == words[4] : s=s+1 #print ch break if s == 0: f1=open("reports.txt","a") s="\n"+Eid+"\t"+org_wdays+"\t"+leaves+"\t"+emp_wdays+"\t"+month+"\t"+year try: f1.write(s) print "Record added" f1.close() except: print "Error occured" f1.close() else: print "Record already exists" print "Please go through below options:" print "1.If you want to add one more employee attendance: " print "2.If you want go to options of attendance: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: a=cl_attendance() a.add_attendance() elif ch==2: from sub_options import suboptions su= suboptions() su.attendance_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def update_dept(self): Loc=raw_input("Enter Department location :") new=raw_input("Enter new location:") f = open("department.txt","r") lines=f.readlines() for i in range(len(lines)): words=lines[i].split("\t") if words[2] == Loc: lines[i] = lines[i].replace(Loc,new) print lines[i] break else: print "Record Not Found" return f.close() with open("department.txt","w") as f: f.write("".join(lines)) f.close() print " Department Location Updated Successfully" print "*"*30 print "Please go through below options:" print "1.If you want to update one more department: " print "2.If you want go to options of department: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: de=cl_Dept() de.update_dept() elif ch==2: from sub_options import suboptions su= suboptions() su.department_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def update_employee(self): Ename=raw_input("Enter employee old name:") new=raw_input("Enter new name:") f = open("employee.txt","r") lines=f.readlines() for i in range(len(lines)): words=lines[i].split("\t") if words[1] == Ename: lines[i] = lines[i].replace(Ename,new) print lines[i] break else: print "Record Not Found" return f.close() with open("employee.txt","w") as f: f.write("".join(lines)) f.close() print " Employee details Updated Successfully" print "*"*30 print "Please go through below options:" print "1.If you want to update one more employee: " print "2.If you want go to options of employee: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: e=cl_Employee() e.update_employee() elif ch==2: from sub_options import suboptions su= suboptions() su.employee_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def update_project(self): Pid=raw_input("Enter project id:") new=raw_input("Enter project new size:") f = open("project.txt","r") lines=f.readlines() #t = lines[:] #lines = lines[1:] for i in range(len(lines)): words=lines[i].split("\t") if words[0] == Pid: lines[i] = lines[i].replace(words[2],new) print lines[i] break else: print "Record Not Found" return f.close() with open("project.txt","w") as f: f.write("".join(lines)) f.close() print " Employee details Updated Successfully" print "1.If you want to find one more project: " print "2.If you want go to options of project: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: p=cl_project() p.update_project() elif ch==2: from sub_options import suboptions su= suboptions() su.project_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def delete_dept(self): Deptno=raw_input("Enter Department Number:") f=open("department.txt","r") lines=f.readlines() for i in range(len(lines)): words=lines[i].split("\t") if words[0]==Deptno: print lines[i] lines.pop(i) f=open("employee.txt","w") f.write("".join(lines)) f.close() print "The Department Record was deleted" break else: print "There is no record on the Department Number" f.close() print "*"*30 print "Please go through below options:" print "1.If you want to Delete one more Department: " print "2.If you want go to options of Department: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: de=cl_Dept() de.delete_dept() elif ch==2: from sub_options import suboptions su= suboptions() su.department_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def delete_project(self): Pname = raw_input("enter which project name to deleta:") with open("project.txt", "r") as f: lines = f.readlines() t = lines for i in range(len(lines)): words=lines[i].split("\t") if str(words[1]) == Pname: print lines[i] t.pop(i) f = open("project.txt","w") #f.write("Pidname\tpid\tpmanager\tduration\n") f.write("".join(t)) f.close() print " project details deleted Successfully" break else: print "project not found: " print "*"*30 print "1.If you want to delete one more project: " print "2.If you want go to options of project: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: p=cl_project() p.delete_project() elif ch==2: from sub_options import suboptions su= suboptions() su.project_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return
def list_project(self): f = open("project.txt","r") lines=f.readlines() print"the list of projects are:"+str(len(lines)-1) for line in lines: print line f.close() print "1.If you want go to options of project: " print "2.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: from sub_options import suboptions su= suboptions() su.project_options() elif ch==2: exit() else: print "invalid choice, enter a correct choice:" return
def add_employee(self): Eid=v.validation_Empno() Ename=raw_input("Enter Employee Name:") Designation=raw_input("Enter Employee Designation:") Deptno=v.validation_deptno() Address=raw_input("Enter Employee Address:") Salary=v.validation_Salary() Email=v.validation_Email() Phno=v.validation_Phno() f=open("employee.txt","a") data="%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n"%(Eid,Ename,Designation,Deptno,Salary,Email,Address,Phno) f.write(data) f.close() print "You have registered successfully" print "*"*30 print "Please go through below options:" print "1.If you want to add one more employee: " print "2.If you want go to options of employee: " print "3.if you want to exit:" try: ch=int(raw_input("Enter Your Choice:")) except Exception as e: print "The Error is :",e print "Please enter integers only" if ch==1: e=cl_Employee() e.add_employee() elif ch==2: from sub_options import suboptions su= suboptions() su.employee_options() elif ch==3: exit() else: print "invalid choice, enter a correct choice:" return