KKbes
2023-04-14 f0584331cc6a7e0ff0a38d18b2b7463492f92f23
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
global with sharing class SelectRentalButtonController {
   
    @AuraEnabled
    public static Equipment_Set_Detail__c  getEquipmentSetId(String recordId){
        Equipment_Set_Detail__c res=new Equipment_Set_Detail__c();
        try{
            res=[select  Equipment_Set__c,Select_rental__c from Equipment_Set_Detail__c where Id=: recordId];
        }
        catch(Exception e){
            System.debug(Logginglevel.info,'*******e'+e);
        }
        return res;
 
    }
 
 
 
 
 
 
 
   @AuraEnabled
   public static List<Equipment_Set_Detail__c>  getEquipmentSet(String esid){
   
    try{
         List<Equipment_Set_Detail__c>    res=[select Id,Name,Select_rental__c
          from Equipment_Set_Detail__c
           where Equipment_Set__c = : esid];
         return res;
    }
    catch(Exception e){
        System.debug(Logginglevel.info,'*******e'+e);
    }
   
    return null;
   }
 
 
   @AuraEnabled
   public static List<String>  updateEquipment(List<Equipment_Set_Detail__c> sqlResult){
    List<String> res=new List<String>();
    try{
        for(Equipment_Set_Detail__c equipMent :  sqlResult){
            update equipMent;
            res.add('success');
        }  
    }
    
    catch(Exception e){
        System.debug(Logginglevel.info,'*******e'+e);
    }
    return res;
 
 
   }
 
 
   @AuraEnabled
   public static List<Equipment_Set_Detail__c> findIdArea(List<String> id){
    List<Equipment_Set_Detail__c> res = new  List<Equipment_Set_Detail__c>();
    try{
        
        res=[select Id,Select_rental__c from Equipment_Set_Detail__c where Id IN : id ];
    }
    catch (Exception e) {
        System.debug(Logginglevel.info,'*******e'+e);
    }
    return res;
   }
 
 
   @AuraEnabled
    public static String getSessionId(){
        return UserInfo.getSessionId();
    }
 
    @AuraEnabled
    public static List<String>  getRecords(){
        List<String> res= new List<String>();
 
        try{
        List<Equipment_Set_Detail__c>    obj = [select Id  from Equipment_Set_Detail__c where Select_rental__c=true];
            for(Equipment_Set_Detail__c equipMent : obj){
                res.add(equipMent.Id);
            }
        }
 
        catch(Exception e){
              System.debug(Logginglevel.info,'*******e'+e);
        }
 
        return res;
    }
 
}