Example #1
0
def JobTypeIndex(HttpRequest):
  try:
    JobTypeFunctionsObj = JobTypeFunctions()
    JobTypeList = JobTypeFunctionsObj.getObjectsAll()
    if JobTypeList[0] != 1:
      messages.error(HttpRequest,'ERROR : ' + str(JobTypeList[1]))
      return HttpResponseRedirect('/message/')
    else:
      return render_to_response('Jobs/ListJobType.html',{'JobTypeList':JobTypeList[1]},context_instance=RequestContext(HttpRequest))
  except Exception, ex:
      frame = inspect.currentframe()
      args, _, _, values = inspect.getargvalues(frame)
      msg = ''
      for i in args:
        msg += "[%s : %s]" % (i,values[i])
      LoggerJobs.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
      messages.error(HttpRequest,'ERROR: ' + str(ex))
      return HttpResponseRedirect('/message/')
Example #2
0
def EditJobIndex(HttpRequest,CompanyID, JobID):
  try:
    BranchList = Branch.objects.all()
    if ( JobID == -1):
      # add company
      return render_to_response('Jobs/AddJobNotification.html',{'Edit':False,'BranchList':BranchList,'CompanyID':CompanyID},context_instance=RequestContext(HttpRequest))
    else:
      # edit company
      details = GetLoginDetails(HttpRequest)
      if( details['userid'] == -1):
        return HttpResponseRedirect('/user/login/')
      JobFunctionsObj = JobFunctions()
      result = JobFunctionsObj.getObjectByID(JobID)
      if result[0] != 1:
        messages.error(HttpRequest,"ERROR " + str(result[1]))
        return HttpResponseRedirect('/message/')
      else:
        BranchJobFunctionsObj = BranchJobFunctions()
        BranchJobList = BranchJobFunctionsObj.getObjectsbyJob(JobID)
        if BranchJobList[0] != 1:
          messages.error(HttpRequest,"ERROR " + str(BranchJobList[1]))
          return HttpResponseRedirect('/message/')
        JobTypeFunctionsObj = JobTypeFunctions()
        JobTypeList = JobTypeFunctionsObj.getObjectsAll()
        if JobTypeList[0] != 1:
          messages.error(HttpRequest,"ERROR " + str(JobTypeList[1]))
          return HttpResponseRedirect('/message/')
        BranchJobListID = [ x.Branch.id for x in BranchJobList[1]]
        return render_to_response('Jobs/EditJobNotification.html',{'Edit':True,'BranchList':BranchList,'CompanyID':CompanyID,'JobObj':result[1],'BranchJobList':BranchJobList[1],'JobTypeList':JobTypeList[1],'BranchJobListID':BranchJobListID},context_instance=RequestContext(HttpRequest))
  except Exception, ex:
      frame = inspect.currentframe()
      args, _, _, values = inspect.getargvalues(frame)
      msg = ''
      for i in args:
        msg += "[%s : %s]" % (i,values[i])
      LoggerJobs.exception('%s : %s' % (inspect.getframeinfo(frame)[2],msg))
      messages.error(HttpRequest,'ERROR: ' + str(ex))
      return HttpResponseRedirect('/message/')