liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
public  class SelectMedicalInstitutionAddController {
    @AuraEnabled
    public static Rental_Apply__c SelectRentalApply(String RentalApplyId){
        Rental_Apply__c  RentalApply= new Rental_Apply__c();
        List<Rental_Apply__c> RentalApplyList = [select Id,
        Medical_Institution_Address_sup__c,
        direct_shippment_address__c,
        Medical_Institution_Address__c,
        direct_send__c,
        Sparepartsdeliveryaddress__c,
        detailedAddress__c,
        Hospital__c,
        Hospital__r.State_Master__r.Name,
        Hospital__r.City_Master__r.Name,
        Hospital__r.Sparepartsdeliveryaddress1__c,
        Hospital__r.Sparepartsdeliveryaddress2__c,
        Hospital__r.Sparepartsdeliveryaddress3__c,
        Hospital__r.Sparepartsdeliveryaddress4__c,
        Hospital__r.Sparepartsdeliveryaddress5__c,
        Hospital__r.Sparepartsdeliveryaddress6__c,
        Hospital__r.Sparepartsdeliveryaddress7__c,
        Hospital__r.Sparepartsdeliveryaddress8__c,
        Hospital__r.Sparepartsdeliveryaddress9__c,
        Hospital__r.Sparepartsdeliveryaddress10__c  
        from Rental_Apply__c where Id =: RentalApplyId];
        if(RentalApplyList.size()>0){
            RentalApply = RentalApplyList[0];
        }
        return RentalApply;
    }
    @AuraEnabled
    public static String saveAllDatas(String RentalApplyjson){
        Savepoint sp = Database.setSavepoint();
        try {
            Rental_Apply__c RentalApplyobj = (Rental_Apply__c)JSON.deserialize(RentalApplyjson,Rental_Apply__c.class);
            Rental_Apply__c addRentalApply = new Rental_Apply__c();
            addRentalApply.Id = RentalApplyobj.Id;
            addRentalApply.Medical_Institution_Address_sup__c = RentalApplyobj.Medical_Institution_Address_sup__c;
            addRentalApply.Medical_Institution_Address__c = RentalApplyobj.Medical_Institution_Address__c;
            addRentalApply.Sparepartsdeliveryaddress__c = RentalApplyobj.Sparepartsdeliveryaddress__c;
            addRentalApply.detailedAddress__c = RentalApplyobj.detailedAddress__c;
            update addRentalApply;
            return 'success';
        } catch (Exception e) {
            Database.rollback(sp);
            return e.getMessage();
        }
    }
       
}