Example #1
0
    def post(self):
        json_values = {}

        try:
            code = self.request.get('code')
            pwd = self.request.get('pwd')

            if code is None or len(code) < 1:
                raise Exception('You must enter an Attendant ID.')

            if pwd is None or len(pwd) < 1:
                raise Exception('You must enter a Password.')

            vm = AttendantViewModel()
            vm.code = code
            vm.pwd = pwd

            app_service = AccountAppService()
            app_service.login(vm)

            # save to session
            self.session['attendant_code'] = vm.code

            json_values['returnStatus'] = True
        except Exception, ex:
            json_values['returnStatus'] = False
            json_values['returnMessage'] = str(ex)
Example #2
0
 def attendant_login(self):
     try:
         vm = AttendantViewModel()
         vm.code = '1'
         vm.pwd = '1'
         
         app_service = AttendantAccountAppService()
         app_service.login(vm)
         
         self.response.write("attendant_login OK.")
     
     except Exception, ex:
         self.response.write("attendant_login failed. %s" % str(ex))
Example #3
0
    def attendant_login(self):
        try:
            vm = AttendantViewModel()
            vm.code = '1'
            vm.pwd = '1'

            app_service = AttendantAccountAppService()
            app_service.login(vm)

            self.response.write("attendant_login OK.")

        except Exception, ex:
            self.response.write("attendant_login failed. %s" % str(ex))
Example #4
0
    def post(self):
        json_values = {}

        try:
            # get post data
            name = self.request.get("name")
            attendant_code = self.request.get("code")
            pwd = self.request.get("pwd")
            current_user = self.current_user()
            user_code = current_user.code

            #save data to view model class
            vm = AttendantViewModel()
            vm.name = name
            vm.code = attendant_code
            vm.pwd = pwd
            vm.active = True
            vm.user_code = user_code
            vm.comm_per = 5

            app_service = AttendantAppService()
            app_service.create(vm)

            # return status
            json_values['returnStatus'] = True
        except Exception, ex:
            json_values['returnStatus'] = False
            json_values['returnMessage'] = str(ex)
Example #5
0
 def create_attendant(self):
     try:
         vm = AttendantViewModel()
         vm.code = '1'
         vm.name = '1'
         vm.pwd = '1'
         vm.comm_per = 2
         
         app_service = AttendantAppService()
         app_service.create(vm)
         
         self.response.write("create_attendant OK.")
         
     except Exception, ex:
         self.response.write("create_attendant failed. %s" % str(ex))
Example #6
0
 def update_attendant(self):
     try:
         data = Attendant.query(ancestor=ndb.Key('Attendant', '1')).get()
         
         vm = AttendantViewModel()
         vm.code = '1'
         vm.name = '2'
         vm.comm_per = 2
         vm.last_modified = data.last_modified
         
         app_service = AttendantAppService()
         app_service.update(vm)
         
         self.response.write("update_attendant OK.")
         
     except Exception, ex:
         self.response.write("update_attendant failed. %s" % str(ex))
Example #7
0
    def post(self):
        json_values = {}

        try:
            current_attendant = self.current_attendant()

            pwd = self.request.get('newPwd')
            old_pwd = self.request.get('oldPwd')

            vm = AttendantViewModel()
            vm.code = current_attendant.code
            vm.pwd = pwd
            vm.old_pwd = old_pwd

            app_service = AccountAppService()
            app_service.change_pwd(vm)

            json_values['returnStatus'] = True
        except Exception, ex:
            json_values['returnStatus'] = False
            json_values['returnMessage'] = str(ex)
Example #8
0
    def create_attendant(self):
        try:
            vm = AttendantViewModel()
            vm.code = '1'
            vm.name = '1'
            vm.pwd = '1'
            vm.comm_per = 2

            app_service = AttendantAppService()
            app_service.create(vm)

            self.response.write("create_attendant OK.")

        except Exception, ex:
            self.response.write("create_attendant failed. %s" % str(ex))
Example #9
0
    def post(self, code):
        json_values = {}

        try:
            name = self.request.get('name')
            last_modified = self.request.get('lastModified')

            current_user = self.current_user()

            vm = AttendantViewModel()
            vm.name = name
            vm.code = code
            vm.active = True
            vm.last_modified = last_modified
            vm.user_code = current_user.code
            vm.comm_per = 5

            app_service = AttendantAppService()
            app_service.update(vm)

            json_values['returnStatus'] = True
        except Exception, ex:
            json_values['returnStatus'] = False
            json_values['returnMessage'] = str(ex)
Example #10
0
    def update_attendant(self):
        try:
            data = Attendant.query(ancestor=ndb.Key('Attendant', '1')).get()

            vm = AttendantViewModel()
            vm.code = '1'
            vm.name = '2'
            vm.comm_per = 2
            vm.last_modified = data.last_modified

            app_service = AttendantAppService()
            app_service.update(vm)

            self.response.write("update_attendant OK.")

        except Exception, ex:
            self.response.write("update_attendant failed. %s" % str(ex))