def breakLinks(self, empID): #break external links, but don't change existing emp file for archive purposes tempEmp = employee(empID) tempEmp.inFile() #remove each project and all superiors/subordinates for projID, projHier in tempEmp.retProjList(): for sub in projHier.retSub(): tempEmp = employee(sub) tempEmp.inFile() tempEmp.remProjSup(projID, empID, 0) #remove sup from sub, no push for sup in projHier.retSup(): tempEmp = employee(sup) tempEmp.inFile() tempEmp.remProjSub(projID, empID, 0) #remove sup from sub, no push #remove emp from Proj from ProjClass import project tempProj = project(projID, "") tempProj.inFile() tempProj.remEmp(empID) for skID, skLvl in tempEmp.retSkillList(): tempSk = ability(skID, "temp", "Skill") tempSk.inFile() tempSk.remEmp(empID) for intID, intLvl in tempEmp.retIntList(): tempInt = ability(intID, "temp", "Int") tempInt.inFile() tempInt.remEmp(empID) return 1
def breakLinks(self,empID): #break external links, but don't change existing emp file for archive purposes tempEmp=employee(empID) tempEmp.inFile() #remove each project and all superiors/subordinates for projID,projHier in tempEmp.retProjList(): for sub in projHier.retSub(): tempEmp=employee(sub) tempEmp.inFile() tempEmp.remProjSup(projID,empID,0)#remove sup from sub, no push for sup in projHier.retSup(): tempEmp=employee(sup) tempEmp.inFile() tempEmp.remProjSub(projID,empID,0)#remove sup from sub, no push #remove emp from Proj from ProjClass import project tempProj = project(projID,"") tempProj.inFile() tempProj.remEmp(empID) for skID,skLvl in tempEmp.retSkillList(): tempSk=ability(skID,"temp","Skill") tempSk.inFile() tempSk.remEmp(empID) for intID,intLvl in tempEmp.retIntList(): tempInt=ability(intID,"temp","Int") tempInt.inFile() tempInt.remEmp(empID) return 1
def retEmailList(self): emList=str() from EmpClass import employee for empID in self.empList: tempEmp=employee(empID) tempEmp.inFile() empEm=tempEmp.retEmail() if not empEm=="": emList+=empEm+"; " return emList #return a list of employee emails
def breakLinks(self, projID): #break external links, but don't change existing proj file for archive purposes tempProj = project(projID) tempProj.inFile() #remove each project and all superiors/subordinates for empID in tempProj.retList(): tempEmp = employee(empID) tempEmp.remProjArch(projID) return 1
def breakLinks(self,projID): #break external links, but don't change existing proj file for archive purposes tempProj=project(projID) tempProj.inFile() #remove each project and all superiors/subordinates for empID in tempProj.retList(): tempEmp=employee(empID) tempEmp.remProjArch(projID) return 1
def addEmp(self,name): self.inFile() nmList=self.empList.values() if name in nmList: #already exists for nmID,nm in self.empList.items(): if nm == name: return nmID #return the ID for already existing emp self.lastID += 1 self.empList[self.lastID]=name self.outFile() newEmp = employee(self.lastID,name) newEmp.outFile() return self.lastID
def addEmp(self, name): self.inFile() nmList = self.empList.values() if name in nmList: #already exists for nmID, nm in self.empList.items(): if nm == name: return nmID #return the ID for already existing emp self.lastID += 1 self.empList[self.lastID] = name self.outFile() newEmp = employee(self.lastID, name) newEmp.outFile() return self.lastID
def remAbil(self,abilID): self.inFile() tempAbil=ability(abilID,"",self.kind) tempAbil.inFile() from EmpClass import employee #Remove from all employees first for empID, empSk in tempAbil.retList(): tempEmp=employee(empID) tempEmp.inFile() if self.kind=="Int": tempEmp.remInt(abilID) else: tempEmp.remSkill(abilID) #Then remove from the list self.abilList.pop(abilID) self.outFile()
def inFile(self): with open(os.path.join(os.getcwd(),"empImp.imp"),'r') as f: line=f.readline() line=line.rstrip("\n") #"Header" line=f.readline() line=line.rstrip("\n") #first line of data while not line == "": #not EOF data=line.split(",") #break out comma delimited list into array #[0] - Name #[1] - Email #[2] - Title #[3] - Birthday #[4] - Business Phone #[5] - Cell Phone #[6] - Projects On #[7] - Other #### Preformat data #### bday = self.formatBday(data[3]) busPh = self.formatPhone(data[4]) cell = self.formatPhone(data[5]) #Assume all others good# #### Preformat data #### ####Add Emp and set data#### empID = self.empList.addEmp(data[0]) tempEmp = employee(empID) tempEmp.inFile() tempEmp.setCell(cell) tempEmp.setEmail(data[1]) tempEmp.setWork(busPh) tempEmp.setTitle(data[2]) tempEmp.setBday(bday) ####Add Emp and set data#### self.addToProj(empID,data[6]) #TODO: Add b-day support, deal with project formatting, make sure outfile works line=f.readline() line=line.rstrip("\n") #next line of data
def addToProj(self,empID,pList): #projIDs,projNms=zip(*self.projList.retListItems()) #revDict=dict(zip(projNms,projIDs)) tempEmp = employee(empID) tempEmp.inFile() icdID = 1 genID = 2 waterID = 3 skunkID = 4 if(("icd" in pList.lower())|("ecp" in pList.lower())|("WELLNESS" in pList)): tempEmp.addProjOrRole(icdID) if(("gen" in pList.lower())|("gas" in pList.lower())|("clear" in pList)): tempEmp.addProjOrRole(genID) if("water" in pList.lower()): tempEmp.addProjOrRole(waterID) if(("skunk" in pList.lower())|("hans" in pList.lower())): tempEmp.addProjOrRole(skunkID) if("all" in pList.lower()): tempEmp.addProjOrRole(icdID) tempEmp.addProjOrRole(genID) tempEmp.addProjOrRole(waterID) tempEmp.addProjOrRole(skunkID)