KKbes
2023-08-07 890eafcf31f5f8d519bb9e6f9c15303be5328e2d
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
96
97
98
99
100
101
102
103
104
105
//author :  kkbes
public with sharing class LexInquiryController {
 
 
    @AuraEnabled
    public static Task init(String recordId){
        Task res = new Task();
 
        try{
            res=[SELECT Id,Related_Opportunity1__c,QuoteIraiId__c ,Status FROM  Task  WHERE Id = : recordId ];
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
 
        return res;
    }
 
 
    @AuraEnabled
    public static List<Opportunity> getOpportunityIds(String RelatedOpportunity1){
        List<Opportunity> res = new List<Opportunity>();
        try{
            res=[SELECT id FROM  Opportunity    WHERE  Opportunity_No__c  =  : RelatedOpportunity1];
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
 
 
    @AuraEnabled
    public static QuoteIrai__c  getQuoteIrai(String QuoteIraiId){
        QuoteIrai__c res = new QuoteIrai__c();
        try{
            res=[SELECT Id,Lead__c  FROM  QuoteIrai__c  
            WHERE Id = : QuoteIraiId ];
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
 
        return res;
    }
 
 
 
    @AuraEnabled
    public static String makeAndUpdateLead(String leadId,String Id,String QuoteIraiId){
        Lead res = new Lead();
        try{
            res.Id =  Id;
            res.Opp_Name_Search__c =  leadId;
                if(QuoteIraiId != ''){
                    res.LatestQuotationEntrustment__c=QuoteIraiId;
                }
            update res;
            return 'success';
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String a =  e.getMessage()+' And '+e.getCause();
            return a;
        }
 
    }
 
    @AuraEnabled
    public static String makeAndUpdateTask(String Status,String Id){
        Task res = new Task();
        try{
            res.Id =  Id;
            res.Status = Status;
            res.Quotation_request_completed_time__c = System.now();
            update res;
            return 'success';
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            return e.getMessage();
        }
 
    }
 
    @AuraEnabled
    public static String makeAndUpdateQuoteIrai(String QuoteIraiStatus,String Id){
        QuoteIrai__c res = new QuoteIrai__c();
        try{
            res.Id =  Id;
            res.QuoteIrai_Status__c = QuoteIraiStatus;
            update res;
            return 'success';
        }
        catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            return e.getMessage();
        }
 
    }
 
 
 
 
}