| | |
| | | public class NewAgencyOpportunityController { |
| | | public without sharing class NewAgencyOpportunityController { |
| | | |
| | | static string sobjectType = 'Agency_Opportunity__c'; |
| | | |
| | | @AuraEnabled |
| | | public static ControllerResponse Init(string rid, string record_type_id){ |
| | | public static ControllerResponse Init(string rid, String pid, string record_type_id){ |
| | | system.debug('rid='+rid+',length='+(rid==null?'null':rid.length()+'')); |
| | | system.debug('record_type_id='+record_type_id+',length='+(record_type_id==null?'null':record_type_id.length()+'')); |
| | | |
| | |
| | | |
| | | data.put('data', ao); |
| | | } |
| | | if(!string.isBlank(pid) && !pid.contains('__c')){ |
| | | Id parentId = pid; |
| | | data.put('pidType', parentId.getSObjectType().getDescribe().getName()); |
| | | } |
| | | data.put('fields', SObjectHelper.GetFieldInfos(sobjectType)); |
| | | data.put('staticResource', Json.serialize(PIHelper.getPIIntegrationInfo('Agency_Contact__c'))); |
| | | res.IsSuccess = true; |
| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ControllerResponse Save(Map<string,object> data,string transId,Id recordTypeId){ |
| | | public static ControllerResponse Save(Map<string,object> data,string transId,String recordTypeId){ |
| | | system.debug('data='+data); |
| | | system.debug(!data.containsKey('Id') ); |
| | | system.debug( data.get('Id') == null); |
| | |
| | | } |
| | | |
| | | |
| | | public static ControllerResponse SaveCore(Sobject sobj, Map<string,object> data,string transId,Id recordTypeId ) { |
| | | public static ControllerResponse SaveCore(Sobject sobj, Map<string,object> data,string transId,String recordTypeId ) { |
| | | Integer index = 0; |
| | | string sobjectTypeValue = sobj.getSObjectType().getDescribe().getName(); |
| | | System.debug('sobjectTypeValue:'+sobjectTypeValue+' Info:' + JSON.serialize(data)); |
| | |
| | | } |
| | | } |
| | | @AuraEnabled |
| | | public static ControllerResponse getAWSDataIds(String agencyHospitalId){ |
| | | public static ControllerResponse getAWSDataIds(String agencyHospitalId, String accountId){ |
| | | system.debug('agencyHospitalId = ' + agencyHospitalId + 'accountId = ' + accountId); |
| | | ControllerResponse r = new ControllerResponse(); |
| | | List<String> conAWSIds = new List<String>(); |
| | | List<Agency_Contact__c> agencyContact = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c from Agency_Contact__c where Agency_Hospital__c =:agencyHospitalId and AWS_Data_Id__c!='']); |
| | | List<Agency_Contact__c> agencyContact = [select Id, AWS_Data_Id__c from Agency_Contact__c where (Department_Class__r.ParentId =:accountId or Agency_Hospital__c =:agencyHospitalId) and AWS_Data_Id__c!='']; |
| | | System.debug('agencyContact = ' + Json.serialize(agencyContact)); |
| | | for(Agency_Contact__c ac : agencyContact){ |
| | | conAWSIds.add(ac.AWS_Data_Id__c); |
| | | } |
| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static ControllerResponse searchAgencyContacts(String awsAgencyContactIds,String accountId){ |
| | | system.debug('awsAgencyContactIds = ' + awsAgencyContactIds); |
| | | public static ControllerResponse searchAgencyContacts(String awsAgencyContactIds,String agencyHospitalId,String accountId){ |
| | | system.debug('awsAgencyContactIds = ' + awsAgencyContactIds + 'agencyHospitalId = ' + agencyHospitalId + 'accountId = ' + accountId); |
| | | ControllerResponse resp = new ControllerResponse(); |
| | | resp.IsSuccess = false; |
| | | Map<String,Agency_Contact__c> awsIdToContactMapTemp = new Map<String,Agency_Contact__c>(); |
| | | if(!checkNullString(awsAgencyContactIds)){ |
| | | List<String> awsDataIds = (List<String>) JSON.deserialize(awsAgencyContactIds, List<String>.class); |
| | | System.debug('awsDataIds = ' + awsDataIds.size()); |
| | | List<Agency_Contact__c> conListTemp = new List<Agency_Contact__c>(); |
| | | if(!checkNullString(accountId)){ |
| | | Agency_Hospital_Link__c act = [select id from Agency_Hospital_Link__c where id = :accountId]; |
| | | conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c, Agency_Hospital__r.Name,Department_Class__r.Name from Agency_Contact__c where Agency_Hospital__c =: act.Id and AWS_Data_Id__c in:awsDataIds]); |
| | | String accId = ''; |
| | | String accHospitalId = ''; |
| | | if(!checkNullString(agencyHospitalId) || !checkNullString(accountId)){ |
| | | List<Agency_Hospital_Link__c> actList = [select id from Agency_Hospital_Link__c where id = :agencyHospitalId]; |
| | | List<Account> accList = [select Id, parentId from Account where id = :accountId]; |
| | | if (actList.size() > 0) { |
| | | accHospitalId = actList[0].Id; |
| | | } |
| | | if (accList.size() > 0) { |
| | | accId = accList[0].Id; |
| | | } |
| | | conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c, Agency_Hospital__r.Name, Department_Class__r.Parent.Name from Agency_Contact__c where (Department_Class__r.ParentId =:accId or Agency_Hospital__c =: accHospitalId) and AWS_Data_Id__c in:awsDataIds]); |
| | | }else { |
| | | conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c,Agency_Hospital__r.Name,Department_Class__r.Name from Agency_Contact__c where AWS_Data_Id__c in:awsDataIds]); |
| | | conListTemp = new List<Agency_Contact__c>([select Id,AWS_Data_Id__c, Agency_Hospital__r.Name, Department_Class__r.Name from Agency_Contact__c where AWS_Data_Id__c in:awsDataIds]); |
| | | } |
| | | for(Agency_Contact__c con:conListTemp){ |
| | | awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con); |