예제 #1
0
파일: views.py 프로젝트: s-soroosh/rose
    def post(self, request):
        try:
            customer_info = RealCustomerInformation.from_dic(request.POST)
            customer_info.save()
            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)
        except Exception as e:
            print(e)
            return generate_error_response()
예제 #2
0
파일: views.py 프로젝트: psycho-ir/rose
    def post(self, request):
        try:
            customer_info = RealCustomerInformation.from_dic(request.POST)
            customer_info.save()
            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)
        except Exception as e:
            print(e)
            return generate_error_response()
예제 #3
0
    def post(self, request):
        try:
            activity = EnterpriseActivity.from_dic(request.POST)
            activity.save()

            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)
        except Exception as e:
            print e
            return generate_error_response()
예제 #4
0
    def post(self, request):
        try:
            board = BoardOfDirector.from_dic(request.POST)
            board.save()

            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)
        except Exception as e:
            print e
            return generate_error_response()
예제 #5
0
    def post(self, request):
        try:
            complete_info = RequestCompleteInformation.from_dic(request.POST)
            complete_info.save()
            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)

        except Exception as e:
            print e
            return generate_error_response()
예제 #6
0
    def post(self, request):
        try:
            activity = EnterpriseActivity.from_dic(request.POST)
            activity.save()

            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)
        except Exception as e:
            print e
            return generate_error_response()
예제 #7
0
    def post(self, request):
        try:
            board = BoardOfDirector.from_dic(request.POST)
            board.save()

            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)
        except Exception as e:
            print e
            return generate_error_response()
예제 #8
0
    def post(self, request):
        try:
            complete_info = RequestCompleteInformation.from_dic(request.POST)
            complete_info.save()
            return generate_ok_response()

        except ValidationException as e:
            return generate_error_response(e.message)

        except Exception as e:
            print e
            return generate_error_response()
예제 #9
0
파일: views.py 프로젝트: s-soroosh/rose
 def post(self, request):
     try:
         contact_info = ContactInformation.from_dic(request.POST)
         contact_info.save()
         return generate_ok_response()
     except Exception as e:
         print e
         return generate_error_response()
예제 #10
0
 def post(self, request):
     try:
         asset = EnterpriseAssetInformation.from_dic(request.POST)
         asset.save()
         return generate_ok_response()
     except Exception as e:
         print e
         return generate_error_response()
예제 #11
0
 def post(self, request):
     try:
         asset = EnterpriseAssetInformation.from_dic(request.POST)
         asset.save()
         return generate_ok_response()
     except Exception as e:
         print e
         return generate_error_response()
예제 #12
0
파일: views.py 프로젝트: psycho-ir/rose
 def post(self, request):
     try:
         contact_info = ContactInformation.from_dic(request.POST)
         contact_info.save()
         return generate_ok_response()
     except Exception as e:
         print e
         return generate_error_response()
예제 #13
0
 def get(self, request):
     try:
         activity = EnterpriseActivity.objects.get(company_id=request.GET.get('company_id'),
                                                   id=request.GET.get('activity_id'))
         print activity
         activity.delete()
         return generate_ok_response()
     except Exception as e:
         print e
         return generate_error_response()
예제 #14
0
파일: views.py 프로젝트: s-soroosh/rose
    def post(self, request):
        try:
            no_vasighe = request.POST.get('no_vasighe_info')
            no_income = request.POST.get('no_income')

            # when we don't  want to save income
            # todo here we have a bad design and we need to change this block of code
            if not no_income:
                bank_income = BankIncomeInformation.from_dic(request.POST)
                bank_income.save()

            if not no_vasighe:
                vasighes = request.POST.getlist('vasighe_types')
                if len(vasighes) == 0:
                    print "There is no selected vasighe_type"
                    return generate_error_response(
                        "There is no selected vasighe_type")

                banks = request.POST.getlist('banks')

                if len(banks) == 0:
                    print "There is no selected bank"
                    return generate_error_response("There is no selected bank")

                maskan_vasighe_type = VasigheType.objects.filter(
                    name='melk-tejari-edari').first()
                sanad = None
                if str(maskan_vasighe_type.id) in vasighes:
                    sanad = SanadMelkiInformation.from_dic(request.POST)
                    sanad.save()
                bank_vasighe = BankVasigheInformation.from_dic(
                    request.POST, sanad)
                bank_vasighe.save()
                SanadMelkiInformation.objects.exclude(
                    bankvasigheinformation__in=BankVasigheInformation.objects.
                    all()).delete()

            return generate_ok_response()

        except Exception as e:
            print e
            return generate_error_response()
예제 #15
0
 def get(self, request):
     try:
         activity = EnterpriseActivity.objects.get(
             company_id=request.GET.get('company_id'),
             id=request.GET.get('activity_id'))
         print activity
         activity.delete()
         return generate_ok_response()
     except Exception as e:
         print e
         return generate_error_response()
예제 #16
0
파일: views.py 프로젝트: psycho-ir/rose
    def post(self, request):
        try:
            no_vasighe = request.POST.get('no_vasighe_info')
            no_income = request.POST.get('no_income')

            # when we don't  want to save income
            # todo here we have a bad design and we need to change this block of code
            if not no_income:
                bank_income = BankIncomeInformation.from_dic(request.POST)
                bank_income.save()

            if not no_vasighe:
                vasighes = request.POST.getlist('vasighe_types')
                if len(vasighes) == 0:
                    print "There is no selected vasighe_type"
                    return generate_error_response("There is no selected vasighe_type")

                banks = request.POST.getlist('banks')

                if len(banks) == 0:
                    print "There is no selected bank"
                    return generate_error_response("There is no selected bank")

                maskan_vasighe_type = VasigheType.objects.filter(name='melk-tejari-edari').first()
                sanad = None
                if str(maskan_vasighe_type.id) in vasighes:
                    sanad = SanadMelkiInformation.from_dic(request.POST)
                    sanad.save()
                bank_vasighe = BankVasigheInformation.from_dic(request.POST, sanad)
                bank_vasighe.save()
                SanadMelkiInformation.objects.exclude(
                    bankvasigheinformation__in=BankVasigheInformation.objects.all()).delete()

            return generate_ok_response()

        except Exception as e:
            print e
            return generate_error_response()