Exemple #1
0
    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()
Exemple #2
0
    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()
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #9
0
 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()
Exemple #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()
Exemple #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()
Exemple #12
0
 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()
Exemple #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()
Exemple #14
0
    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()
Exemple #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()
Exemple #16
0
    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()