Пример #1
0
 def post(self):
     
     session = Session()
     if session["pos"] == 2 or session["pos"] == 4:
         empl = Employee(name=self.request.get('emplName'),
                         user=User(self.request.get('user')),
                         position = self.request.get('emplPosition'),
                         years = self.request.get('emplExp'),
                         assigned = False
                         )
         empl.put()
         self.redirect("/employees")
     else:
         self.redirect("/nouser")
Пример #2
0
 def get(self):
     
     session = Session()
     if session["pos"] == 2 or session["pos"] == 4:
         employee = Employee.get_by_id(int(self.request.get('emplid')))
         vals = {'employee' : employee,
                 'position' : employee.position,
                 'url' : session["url"]}
         self.render_response("editemployeepage.html", **vals)
     else:
         self.redirect("/nouser")
Пример #3
0
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         employee = Employee.get_by_id(int(self.request.get('emplid')))
         employee.assigned = False
         employee.save()
         assign = employee.employeeonproject_set.get()
         assign.delete()
         link="/emplalocpage?id=" + str(self.request.get('projid'))
         self.redirect(link)
     else:
         self.redirect("/nouser")
Пример #4
0
 def get(self):
     
     session = Session()
     if session["pos"] == 2 or session["pos"] == 4:
         employees = Employee.all()
         noemployees = employees.count()
         vals = {'employees' : employees,
                 'noemployees' : noemployees,
                 'url' : session["url"]
                 }
         self.render_response("employeeList.html",**vals)
     else:
         self.redirect("/nouser")
Пример #5
0
 def post(self):
     
     session = Session()
     if session["pos"] == 2 or session["pos"] == 4:
         employee = Employee.get_by_id(int(self.request.get('emplId')))
         employee.name = self.request.get('emplName')
         employee.user = User(self.request.get('emplUser'))
         employee.position = self.request.get('emplPosition')
         employee.years = self.request.get('emplExp')
         
         employee.save()
         self.redirect('/employees')
     else:
         self.redirect("/nouser")
Пример #6
0
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         project =Project.get_by_id(int(self.request.get('projid')))
         employee= Employee.get_by_id(int(self.request.get('emplid')))
         emplon = EmployeeOnProject(proj=project, empl=employee)
         emplon.put()
         employee.assigned = True
         employee.save()
         link = "/emplalocpage?id=" + str(self.request.get('projid'))
         self.redirect(link)
     else:
         self.redirect("/nouser")
Пример #7
0
 def get(self):
     
     session = Session()
     if session["pos"] == 2 or session["pos"] == 4:
         empl = Employee.get_by_id(int(self.request.get('emplid')))
         emplskills = empl.employeeskills_set
         emplonproj = empl.employeeonproject_set
         for es in emplskills:
             es.delete()
         for ep in emplonproj:
             ep.delete()
         empl.delete()
         self.redirect('/employees')
     else:
         self.redirect("/nouser")
Пример #8
0
 def get(self):
     
     session = Session()
     viewer = session["empl"]
     emplid = self.request.get('emplid')
     employee = Employee.get_by_id(int(emplid))
     if viewer.key().id == employee.key().id:
         skill = Skill.get_by_id(int(self.request.get('skillid')))
         skillempl = employee.employeeskills_set.filter('skill = ', 
                                                        skill.key()).get()
         skillempl.delete()
         link = "/profilepage?emplid=" + emplid
         self.redirect(link)
     else:
         self.redirect("/nouser")
Пример #9
0
 def get(self):
     
     session = Session()
     employee = Employee.get_by_id(int(self.request.get('emplid')))
     skills = [Anon(skill=es.skill,exp=es.yearsxper) for es in employee.employeeskills_set]
     noskills = len(skills)
     allskills = Skill.all()
     viewer = session["empl"]
     if viewer.key().id == employee.key().id:
         owner = True
     else:
         owner = False
     vals = {'employee' : employee,
             'skills' : skills,
             'noskills' : noskills,
             'allskills' : allskills,
             'owner' : owner,
             'url' : session["url"]}
     self.render_response("profilePage.html", **vals)
Пример #10
0
 def post(self):
     
     session = Session()
     employee = Employee.get_by_id(int(self.request.get('employeeId')))
     viewer = session["empl"]
     if viewer.key().id == employee.key().id:
         owner = True
     else:
         owner = False
     if owner:
         skilll = Skill.get_by_id(int(self.request.get('skillId')))
         years = str(self.request.get('skillExperience'))
         emplskill = EmployeeSkills(skill=skilll,
                                    empl=employee,
                                    yearsxper=years)
         emplskill.put()
         link = "/profilepage?emplid=" + str(self.request.get('employeeId'))
         self.redirect(link)
     else:
         self.redirect("/nouser")
Пример #11
0
 def get(self):
     
     session = Session()
     if session["pos"] == 1 or session["pos"] == 4:
         raw_id = self.request.get('id')
         id = int(raw_id)
         employee_list = Employee.gql("WHERE assigned = False and position != :1", "Project Manager")
         noempl = employee_list.count()
         project = Project.get_by_id(id)
         employeesonthisproject = [angaj.empl for angaj in project.employeeonproject_set]
         noemplonthis = len(employeesonthisproject)
         vals = { 'noempl' : noempl,
                  'employees' : employee_list,
                  'project' : project,
                  'employeesonthis' : employeesonthisproject,
                  'noemplonthis' : noemplonthis,
                  'url' : session["url"]
                 }
         self.render_response("employeealoc.html", **vals)
     else:
         self.redirect("/nouser")
Пример #12
0
 def get_employee(self):
     
     empl = Employee.gql("WHERE user = :u", u=users.get_current_user()).get()
     if empl:
         return empl